SurLaTablo.py - Python program to query and convert Tablo recordings

I was instantly reminded of 1988’s Sur la Mer (the last full album to officially include Moraz) when I saw the thread.


I may give Python a shot - glad I checked back to see which version you wrote and tested under. Not sure if the 3.xxx would play well with it or not. Since I don’t really use it otherwise it didn’t matter to me which, I was merely making sure YOUR script would work well.

Me, I’m an old-skool CMD and VBS person - with limited abilities there, however.

@cjcox I am interested in trying this. I would like to convert some shows to be played on the Plex server, but there’s a lot of stuff I’m not familiar with. I’m not sure what to paste in terminal. What steps to do first do I need to manually create a temporary database folder? Then search for a show? Then run something else to convert it? Just worried about screwing something up. Thanks

Install python. Install pip for python. Pip install pytz… unfortunately, those are the hard things… I may have to write a doc, but feel free to google…

Then you download the surlatablo file from the link in the first post.  It’s named as a .txt file to make sure it can be easily obtained.  But once you get it, you will want to rename it to surlatablo.py.

One of the first things you can do is run:  surlatablo.py --help

It’s a large help output, you need to pay particular attention the very first part which tells you the few things you need to change at the top of the surlatablo.py file.  In particular:

    # Location of your ffmpeg program (optional if you won’t ever convert to mp4)
    FFMPEG = ‘/usr/bin/ffmpeg’

    # Location of your ccextractor program (optional)
    CCEXTRACTOR = ‘/usr/local/bin/ccextractor’

    # Location directory where meta db caches go
    SURLATABLO_ROOT = ‘/SurLaTablo’

    # List of your Tablo IPs, this program does not auto detect today
    TABLO_IPS = [‘192.168.1.73’]


Then I sort of hope from the help doc you get the idea that you need to build your local cache first.   This is what makes searches fast because querying the Tablo device is hard, slow and not well suited currently for searching.  By default, whenever you run surlatablo.py (unless you supply -n or --noupdate), it will update the cache so that it is insync with the data currently on your device.

I’m going to stop here… and see if you able to make it this far.

Just fyi, the update 0.2 (probably tonight) will:

Allow
\t,etc. style escapes in --queryformat (aka -Q).  It will also print a friendly message instead of an error and stack trace when it cannot create the SURLATABLO_ROOT directory.  It also allows you to use --queryformat (-Q) to do output along with using the --convert (aka -c) option.  There will be a new piece of metadata (which means you may want remove and regen your caches) that will add metatype called ‘friendly_title’, which looks much like the default patterns used for file creation, it’s actually the names you see output when it’s doing a cache update.  Why?

Well, the friendly_name for TV shows looks like a Plex name… so you get something like:

Green Acres - s01e02 - Lisa’s First Day on the Farm

The advantage is that you can do an easier query for shows by season:

surlatablo.py -n -q friendly_title~=‘Green Acres - s01’

(which will return all of Season 1)

surlatablo.py -n -q friendly_title~=‘Green Acres - s01e02’

(which returns Season 1, Episode 2)

Okay I downloaded the FFMPG, CCEXTRACTOR, Python, downloaded the surlatablo.py changed the location for the FFMPG, CCEXTRACTOR, changed the IP address for tablo and set location to eastern. I think I have installed PIP.

This is what I have so far.

Mac-French:~ macfrench$ sudo easy_install pip
Password:
Searching for pip
Best match: pip 1.5.6
Adding pip 1.5.6 to easy-install.pth file
Installing pip script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing pip3.4 script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Installing pip3 script to /Library/Frameworks/Python.framework/Versions/2.7/bin

Using /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
Mac-French:~ macfrench$ python /Users/macfrench/desktop/surlatablo.py
File “/Users/macfrench/desktop/surlatablo.py”, line 1
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
^
SyntaxError: unexpected character after line continuation character
Mac-French:~ macfrench$ surlatablo.py
-bash: surlatablo.py: command not found
Mac-French:~ macfrench$ easy_install --upgrade pytz
Searching for pytz
Reading https://pypi.python.org/simple/pytz/
Best match: pytz 2014.10
Downloading https://pypi.python.org/packages/2.7/p/pytz/pytz-2014.10-py2.7.egg#md5=a6e26cf01e307d3505612d7386fee859
Processing pytz-2014.10-py2.7.egg
Moving pytz-2014.10-py2.7.egg to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Adding pytz 2014.10 to easy-install.pth file

Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pytz-2014.10-py2.7.egg
Processing dependencies for pytz
Finished processing dependencies for pytz
Mac-French:~ macfrench$ python /Users/macfrench/desktop/surlatablo.py
File “/Users/macfrench/desktop/surlatablo.py”, line 1
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
^
SyntaxError: unexpected character after line continuation character
Mac-French:~ macfrench$

:slight_smile:

Switch your backslashes to forward slashes.

I have not tested on OSX.

I’ve got to get python installed on my Windows 7 machines and give this a shot. I know it’s going to be a whole lot different, though because the screenshots won’t even be close at all…

CMD window in Windows is a different animal and you DO use backslash for directories in Windows.

Just in case you’ve forgotten - >


@ShadowsPapa, just use the forward slashes… trust me.

However, the user in question was using OSX… but in any case…

Because it’s in the python environment or shell and not the command.com of Windows, right? More like managing FTP than Windoze.


OK, this is what I am looking for - and you may have the most simple solution at the moment:

I have no plex server (not saying never will, saying I don’t have now or near future.
I have multiple computers, a lot of decent storage, small or tiny compared to many folks here, but enough for me. 
I have a desktop, 64bit with 6 core processor, 10 gig ram and 1.5T drive for one system.
That’s likely where I’d handle conversions or imports or whatever. It’s connected through a Cisco switch to my router and the Tablo is connected via Ethernet cable to my router. So PC to switch, switch to router, router to tablo.
I run as of now Windows 7 64

I understand I need Python 2 series, I grabbed the 2.7.9 msi installer (Windows of course)
I need pip? I assume not one of Gladys Knight’s guys… but some other pip.
What else, if anything?

Ah, some say pip is part of 2.7.9 which is what I downloaded…

uh… I know I had some variant of 2.7 on my windows test host and I had to get pip…

pytz is the magic that gives me local datetimes…  I don’t want to include it, IMHO, Python (even 2.7) should have included it.

pip is just an easy way to pull in Python modules.  You can add them manually, but only if you know how to do that.

I just went to python.org and checked out about pip. Here is what I found out.


I hope this works. I highlighted the pertinent information in red.

Python 2.7.9

Release Date: 2014-12-10

Python 2.7.9 is a bugfix version for the Python 2.7 release series. Python 2.7.9 includes several significant changes unprecedented in a “bugfix” release:

  • The entirety of Python 3.4’s ssl module has been backported for Python 2.7.9. See PEP 466 for justification.
  • HTTPS certificate validation using the system’s certificate store is now enabled by default. See PEP 476 for details.
  • SSLv3 has been disabled by default in httplib and its reverse dependencies due to the POODLE attack.
  • The ensurepip module module has been backported, which provides the pip package manager in every Python 2.7 installation. See PEP 477.

The backslashes were returned with the error. I’m not sure where they’re coming from not something that I entered.

From stackoverflow -



672down voteaccepted

Python 2.7.9+ and 3.4+

Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released December 2014) ship with Pip. This is the best feature of any Python release. It makes the community’s wealth of libraries accessible to everyone. Newbies are no longer excluded from using community libraries by the prohibitive difficulty of setup. In shipping with a package manager, Python joins Ruby, Nodejs, Haskell, Perl, Go–almost every other contemporary language with a majority open-source community. Thank you Python.

Of course, that doesn’t mean Python packaging is problem solved. The experience remains frustrating. I discuss this at Does python have a package/module management system?

And, alas for everyone using Python 2.7.8 or earlier (a sizable portion of the community). There’s no plan to ship Pip to you. Manual instructions follow.

@ShadowsPapa, good to know.  Pip is a nice tool.

@mb190e, I think something is wrong with the surlatablo file you downloaded.  It’s erroring on the first line… I think the file is corrupted.  It’s just a plain text file, should be able to browse to it and save as and then rename it.  Bring it up in and editor and you can verify that… but dont’ use a non-text editor (which is what you may have done??) because it might save it as something other than text.

LOL - don’t use notepad  ;-)

It can append stuff you don’t expect. 

I use Qwined and have not been let down.

I hope to try your little script tonight or tomorrow. Won’t my wife be thrilled if I can save a whole season of her favorite westerns and then use Windoze to burn them to DVD. 
She’ll give you and the Tablo support folks a hug if that ever becomes possible.
About the time they integrate a “file save” or export feature you’ll have her respect forever.
I had to buy a spool of DVDs a few years back so I could record every episode of Daniel Boone this oldies station played for a few months. Recorded them to DVD using our DVR/DVD recorder. 

Looks like this is possible with Tablo with just a little extra effort and maybe in the future, a native part of the system. 
Either way, I’m extremely hopeful seeing what a couple of the Tablo mega-power users have done here. 
It just doesn’t get much better.

@ShadowsPapa, I will have the new version up in about 5 hours or so… it will make doing whole TV seasons a lot easier (until I can enhance the query mechanism to do and/or, etc.)