# Tivo media server on Buffalo Linkstation.



## tmorehen (Dec 25, 2005)

I have sucessfully implemented a Tivo media server on my Buffalo Linkstation networked attached storage. The linkstation is a linux-based device that hangs up to 250 mb of storage off your network in a compact, quiet package. You don't have to have your pc on to play mp3s or view your pictures!

Warning: you need some basic linux skills and command line access to your linkstation before you begin. For instructions on command line or telnet access to your linkstation see linkstationwiki.org.

What you need:
1) ppctools or mipstools depending upon your linkstation version from LinkStationwiki.org
2) LibJpeg from: www.jpegsrc.v6b.tar.gz at ijg.org/files

* do the ususal ./configure; make; make install.
* You must also make install-lib

3) ImageMagick-6.2.5-5.tar.gz from www.imagemagick.org/script/download.php

* again, do the usual ./configure; make; make install.

4) byRequest tivo HMO server at sourceforge.net/projects/byrequest

* edit the Makefile to set DESTDIR to the location where you want the media server installed. I recommend /usr/local/bin
* do make; make install
* copy byRequest.conf to /etc; edit the image: and audio: lines to the locations where you store your files. Note: your shares are subfolders of the /mnt folder. I recommend commenting out the virtual: line as the virtual audio folders (for artist, album and title) run very very slow on the Linkstation.
* start the server with

/usr/local/bin/byRequest /etc/byRequest.conf -preload

* You should set up a script in init.d to start/stop the byRequest daemon and the appropriate symlinks in /rc.d/rc2.d (start) and rc0.d and rc6.d (both stop or kill) in order to start the daemon when the Linkstation restarts.


----------



## aderynmor (Apr 30, 2006)

Greetings,

Thanks very much for your post on installing the ByRequest tivo media server on a Buffalo LinkStation. I found this post very helpful. :up: 

I did have one problem however (most likely due to my lack of experience with linux). When installing ImagineMagick, the installation dindn't completely finish because the LinkStation's version on linux didn't have the SORT command. As such, though the media server is running fine, it can't properly process image files. I'm curious if you had this problem and if so, how you overcame it (installing a full version of debian on the LinkStation perhaps?).

Any help would be greatly appreciated.

Thanks,
aderynmor

PS Have you heard of anyone modifying the ByRequest.conf file to support aac music files (m4a etc)?


----------



## tmorehen (Dec 25, 2005)

I'm using a modified firmware for the linkstation, openlink 52b, also from www.linkstationwiki.org.

It installs busybox in /bin and adds a symbolic link named sort in the /usr/bin directory.

busybox is a utility designed for embedded linux that replaces many of the small, standard linux utilities. It performs the appropriate task depending on how it's called, i.e. depending on the symbolic link name.

I'd check to see if you have busybox in /bin and if you do, create the appropriate sym link by:

cd /usr/bin
ln -s ../../bin/busybox sort

Good luck.


----------



## JacksTiVo (Jan 7, 2006)

I am not a programmer and know that attempting the hack that you recommend will get me into trouble and I won't know how to fix it. Is anyone aware of any freeware or utility program that will permit me to access my Buffalo Linkstaton directly from my Tivo media center? I store all of my phots on it and would like to access them without the need for my PC to be on.

I undestand it is the Linkstation that has to be reprogrammed, just it would be nice if a utility program could automate the reprogramming.

Thanks.


----------



## chelman (Oct 27, 2004)

Thanks tmorehen for your instructions on how to byRequest HMO Tivo server!

I assume everything went OK during installation because I'm able to see the folders with my pictures. The only problem is that when I press play to open any folder, the tivo reboots. I don't know what is causing it.


----------



## windracer (Jan 3, 2003)

I've been running OpenLink on my Linkstation for some time and have been thinking about trying to run Galleon on it. This looks like a cool proof-of-concept that the Linkstation might be able to handle it.

I used to run byRequest on my Linux server back in the early HMO days but eventually switched to JavaHMO and still run Galleon. Since all of my music and photos are on the NAS, I incur a slight network hit when Galleon, running on the Linux server, has to pull the files from the NAS via samba. It would be great to be able to consolidate this.

Nice work!


----------



## tmorehen (Dec 25, 2005)

When I try to view pictures, my Tivo reboots as well. It was working originally so one of the Tivo firmware upgrades must have introduced an incompatibility. I'll look into this.


----------



## tmorehen (Dec 25, 2005)

I got mine working again. I'm not sure exactly what was the problem. It looks to me that I had 2 things blow up. Those problems, combined with a bug in the TiVo software causes the reboot. Here's what happens when the TiVo enters a photo directory.

It requests a list of all the files and sub-folder
For the picture files, it requests a thumbnail-sized jpg (88x60)
byRequest spawns a child process that asks "convert" to convert the file type if necessary to jpg and to resize to thumbnail size
byRequest then sends the file to the TiVo
When you select a thumbnail, the TiVo requests a bigger jpg that fills about 1/4 of the screen
Finally, in a slide show, TiVo requests a jpg big enough to fill the screen

If byRequest has problems and sends a wrong-sized file (either a 0 length file or the raw jpg), the TiVo ignores the file in thumbnail view or quarter screen view. However, in screenshow mode, there is a bug: no checking for a bad jpg. This crashes the TiVo.

Note that, due to the lack of processing power of the linkstation, converting jpgs take some time, which leads to the somewhat lengthy delays before pictures show up in the various views (thumbnail, quarter screen, slideshow).

Here are some tests to run after you have logged into the linkstation:

At the command line, type in convert <return>. You should see the version of ImageMagick and the usage and commandline options for convert.
If something else appears, your Imagemagick installation is broken. Reinstall. See below.
If the preceding test succeeds, cd to your to a directory on your picture share (/mnt/{picture share}/{directory}
Type convert -size 88x60 -resize 88x60 {jpg filename} jpeg:-
You should see a whole bunch of garbage sent to the screen. If however you see an error message about a missing decode partner, you may need to reinstall libjpeg or ImageMagick.
To check your libjpeg installation, type ls /usr/local/lib. You should see 5 libjpeg entries. As a precaution, type ldconfig /usr/local/lib.
If there are no libjpeg entries, reinstall libjpeg and do the ldconfig command above.
If libjpeg is there, do this check, type identify -list format. You should see jpeg or jpg with a rw usage in the output. If it's missing reinstall Imagemagick.
Before you reinstall Imagemagick, you may want to install png support from http://www.libpng.org/pub/png/libpng.html
To reinstall ImageMagick, cd to your Imagemagick source directory and type ./configure LDFLAGS='-L/usr/local/lib -R/usr/local/lib' -with-jpeg.
Follow up with a make clean; make; make install.
Rerun the identify test. You should now have jpg support (and png support if installed).
Rerun the convert command again. You should now see garbage on the screen -- no decode partner errors.
Now access your pictures from your TiVo (thumbnails or quarter screen). Be patient, the linkstation is slow and don't run a slideshow unless you see the thumbnails or quarter screen views. 
If everything is successful to this point but you don't see any thumbnails or quarter screen view, byRequest is bollixed. Try reinstalling it (kill the byRequest server: make clean; make; cp byRequest /usr/local/bin; ./byRequest /etc/byRequest.conf). Do not make install. It will overwrite your byRequest.conf.
Rerun the TiVo test, you should now see your pictures. If not, extract image.c in the attached zip to your byRequest source directory and do a reinstall as above.

If you have trouble with image.c, pm me your email address and I'll email you my byRequest binary. It's too big to attach to this post. If you go this route, kill the byRequest server (run ps ax; kill {pid number of the first byRequest entry}; cp the new binary to /usr/local/bin; /usr/local/byRequest /etc/byRequest.conf -preload. Note the preload takes about 5 minutes and you can't access anything until its complete.

Good luck. Let me know what happens. It'll help to know where the problem was.


----------



## AceRoehrborn (Jan 2, 2007)

I don't have much experience with linux but would like to attempt to get a media server running on my Linkstation. 

Would someone who has this working be willing to post detailed instructions on how to get this to work?


----------



## chelman (Oct 27, 2004)

I'm still not getting the pictures to show. One thing I noticed after following your instructions is that the thumbnail icon changes from a clock to a tree, but still no thumbnail of the actual pictures. Here are some of the issues:



> At the command line, type in convert <return>. You should see the version of ImageMagick and the usage and commandline options for convert


 I still get a message "command not found" for both *convert* and *identify.* I've installed libjpeg, ImageMagick and byRequest (and copied your image.c) several times. I guess I need to get *convert* and *identify* to install but I don't know why they aren't installing.

There is only one libjpeg entry in /usr/local/bin: libjpeg.a; the rest are libjpng.*, libMagick*.*, and libwand.* I noticed some entries; /usr/local/include/jconfig.h, /usr/local/include/jpeglib.h in /usr/local/include. Should I copy them to /usr/local/bin?

Would this setup work better on Debian? I got another LS with FreeLink/Debian 2.6.


----------



## telecomkid (Jan 27, 2007)

Is there anybody hear about QNAP's TS-101? it is a NAS with lots of application server features. 

One of my friend told me there is a beta program so I also joined. QNAP has implemented a function called "QTiVo station". Once enable the function on TS-101, all recordings will be automatically transferred and backup to your TS-101 without turning on PCs. If there is anyone interested in joining the program you may send a mail to me. I can also mail you the special version firmware or link you with the product manager.

Cheers


----------



## chelman (Oct 27, 2004)

tmorehen,
:up: Thank You for your directions! I was finally able to make it run with your good directions. I quit trying on the HD H250LAN (mipsel) and started brand new on the HD-HG400LAN (ppc) with Openlink 0.52b.

What I made different this time is: I made sure I had the 2.4 kernel headers and the links to od, sort and uniq. I also created the /tmp/cache folder for the thumbnails. I think that was it.

Now, I have about 5 GB of pictures in many folders and I don't know if it can handle that many. I've been adding them little by little to see if/when it fails loading all the pictures.


tmorehen said:


> * You should set up a script in init.d to start/stop the byRequest daemon and the appropriate symlinks in /rc.d/rc2.d (start) and rc0.d and rc6.d (both stop or kill) in order to start the daemon when the Linkstation restarts.


 I need your help to set up the script in init.d and the appropriate symlinks to start when the LS starts. We've been having power failures lately and I don't want to restart it every time the power fails. Thanks again!


----------



## tmorehen (Dec 25, 2005)

I've attached my script file. It should be put in /etc/init.d . You should rename it to byRequest ie delete the .txt extension.

You'll also need to make it into an executable with the following command:
chmod +x /etc/init.d/byRequest

Now you'll need to set up the symlinks:

cd /etc/rc.d/rc2.d
ln -s ../init.d/byRequest S93byRequest

cd /etc/rc.d/rc0.d
ln -s ../init.d/byRequest K15byRequest

cd /etc/rc.d/rc6.d
ln -s ../init.d/byRequest K15byRequest

Just in case the attachment didn't work here's the script:

###########cut starting at the following line
#!/bin/bash
#
# byRequest This shell script takes care of starting and stopping
# the byRequest TiVo Media Server.

PROG=/usr/local/bin/byRequest

RETVAL=0

start() {
[ -x $PROG ] || exit 0

# Start daemons.
echo -n $"Starting byRequest TiVo Media Server: "
$PROG /etc/byRequest.conf -preload
RETVAL=$?
echo
return $RETVAL
}

stop() {
echo -n $"Shutting down byRequest TiVo Media Server "
/sbin/start-stop-daemon --stop --quiet --exec $PROG
RETVAL=$?
echo
return $RETVAL
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
sleep 1
start
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac

exit $RETVAL


----------



## Leota (Oct 22, 2011)

I found this thread to be extremely helpful. I know it is a old thread, but I have an old buffalo linkstation that I have been trying to install the Tivo media server on. Thanks a lot!


----------

