Running pyTivo on a QNAP

Discussion in 'Developers Corner' started by hmspain, Nov 9, 2017.

Tags:
  1. Nov 9, 2017 #1 of 40
    hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    Executing pyTivo.py using "python pyTivo.py", I'm getting:

    [/share/pyTivo] # Traceback (most recent call last):
    File "/share/pyTivo/pyTivo.py", line 21, in <module>
    import httpserver
    File "/share/CACHEDEV1_DATA/pyTivo/httpserver.py", line 16, in <module>
    from Cheetah.Template import Template
    File "/share/CACHEDEV1_DATA/pyTivo/Cheetah/Template.py", line 23, in <module>
    import new # used to bind methods and create dummy modules
    ImportError: No module named new

    [/share/pyTivo] #

    I'm running Python 2.7.12.1. Perhaps a Python update broke things, dunno. I would really appreciate being pointed in the right direction. It appears to get stuck at line 21 trying to import the httpserver?

    I can run pyTivo on a RPi, but then I have to SAMBA the /movies share, and performance is terrible :).
     
  2. Nov 9, 2017 #2 of 40
    Allanon

    Allanon Active Member

    890
    142
    Nov 2, 2005
    Are you sure you're using Python version 2.7? The problem you are having is the new module is missing, it was depreciated in version 2.6 but still present in version 2.7 but was removed from version 3. The module is a built in module that should be present when Python 2.7 is installed.
     
    Last edited: Nov 9, 2017
  3. Nov 9, 2017 #3 of 40
    hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    My QNAP supports both 2.7.12.1 and 3.5.2.0. I think I had both installed (strange as that sounds). Right now, I have only the 2.7.12.1 installed.
     
  4. Nov 9, 2017 #4 of 40
    Allanon

    Allanon Active Member

    890
    142
    Nov 2, 2005
    Might check if your Python paths are correct.
     
  5. Nov 9, 2017 #5 of 40
    hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    Excellent thought; let me check.

    Env|grep -i py

    Returns blank???

    The top of my pyTivo.py file is:

    #!/usr/bin/env python

    Checking to see if it exists, or is the wrong version perhaps?

    /usr/bin/env python

    Returns Python 2.7.5 (default, Sep 1 2017, 02:44:59)
    [GCC 4.9.2] on linux2
     
  6. Nov 9, 2017 #6 of 40
    hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    echo $PYTHONPATH

    Returns blank...

    Hmmm.

    It appears I have a few symbolic links in /usr/local/bin

    python pointing to /mnt/etc/opt/Python/bin/python
    python2 pointing to /mnt/etc/opt/Python/bin/python
    python2.7 pointing to /mnt/ext/opt/Python/bin/python2.7
     
    Last edited: Nov 9, 2017
  7. Nov 9, 2017 #7 of 40
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    50,285
    5,776
    Apr 17, 2000
    Nevada
    Even if you can get this to run pyTivo requires an executable of ffmpeg to remux/recode as needed. Even if you only intend to use it to serve .tivo files, which don't need any processing, it still requires ffmpeg as it uses it as part of the server routine to determine if a file, even a .tivo file, is compatible with the TiVo you're sending it too. Not sure you'll have much luck finding a version of ffmpeg built for the chip in your Qnap.
     
  8. Nov 9, 2017 #8 of 40
    hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    It’s been running (for more than a year) just fine. I did a reboot last night, and ever since... well. I think I had everything configured OK, I’m just chasing what has changed.

    I have to suspect some update, perhaps to Python.

    My QNAP is a fairly high end running a quad-core Intel Core i7-4790S 3.2 Ghz (Turbo boost to 4 GHz) processor.

    The reasons for continuing to fight this one:

    1) I tried running on a RPi using Samba to mount the QNAP share, and the performance was poor and spotty (as I recall).

    2) Running pyTivo on the same system that hosts the VOB files (for my Tivo) just kinda makes sense to me.

    3) It has been running forever, so I know (at least I think I know) it should work...
     
    Last edited: Nov 9, 2017
  9. Nov 9, 2017 #9 of 40
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    50,285
    5,776
    Apr 17, 2000
    Nevada
    Interesting. Did you find a build of ffmpeg that runs on the Qnap? Do you have one of the really high end Qnaps that have the Intel processor?
     
  10. hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    Doing a quick reboot for the latest firmware. A reboot broke it, perhaps another will fix it LOL.
     
  11. hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    My QNAP is a fairly high end running a quad-core Intel Core i7-4790S 3.2 Ghz (Turbo boost to 4 GHz) processor.
     
  12. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    50,285
    5,776
    Apr 17, 2000
    Nevada
    That makes sense then. I have one, but it's one of the cheaper ARM ones. I tried running Plex on it once and it couldn't do anything because it couldn't transcode.
     
  13. hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    The ffmpeg running on my QNAP is in;

    /mnt/ext/opt/medialibrary/bin/ffmpeg

    I don't recall where I found it, sorry!

    [/share/pyTivo] # /mnt/ext/opt/medialibrary/bin/ffmpeg
    ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
    built with gcc 4.9.2 (Debian 4.9.2-10)
    configuration: --enable-cross-compile --arch=i686 --target-os=linux --disable-yasm --disable-static --enable-shared --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libvo-aacenc --enable-libsoxr --enable-version3 --enable-nonfree --disable-decoder=ac3 --disable-decoder=ac3_fixed --disable-decoder=eac3 --disable-decoder=dca --disable-decoder=truehd --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-encoder=dca --extra-ldflags='-L/root/daily_build/64_23/4.3.3/Model/TS-X71/build/RootFS/usr/local/medialibrary/lib -Wl,--rpath -Wl,/usr/local/medialibrary/lib' --extra-cflags='-I/root/daily_build/64_23/4.3.3/Model/TS-X71/build/RootFS/usr/local/medialibrary/include -D_GNU_SOURCE -DQNAP' --prefix=/root/daily_build/64_23/4.3.3/Model/TS-X71/build/RootFS/usr/local/medialibrary
    libavutil 54. 31.100 / 54. 31.100
    libavcodec 56. 60.100 / 56. 60.100
    libavformat 56. 40.101 / 56. 40.101
    libavdevice 56. 4.100 / 56. 4.100
    libavfilter 5. 40.101 / 5. 40.101
    libswscale 3. 1.101 / 3. 1.101
    libswresample 1. 2.101 / 1. 2.101
    libpostproc 53. 3.100 / 53. 3.100
    Hyper fast Audio and Video encoder
    usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

    Use -h to get full help or, even better, run 'man ffmpeg'
    [/share/pyTivo] #
     
  14. hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    The reboot didn't fix pyTivo BTW :).
     
  15. hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    Is it possible that Python 2.7.12.1 broke something? Perhaps I can roll back.

    Can pyTivo use Python V3.5.2.0?
     
  16. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    50,285
    5,776
    Apr 17, 2000
    Nevada
    There is a user on this forum who branched pyTivo and upgraded it to run in python 3.x. I can't remember who it was though
     
  17. hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    The best experts say to stick with Python V2. Trying to fix this, I reset my QNAP, and I’m restoring the applications one by one. No luck so far.

    It keeps looking for an oddly named module “new”. It is supposed to be in 2.6 (which I tried by downgrading Python) and it should be in 2.7 which I’m running now.

    I’m quickly running out of things to try other than breaking out my old RPi and getting Samba back online...
     
  18. wmcbrine

    wmcbrine Well-Known Mumbler

    11,624
    774
    Aug 2, 2003
    Actually, pyTivo can run without FFmpeg. In that case, it falls back on the filename extensions to decide if files are compatible.

    And yes, there are FFmpeg builds for ARM. My NAS even came with one (actually avconv), although it's limited in functionality.
     
  19. hmspain

    hmspain Member

    49
    3
    Oct 11, 2015
    Thank you Dan203! I’m still fighting the good fight on my QNAP trying to get pyTivo back online. It seems to be struggling with the module “new” even though by all appearances, I’m running Python V2.7. Even the pyTivo.py code checks the Python version!

    But it says it can’t find a module “new”. The module “new” was replaced by the “types” module in V3, so I made a backup and commented out the “new” module and added a “types” module.

    It is getting farther, but still complaining about the “new” module inb other parts of the pyTivo code. I think I made a mistake of using a QNAP app packed up by someone... the files are still in there and being used even though the pyTivo I’m running is in a /share/pyTivo directory.
     
  20. wmcbrine

    wmcbrine Well-Known Mumbler

    11,624
    774
    Aug 2, 2003
    Um...
    Not that this is your issue.

    There are several problems due to the Cheetah library, which is really overkill for how it's used in pyTivo. But, refactoring it out would be a big project.
     

Share This Page