pyTivo Discussion Forum Forum Index pyTivo Discussion Forum
Answers and the development of pyTivo a TiVo transcoding server
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pytivo on Synology Diskstation
Goto page 1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Support
 View previous topic :: View next topic  
Author Message
jcthorne



Joined: 30 Jan 2008
Posts: 384
Location: Houston, TX

PostPosted: Tue Jun 14, 2011 2:48 pm    Post subject: Pytivo on Synology Diskstation Reply with quote

Just installed a Synology Diskstation DS1511+ over the weekend to replace a large collection of usb drives, a rats nest of cables and zero recovery for failed drives. Glad to report that with only a few trips, the new fileserver RAID is working as intended, is fully backed up and has plenty of room to grow.

Now I would like to learn about getting pytivo, HME for python and perhaps Harmonium up and running on the server rather than on a windows laptop. The Synology DS is an Intel Atom D525 x86 processor. I have found instructions on Synology's site for bootstrapping and installing ipkg. While I have not done those parts yet, it looks to be something I can handle without destroying the fileserver Smile

I would appreciate some instructions, pointers, links etc for getting me to my goal. Thanks a bunch in advance.
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 337

PostPosted: Tue Jun 14, 2011 10:09 pm    Post subject: Reply with quote

I'm sure it's awesome, definitely a little jealous. Like I said in the other thread transcoding speeds on my DS411slim are awful (2fps for 1080p) but your's may end up being much faster. It works great for file pushes from pyTivo. The most I transcode is during a file remux DTS audio changed to AC3 which runs at 100fps most of the time.

When you bootstrap just make sure you choose the package that is meant for your CPU. It looks like this is your bootstrap file.

After you bootstrap it is really straight forward to install pyTivo. If you need a custom FFmpeg it is a little more involved but doable and may be worth compiling to optimize for your CPU instead of Synology's generic version.

Start with ssh'ing into the NAS and installing Python.
Code:
   
ipkg update
ipkg install python


Download and extract pyTivo to your NAS and copy the pyTivo folder to '/usr/local/pyTivo'

For you conf file FFmpeg is located at '/usr/syno/bin/ffmpeg'

Next to get pyTivo to start on bootup you need to create a startup script. In a file you should place as '/usr/local/pyTivo/start.sh' insert
Code:
   
sleep 60
/opt/bin/python /usr/local/pyTivo/pyTivo.py > /dev/null 2>&1 &


In a file you should place as '/usr/local/etc/rc.d/pyTivo.sh' insert

Code:

RETVAL=0

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

    sh /usr/local/pyTivo/start.sh > /dev/null 2>&1 &
    RETVAL=$?
    [ $RETVAL -eq 0 ] && echo -n ""done""
    echo
    return $RETVAL
    }

    stop() {
    echo -n ""Stopping pyTivo: ""
    kill -9 `ps |grep pyTivo.py |grep python | awk -F" " '{print $1}'`
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && echo -n ""done""
    echo
    return $RETVAL
    }

    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


Make sure to make each script executable with 'chmod 755 filename.sh'

Reboot your NAS and you should have the pyTivo webpage appear at http://NAS:9032

I occasionally have issues with pyTivo running on two devices at once but haven't sat down to get that fixed yet. I think there was something related to a GUID that needs to be in the pyTivo.conf but not sure.

*Original credits for instructions go to the users on Synology forums.
Back to top
View user's profile Send private message
jcthorne



Joined: 30 Jan 2008
Posts: 384
Location: Houston, TX

PostPosted: Tue Jun 14, 2011 11:06 pm    Post subject: Reply with quote

Between your instructions and some I found at the synology forum, I am getting started but...

Iluvatar wrote:
Download and extract pyTivo to your NAS and copy the pyTivo folder to '/usr/local/pyTivo'



This is where I fell off the track. HOW does one do this? I can place the tar.gz file on the DS but not in /user/local/pytivo as I cannot see that from the file browser and from the command prompt I cannot seem to get to the file at /volume1/File Storage/temp/pytivo.tar.gz

The space in File Storage seems to be a problem but I still dont think I have the commands right. A little basic linux help? Confused

Thanks!
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 337

PostPosted: Tue Jun 14, 2011 11:26 pm    Post subject: Reply with quote

what I did was go ahead and extract pyTivo ahead of time. Or you can use
Code:
 
tar xvzf "/volume1/File Storage/temp/pytivo.tar.gz"

Then I placed the pyTivo folder on my NAS share. Once you have done this you can copy it into place with
Code:
 cp -R "/volume1/File Storage/temp/pyTivo" /usr/local/


The easiest way to make the scripts also would be to copy the code into a text editor and then save the file on your NAS and then copy the files in place the same way.

*if its possible I would reconfigure your share to have no spaces in it. Espicaillay if you are going to be using command line often. Placing the " " around a path with a space in it works but I don't think its the geek approved way of doing it. I grew up using Windows....bad habits.
Back to top
View user's profile Send private message
jcthorne



Joined: 30 Jan 2008
Posts: 384
Location: Houston, TX

PostPosted: Wed Jun 15, 2011 1:47 am    Post subject: Reply with quote

Thanks for the help. Still not there yet.

I got pytivo in the directory /usr/local/pyTivo and edited the pytivo.conf file.

I used the command line:
/opt/bin/python /usr/local/pyTivo/pyTivo.py > /dev/null 2>&1 &
and see no response in the SSH window. Just a return to the prompt.

I then put http:\\ThornolisDS:9032 in a browser window and pytio's web interface pops up so its running. Now it begs the question How do I stop it?

Is there any way to see the text feedback that I used to get in the cmd window in Windows while pytivo is running ?

A replacement for tivodecode?

I truly appreciate the help. Making progress and learning a thing or 3.


EDIT: Figured out how to stop the command line started session. Just closed the SSH session.

I'll go work on those 2 scripts, the photo library etc and try again tomorrow.
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 337

PostPosted: Wed Jun 15, 2011 2:05 am    Post subject: Reply with quote

if you want to run pyTivo and see the output then open your ssh session and type 'python /usr/local/pyTivo/pyTivo.py'. Its the '/dev/null 2>&1 & ' that is telling the prompt to reroute all feedback into /dev/null and allow you to continue using pyTivo in the background.

As for running it at startup and still seeing the feedback....no I don't think there is. Once you start using pyTivo as a service you are kind of flying blind as to what is going on. I would recommend running pyTivo just as you did with the command so you can make sure that your config works as expected and you get the errors to show you what you need to fix....and then move to using the service. You can kill the service by typing 'killall python'

I don't use tivodecode so I can't help you there. Since you have an x86 cpu you probably would be ok with downloading the Linux tar.gz version and setting it up normally with pyTivo. If that doesn't work you could compile the source....very involved though.

PS: I would be interested to see what your avg FPS on HD transcode is.
Back to top
View user's profile Send private message
wmcbrine



Joined: 04 Jan 2008
Posts: 2601
Location: Maryland

PostPosted: Wed Jun 15, 2011 7:03 am    Post subject: Reply with quote

Just redirect the output to a log file instead of /dev/null, or else use the logging options in pyTivo.conf (more complicated).

Compiling tivodecode is very simple, IIRC; just the usual "./configure && make".

_________________
My pyTivo fork . My page
Back to top
View user's profile Send private message Visit poster's website
Iluvatar



Joined: 29 Feb 2008
Posts: 337

PostPosted: Wed Jun 15, 2011 1:23 pm    Post subject: Reply with quote

wmcbrine wrote:
Just redirect the output to a log file instead of /dev/null, or else use the logging options in pyTivo.conf (more complicated).

Compiling tivodecode is very simple, IIRC; just the usual "./configure && make".


That's great. Thanks.

tivodecode may be simple to compile by itself but the Synology devices do not come with development tools. So there are many steps to get it ready just for that simple tivodecode compile.
Back to top
View user's profile Send private message
jcthorne



Joined: 30 Jan 2008
Posts: 384
Location: Houston, TX

PostPosted: Wed Jun 15, 2011 1:38 pm    Post subject: Reply with quote

For Iluvatar's curiosity, I pulled a 1080p mp4 file to the tivo and let pytivo trans code it. Approx 15fps so still less than real time for HD transcode. Its actally faster than the same vid pulled from my old PentiumM (2.2Ghz single core) laptop running XP which did the pull at approx 12fps.

Pushing the video transfered at 80.64 Mb/s which is at least 10 faster than my laptop can push from a local drive. Much faster than from a usb drive.

OK, so I have the ability to run pyTivo in an SSH session window.

Then I tried using the command:

/opt/bin/python /usr/local/pyTivo/pyTivo.py > "/volume1/File Storage/temp/pyTivolog.txt"

It created the file and put nothing in it, rather all output went to the SSH session screen. I know its likely missing some syntax.

Using the scripts Iluvatar posted above and placing them as instructed, I restarted the DS. Using a brower I cannot see pyTivo. Not sure where to begin troubleshooting this. Pytivo works fine when I start it from the SSH session. A permissions issue? Is pyTivo.sh supposed to go in /usr/syno/ect/rc.d/ rather than /usr/local/ect/rc.d/ ? I placed it in both places to no avail.

I then created a copy of the simple start.sh called startpytio.sh and placed it in /usr/syno/etc/rc.d/ and on reboot pytivo started. Is anything wrong with just using the simple start.sh script in the rc.d directory?

One last thought on this, should I be using a text editor other than windows xp notepad? Or some format setting in notepad so the file is saved correctly for a linux script? Running my scripts from a command line using the sh xxx.sh, they run but generate some odd errors like extra lines, characters missing from commands etc.

On another note,

I downloaded the source code for tivodecode and tried using various forms of the make and configure commands. The DS reports: -ash: make: not found

Think I need a bit more help to be able to compile tivodecode. I don't use it all that often so no biggie.

I think I got HME for python installed. Based on what I have learned so far....it reports as running but I need to do some checking.

You guys can stop laughing at me now Embarassed
I do appreciate the help for what I know are very basic stuff. Its been 25 years since I regularly used a CLI and that was DOS.
Back to top
View user's profile Send private message
txporter



Joined: 11 Dec 2008
Posts: 265
Location: Austin, TX

PostPosted: Fri Jun 17, 2011 3:24 pm    Post subject: Reply with quote

When I installed pytivo on my Tonidoplug, I put the startup in /etc/init.d. Just followed what was in the wiki about init.d startup script from there. I think you might need to make sure that your shell script has the proper executable permissions as well. Just use chmod 755 <script>.

As for the log file, I think you might need to direct stderr as well as stdout to the file. That is the 2>&1 portion of the string you had above. Maybe pytivo displays all info on the stderr display since a lonely '>' will do stdout (I think this is the same as 1>). You might be able to get away with only a 2>.
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 337

PostPosted: Fri Jun 17, 2011 4:15 pm    Post subject: Reply with quote

jcthorne wrote:
For Iluvatar's curiosity, I pulled a 1080p mp4 file to the tivo and let pytivo trans code it. Approx 15fps so still less than real time for HD transcode. Its actally faster than the same vid pulled from my old PentiumM (2.2Ghz single core) laptop running XP which did the pull at approx 12fps.

Very usable. I suspect that you could improve upon that even more if you were to recompile ffmpeg for your CPU and use the right -threads command.

Quote:

OK, so I have the ability to run pyTivo in an SSH session window.

Then I tried using the command:

/opt/bin/python /usr/local/pyTivo/pyTivo.py > "/volume1/File Storage/temp/pyTivolog.txt"

It created the file and put nothing in it, rather all output went to the SSH session screen. I know its likely missing some syntax.


My guess is that you need the 2>&1 & portion of the command. Not really certain on this one.

Quote:

Using the scripts Iluvatar posted above and placing them as instructed, I restarted the DS. Using a brower I cannot see pyTivo. Not sure where to begin troubleshooting this. Pytivo works fine when I start it from the SSH session. A permissions issue? Is pyTivo.sh supposed to go in /usr/syno/ect/rc.d/ rather than /usr/local/ect/rc.d/ ? I placed it in both places to no avail.

You want to place it in /usr/local/etc/rc.d as this area should does not get overwritten when the Synology upgrades the firmware. /usr/syno/etc/rc.d gets erased upon a firmware update.

Quote:

I then created a copy of the simple start.sh called startpytio.sh and placed it in /usr/syno/etc/rc.d/ and on reboot pytivo started. Is anything wrong with just using the simple start.sh script in the rc.d directory?

Well it works and thats what matters but without the bash script the Synology will not be able to properly shutdown/restart/etc.. the pyTivo program. Make sure that the files are named properly and that you have used 'chmod 755' on each of the scripts.

Quote:

One last thought on this, should I be using a text editor other than windows xp notepad? Or some format setting in notepad so the file is saved correctly for a linux script? Running my scripts from a command line using the sh xxx.sh, they run but generate some odd errors like extra lines, characters missing from commands etc.

Yes that could be an issue. You can install a text editor on they Synology with the command 'ipkg install nano' and then call it with 'nano /usr/local/pyTivo/pyTivo.conf" for example if you wanted to edit that file. Please do a google on how to use it though...its not for the feint of heart.
Quote:

On another note,

I downloaded the source code for tivodecode and tried using various forms of the make and configure commands. The DS reports: -ash: make: not found

Think I need a bit more help to be able to compile tivodecode. I don't use it all that often so no biggie.


To compile programs there are other steps you need to take for the Synology. You do not have the proper tools by default. If you wish to do this let me know and I can write up instructions.

Good luck...hope you get it all working. Mine works like a charm. I have made the shares invisible to the actual TiVo's and use the push interface to send the files instead.
Back to top
View user's profile Send private message
jcthorne



Joined: 30 Jan 2008
Posts: 384
Location: Houston, TX

PostPosted: Sat Jun 18, 2011 12:17 pm    Post subject: Reply with quote

I finally got both pytivo and HME for python running on the Synology and starting from boot. As suggested, I'l move the start scripts from /usr/syno to usr/local to preserve them through a firmware update.

[quote="Iluvatar"][Yes that could be an issue. You can install a text editor on they Synology with the command 'ipkg install nano' and then call it with 'nano /usr/local/pyTivo/pyTivo.conf" for example if you wanted to edit that file. Please do a google on how to use it though...its not for the feint of heart.
[quote]

I found vi on the synology linux install, found an online help tutorial at the U of Hawaii of all places and was able to do what I needed.

Quote:


To compile programs there are other steps you need to take for the Synology. You do not have the proper tools by default. If you wish to do this let me know and I can write up instructions.

Good luck...hope you get it all working. Mine works like a charm. I have made the shares invisible to the actual TiVo's and use the push interface to send the files instead.


Being able to complile tivodecode and other items on the synology would be a logical next step along with intalling a java runtime and harmonium. Your assistance and pointers would be helpful. I have been reading over at the synology forums as well but they do not seem very active in the development areas.

Your last sentance is curious. Do you mean you have pytivo configured to push but NOT show up in the now playing list? I would like to do that, anything that I want from the tivo end, I use vidmgr to have pytivo push. Would like that menu option gone or at least no videos shown.

Thanks again for all your help. I could never have come this far without it.
Back to top
View user's profile Send private message
txporter



Joined: 11 Dec 2008
Posts: 265
Location: Austin, TX

PostPosted: Tue Jun 21, 2011 3:56 pm    Post subject: Reply with quote

jcthorne wrote:
I finally got both pytivo and HME for python running on the Synology and starting from boot. As suggested, I'l move the start scripts from /usr/syno to usr/local to preserve them through a firmware update.


How did you get HME for python to start at boot? I am having trouble doing that on my tonidoplug.
Back to top
View user's profile Send private message
jcthorne



Joined: 30 Jan 2008
Posts: 384
Location: Houston, TX

PostPosted: Wed Jun 22, 2011 12:08 pm    Post subject: Reply with quote

Using a startup script nearly identical to the one for pytivo, essentially just launching it from its home directory.
Back to top
View user's profile Send private message
Iluvatar



Joined: 29 Feb 2008
Posts: 337

PostPosted: Wed Jun 22, 2011 1:11 pm    Post subject: Reply with quote

does anyone know why we need to actually be inside the pyhme directory to open it for it to work correctly? I load pyTivo just fine by calling the full path but with pyhme it just decides not to work properly with a full path. I am trying to create a simple script on OSX to load pyhme on startup and I dont think I can use 'CD' in this method.

btw jcthorne I will post instructions for the syno dev tools later today.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Support All times are GMT
Goto page 1, 2, 3, 4, 5, 6, 7  Next
Page 1 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Site is in NO WAY affiliated with TiVo Inc

Powered by phpBB © 2001, 2005 phpBB Group
phpBB SEO

Get pytivo at SourceForge.net. Fast, secure and Free Open Source software downloads
[ Time: 0.1770s ][ Queries: 17 (0.0133s) ][ GZIP on - Debug on ]