# Running pyTivo/Galleon on Linkstation NAS



## DrewS3 (Sep 19, 2008)

Hi HME Gurus,
I have a Linkstation Pro v1 that I would like to turn into a upnp and tivo server. I am mostly interested in streaming my music (mp3s and wmas) and also photos, but this isn't as important. I don't care about streaming video.

I have installed a modified firmware with telnet, wget and ipkg (jtymod aka Freestation). But now I'm not sure if I can install pyTivo or Galleon on this. Do I need to install Debian (Freelink) instead?

I'm not very good with Linux, so I'm looking for the path of least resistance. I also like having a web interface to administer the NAS functions of the linkstation.

Any advice or pointers are appreciated.


----------



## CuriousMark (Jan 13, 2005)

Cool, I just recently got my hands on an LS Live (v2) and plan on doing the same thing when I can find time to play. Maybe we can work together.

Start by looking over at http://buffalo.nas-central.org/index.php/Main_Page which is the main Wiki for doing the kinds of things you want to do. there is a nice how-to for adding Galleon to a Kurobox that should be modifiable for the LS Pro and LS Live without too much effort. It is a bit old, though. Here is a link to that article.
http://buffalo.nas-central.org/wiki/Debian_Galleon_Media_Server

The LS Live processor has hardware acceleration for Java, I don't know if the Pro does or not, so Galleon should behave a good bit better on our equipment than it does on ChipR's Kurobox.

A good resource for questions while you are attempting this can be found at http://buffalo.nas-central.org/forums/ and I have found the people there very friendly and helpful. Which is nice for us duffers that don't know Linux or programming well enough to develop this stuff from scratch, but are good enough to make it work with a little guidance from knowledgeable folk.

If you do go this route, please create your own wiki page there and keep a log as you go, that way the next guy to try this will have a leg-up based on your experience.

CuriousMark

P.S. ChipR also participates here and has also been very helpful to me in the past.


----------



## DrewS3 (Sep 19, 2008)

Thanks for the info, Mark!
It looks like Galleon won't be a possiblity - my Linkstation Pro uses an Arm9 processor and the latest Java VM for it it 1.4 - I believe Galleon requires 1.5.

I'll look into getting pyTivo to work.


----------



## windracer (Jan 3, 2003)

I tried getting Galleon to work once on my LS2 (MIPSel version with the OpenLink firmware) and the java requirements were just too heavy for it.

I have also tried to run pyTiVo on it, but again ffmpeg's transcoding was just too much for it. I suppose if you were just sending MPEG-2 across (no transcoding) it might work.

http://www.tivocommunity.com/tivo-vb/showthread.php?p=5984234#post5984234

http://www.tivocommunity.com/tivo-vb/showthread.php?p=5345856#post5345856

http://www.tivocommunity.com/tivo-vb/showthread.php?p=5345296#post5345296

So I just keep my media on the Linkstation, which is mounted on my Linux server where pyTiVo runs and does the heavy lifting.


----------



## CuriousMark (Jan 13, 2005)

DrewS3 said:


> Thanks for the info, Mark!
> It looks like Galleon won't be a possiblity - my Linkstation Pro uses an Arm9 processor and the latest Java VM for it it 1.4 - I believe Galleon requires 1.5.
> 
> I'll look into getting pyTivo to work.


I hadn't investigated that yet, but yes it is a problem. We need a Java 1.5 VM that uses the arm9 processor's hardware acceleration or it probably isn't worth the effort.

I haven't opened my unit up with ACP Commander yet, because I believe the last update to ACP Commander is for an older firmware version and I fear it might break what I already have.


----------



## DrewS3 (Sep 19, 2008)

Mark, I opened my Linkstation Pro using this procedure:
http://forums.slimdevices.com/showthread.php?t=57224
instead of ACP Commander. It worked for me and is another option you may consider.


----------



## CuriousMark (Jan 13, 2005)

Thanks, I will check it out. Now off to bookmark that new resource!


----------



## DrewS3 (Sep 19, 2008)

Well, I got pyTivo up and running pretty easily by installing ffmpeg and python2.4 with ipkg.

I started pyTivo.py via the command line and it looks like it works. The pyTivo web administration tool works and the MyMusic label appears on my TivoHD. When I enter it I see a list of the artist directories in my Music directory on the LinkStation. But that is as far as I get. Any attempt to click or scroll comes up with "Error#3-5-6".

I've Googled this error but it doesn't seem to be much information on it. Does anyone know what causes this?

*EDIT* It does seem to work on about 20&#37; of the clicks, I was able to play some mp3 but further navigation would show the 3-5-6 error. I wasn't able to play WMAs (yet) - the ffmpeg output says "unsupported codec" so hopefully I can get this working.


----------



## NA9D (May 26, 2008)

DrewS3 said:


> Mark, I opened my Linkstation Pro using this procedure:
> http://forums.slimdevices.com/showthread.php?t=57224
> instead of ACP Commander. It worked for me and is another option you may consider.


There are two different hardware versions on the Linkstation Live - older and newer for lack of a better term. My $40 special I just picked up is the newer hardware version and I'm wondering if this JTYMOD firmware will work on it because I'd really love to run pyTivo on that box along with Firefly for serving audio. The guys over at the Buffalo NAS forums said to install Freelink which is a version of Debian but it has not web interface and I'd rather not mess with sending Unix commands if I don't have to!

So curious if you have a "Pro" or a "Live" (any difference?) and which hardware model. There's so many different variations out there it is highly confusing.


----------



## CuriousMark (Jan 13, 2005)

NA9D said:


> So curious if you have a "Pro" or a "Live" (any difference?) and which hardware model. There's so many different variations out there it is highly confusing.


I have a Live version 2 with firmware version 2.10. The Live hardware is the same as the Pro hardware, the difference is the software. The Live includes Pcast built in and automated backup software that can be installed on the PC and works with a backup server built into the Live. If you install Freelink you will loose those. If foonas is available for the Pro/Live v2, it might be a better fit. I think it has several useful features built in that make it a better replacement than Freelink. As you can see I have a lot of reading to do to figure out which way to go before proceeding. Let's keep sharing what we learn.

Pcast which is on your unit will serve your music, you don't need to add Firefly. Mine is giving me trouble either with a corrupt file or possibly a hard disk error. Pcast tries to index and hangs with a clicking noise coming from the drive. I need to disassemble it and check the drive before I start upgrading it. I have found I do these things best when I can put long stretches of time into it or work on it a little every day. So far that isn't happening for me so I am holding off on diving into it.


----------



## NA9D (May 26, 2008)

Agreed. From what I've heard the version 2 hardware can be nearly bricked if you don't install the firmware right. The guys at the Buffalo NAS forums basically said Freelink was the only option. I looked further and the JTYMOD software is what I tried to install this past weekend but I almost bricked my unit. I found a post in the NAS forums about how to recover from what I did. I had to set up a TFTP server on my desktop and hook it up to the Linkstation using an IP of 192.168.11.1. The Linkstation goes and looks for updated firmware files on bootup from the IP. So if you screw up and do what I did you can get back but it was scary to think I almost bricked is.

As for not needing Firefly - you are correct to a point. The Linkstation comes with MT-DAAPD installed (as part of PCAST) and Firefly is basically MT-DAAPD. But I am not able to get to the MT-DAAPD configuration web page (just loads a blank page) and am not able to configure playlists or anything like that. It serves the music fine, but I'm not able to customize it beyond that. That's why I want to do an update to the software. I wasn't going to do much of anything until I thought about running pyTivo on the box and that's why I'm much more interested in doing this now.


----------



## wmcbrine (Aug 2, 2003)

DrewS3 said:


> Any attempt to click or scroll comes up with "Error#3-5-6".
> 
> I've Googled this error but it doesn't seem to be much information on it. Does anyone know what causes this?


That error is the bane of my existence. I spent many fruitless hours trying to track it down or work around it -- particularly difficult because it happens so sporadically. The best I can figure is that it's some weird timing issue. (Note: _Not_ simply a case of a request taking too long; it's more random than that.)

It seems to happen more often with slower servers. (It doesn't happen at all with my main Linux system; I only used to see it on my Windows laptop. So at first, I thought it was a Windows issue; but then I read other reports like yours.) Unfortunately, that means you're likely to see it a lot on a NAS. Sorry.


----------



## CuriousMark (Jan 13, 2005)

wmcbrine said:


> That error is the bane of my existence. I spent many fruitless hours trying to track it down or work around it -- particularly difficult because it happens so sporadically. The best I can figure is that it's some weird timing issue. (Note: _Not_ simply a case of a request taking too long; it's more random than that.)
> 
> It seems to happen more often with slower servers. (It doesn't happen at all with my main Linux system; I only used to see it on my Windows laptop. So at first, I thought it was a Windows issue; but then I read other reports like yours.) Unfortunately, that means you're likely to see it a lot on a NAS. Sorry.


The reason I bought the Live was because it is faster than my old LS1. I am hoping it will work better for that very reason, but the posts above are raining on that parade. This box does have Java on it, so perhaps Galleon will do better.


----------



## NA9D (May 26, 2008)

Hey, I have a little more info on getting access to the guts of the Linkstation Lives. One of my goals was to install a full fledged copy of Firefly Media server on the box. Thanks to some helpful users at the Roku Forums, I got pointed to the following article: http://wiki.fireflymediaserver.org/Linkstation_Live_Pro_Install

Problem is, some of the links in there are bad but I managed to find everything and have requested they update the Wiki entry.

The most important item for our purposes is a program called "ACP Commander" it basically unlocks Telnet and disables the root password on the box. So you can copy files into the box and install them, etc.

ACP Commander is at: http://downloads.nas-central.org/TOOLS/ALL_LS_KB_ARM9/ACP_COMMANDER/acp_commander.jar

Now, since PyTivo is written in Python, it should run on any platform that has a Python interpreter installed. The big question is if the LSL has a Python interpreter. You might be able to install one for an ARM9 processor - not sure but I think there is one on the Debian package page that you can find at http://packages.debian.org. Not sure if it would run properly on the stock LSL firmware though as I don't know what version Unix/Linux is run on the LSL by default and if a package created for Debian will run on other platforms.

Anyhow, this is closer now than we were!

I'm having other problems with PyTivo right now but that's something for a different thread...

Edit: One more thing. See this link: http://buffalo.nas-central.org/index.php/Open_Stock_Firmware

It tells you all you need to know to enable telnet or SSH on the box and keep it that way and also to add things like wget, etc. So there may be no need to add different firmware as long as telnet is enabled.

Edit II: I found an Arm9 Python interpreter on the buffalo nas site: http://downloads.buffalo.nas-central.org/Uploads/OldUploads/armstation/

Getting closer...


----------



## NA9D (May 26, 2008)

Hey Gang,

I have pyTivo up and running on my Linkstation Live and it is working fine for serving up MPEG-2 files no problem.

Thanks to the posts above in the thread and I was able to cobble it together today. This is cool. Anyhow, some questions:

1.) Currently I am telneted into the Linkstation and I start pyTivo as a console session. Obviously, if I end the session, pyTivo stops. How do I start pyTivo as a Daemon? I tried setting up a startup script in the /etc/init.d directory but it just basically started a console session as well. I was thinking about adding it to the startup script but I'm afraid the startup script would never quit since I'd kinda be starting a console session. So, how can I start it as a Daemon in Unix?

2.) I downloaded and installed FFMPEG via ipkg. When I try to transfer an MP4 file, I see FFMPEG starting up on the console output but, I keep getting an error "unsupported codec." So what am I missing there? I tried several files and the same thing happened each time.

Thanks in advance for any help here.


----------



## NA9D (May 26, 2008)

Sorry to be "blogging" here but perhaps someone some day may find this useful. I've managed to get pyTivo running on the Linkstation Live as a Daemon and it's working pretty well. Here is the startup script for this:


```
# chkconfig: 2345 99 05
# description: pyTivo server

### INIT INFO
# Provides: pytivo
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-description: pyTivo server
# Description: Start and stop the pyTivo server.
# Startup Script for use on Linkstation based NAS products
# By Jon Ogden, NA9D
# Based on the script posted by armoo at http://pytivo.armooo.net/wiki/initd
# Requires enhanced PS command for the Linkstation.  See instructions at:
# http://buffalo.nas-central.org/index.php/Open_Stock_Firmware#Full_version_of_ps
### END INIT INFO

RETVAL=0

start() {
echo -n "Starting pyTivo: "
ps ax | grep pyTivo.py | grep -v grep 
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "pyTivo already running: Exiting" && exit 1

# this call actually starts pyTivo.
python /mnt/disk1/Media/pyTivo/pyTivo.py > /dev/null 2>&1 &
RETVAL=$?
[ $RETVAL -eq 0 ] && echo -n "done"
echo
return $RETVAL
}

stop() {
echo -n "Stopping pyTivo: "
kill `ps ax | grep pyTivo.py | grep -v grep | awk '{print $1}'`
echo
[ $RETVAL -eq 0 ] && echo -n "done"
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
```
This is a modification of armoo's script as noted in the code. The LS does not have the pgrep and pkill commands, hence the modifications.

Also, you will need to be sure to download the enhanced PS command for this to work. Instructions are found at: http://buffalo.nas-central.org/index.php/Open_Stock_Firmware#Full_version_of_ps

Now, to just figure out why ffmpeg isn't decoding my MPEG-4 files properly. I'm sure I'll get that figured out too!


----------



## windracer (Jan 3, 2003)

I'm the proud owner of a new 1TB Linkstation Live (v3). My old 250gb has been so reliable I stuck with a good thing.

I haven't thought about hacking it just yet, though ...


----------



## NA9D (May 26, 2008)

Hey guys,

I just tried sitting here at lunch and between using my VPN, Slingbox and browser, set up a Music section on pyTivo on my Linkstation. I too am getting that Error #3-5-6. It happens just trying to browse some of my albums, let alone playing.

What's odd is that I'm running "TOP" on a telnet console logged into the Linkstation. I can see the python process and it's taking very little CPU time - so I am not sure it's "speed" related. Python was taking up maybe 10% of the CPU time at most.

Thought I'd let y'all know...


----------



## DrewS3 (Sep 19, 2008)

Re #3-5-6 error


wmcbrine said:


> That error is the bane of my existence. I spent many fruitless hours trying to track it down or work around it -- particularly difficult because it happens so sporadically. The best I can figure is that it's some weird timing issue. (Note: _Not_ simply a case of a request taking too long; it's more random than that.)


Has Tivo had any response to what the #3-5-6 error means?


----------



## TracySMiller (Oct 14, 2002)

wmcbrine said:


> That error is the bane of my existence. I spent many fruitless hours trying to track it down or work around it -- particularly difficult because it happens so sporadically. The best I can figure is that it's some weird timing issue. (Note: _Not_ simply a case of a request taking too long; it's more random than that.)
> 
> It seems to happen more often with slower servers. (It doesn't happen at all with my main Linux system; I only used to see it on my Windows laptop. So at first, I thought it was a Windows issue; but then I read other reports like yours.) Unfortunately, that means you're likely to see it a lot on a NAS. Sorry.


I run pyTIVO on my Windows Home Server to serve video, photos, and music to my S3 TIVO and it has been working wonderfully for about a year, but in the last couple of weeks I have started getting the "error #3-5-6", with increasing frequency when I serve music. I don't know that anything is different now than before (with my server). I guess it is possible that some spyware is causing my server to run more slowly than in the past. It only occurs when scrolling through menus or leaving menus, never when music is playing.

I guess it wouldn't hurt for me to run some anti-spyware programs on my server to see if things start behaving better. A few days ago I got that error about 4 times in a row while trying to reach a certain song in a certain folder (each time it would dump me back out to the Music, Photos, etc menu in TIVO). Very frustrating!


----------



## CuriousMark (Jan 13, 2005)

DrewS3 said:


> Has Tivo had any response to what the #3-5-6 error means?


it means that the remote server closed the connection unexpectedly.

The TiVo thinks that pyTivo closed the connection. The question is which connection, scrolling the list opens and closes many short connections.


----------



## wmcbrine (Aug 2, 2003)

I've just made a change (in my repo now) which I have hope may address the #3-5-6 (and #5-6) errors. But since I can no longer evoke #3-5-6 myself, I can't really say. (I even dug up an old 750 MHz machine, but I couldn't get the error to come up, although I'd previously seen it on a 1.4 GHz machine.)

Anyway, if you're affected, please try it out and let me know if it helps.


----------



## wmcbrine (Aug 2, 2003)

Nobody?


----------



## NA9D (May 26, 2008)

wmcbrine said:


> Nobody?


I have not yet had a chance to test this. It's on my list.


----------



## CuriousMark (Jan 13, 2005)

wmcbrine said:


> ...please try it out and let me know if it helps.


Perfection is attained. :up: I cannot kill it on my old slow Kurobox NAS which has a 200Mhz PowerPC (MPC 8241) processor with 64MB of ram. No more errors. This will now become my primary pytivo music and photos server and I will stop turning the computer on for those functions anymore.

Thank you so very much for continuing to dog this problem and finally finding the answer. I never would have figured this one out on my own.


----------



## NA9D (May 26, 2008)

It works. No more errors.

But the ffmpeg distribution that ipkg has for the Linkstation ARM processor is so worthless it gives me an "unsupported output codec" error when trying to transcode MP4 to MP3! I would really love to get my hands on a better version but I don't have the knowledge or skills to cross-compile the software at this point...


I'm thinking of moving away from running pyTivo on that box because of the ffmpeg version that's out there....


----------



## OKCRandy (Jul 7, 2006)

Is there any info on adding pyTivo or Galleon to a LinkStation Quad?


----------



## NA9D (May 26, 2008)

I've pretty much abandoned running pyTivo on my Linkstation. The main reason is that the FFMPEG version that is out there for that platform is over a year old and won't transcode properly. The second is that as others have pointed out, there is simply not enough processor power in these NAS boxes to support real time transcoding. The boxes don't even fully support Gigabit transfer speeds (the CPU maxes out while doing the file transfer) and the best you can get is about 250 Mb/sec. So they just aren't robust enough.


----------



## OKCRandy (Jul 7, 2006)

Thank you for the reply, I finally found the answers at the .org site, I tried to register to the forum there and never get a validation notice.

I am looking at the Qnap series of NAS but not sure about them. Any thoughts on a versital powerful NAS?

I wish I had done more resarch before buying the LS-QL.

Cheers
Randy


----------



## CuriousMark (Jan 13, 2005)

The utmost in versatility you could go with something built on an Atom or faster x86 based chip with lots of memory. It won't be low power consumption and it won't be small, but you can get anything imaginable running on it.


----------



## wmcbrine (Aug 2, 2003)

If it helps, I've recently modified my fork of pyTivo so that it can run without ffmpeg. Of course, in this mode, it will only serve MPEG, VOB, .TiVo and MP3, and you lose the trick play for MP3. (This is actually how the music plugin _used_ to work, back in the day.)


----------



## roncova (May 7, 2010)

I'm trying to run the posted pyTivo daemon script on a Linkstation Live v3 running the 1.24modA1 opened firmware. It is apparently unhappy. Here's the output:

:/etc/init.d# ./pyTivo.sh start
: command not found:
: command not found8:
: command not found0:
'/pyTivo.sh: line 21: syntax error near unexpected token `{
'/pyTivo.sh: line 21: `start() {


I'm not super-savvy with Linux so would appreciate some help.


----------



## roncova (May 7, 2010)

I resolved my previous issue with the pyTivo service, which was apparently caused by my use of a Notepad rather than a UNIX editor.

Now, I can successfully start pyTivo using the

```
./pyTivo.sh start
```
 command, however, when I close my ssh session, the process apparently terminates. I want pyTivo to run without me being interactively logged in.


----------



## windracer (Jan 3, 2003)

Check out the sample init script from the wiki.


----------



## roncova (May 7, 2010)

Thanks. I should have clarified. I am running a modified version of that script posted in this thread earlier by NA9D and have used further instructions that supposedly should run it as a service or daemon, found here:

buffalo.nas-central.org/wiki/Installing_pyTivo_on_Linkstation_Live

For some reason, though, it doesn't persist if I logout of my SSH session and doesn't get started if I restart the Linkstation.


----------



## windracer (Jan 3, 2003)

Hmmm, not sure. That script looks fine to me, and as long as you've got the call to it in the init scripts, it should start up at boot (and stay running in the background).

Make sure you have that ampersand at the end of the line that starts pyTiVo:


```
python /mnt/disk1/Media/pyTivo/pyTivo.py > /dev/null 2>&1 &
```
That's what makes the process run in the background.


----------



## roncova (May 7, 2010)

The "&" is definitely there.


----------



## eboydog (Mar 24, 2006)

Sorry for pulling up a old thread however I'm playing around with a couple linkstation pro I have and I'm thinking about installing pyTivo on one of them to serve up .Tivo files along with some avi and mpeg files. 

Yes I know that processor on these isn't very powerful to do the fmpeg encoding but are there anyone out there running this on their linkstation pro NAS? 

I'm considering converting my old NAS to FreeNAS but I'm trying to find something to serve up pyTivo with a dedicated appliance rather than a full blown PC.


----------



## windracer (Jan 3, 2003)

I think the lack of activity in this thread for the past four years is the answer to your question. 

Seriously, though, I'm sure there are people running pyTiVo on their NAS units, but unless you're just serving up files that don't need to be transcoded, it's probably not worth it. I tinkered with this back in the day but it was just too slow and not worth the effort.


----------

