- Python program to query and convert Tablo recordings




I’ve just run into a recorded program that is all there on the Tablo when viewed, but when pulled out, it is missing the last 5 minutes 30 seconds. Anyway to figure out what is happening?


In your surlatablo2.conf do you have the option truncate or truncate_ts set?


Ah, truncate_ts was left in at the default entry of ‘25’. My bad for not actually reading what everything was and just assuming default was what I wanted.

… re-processed the suspect recording and it all is good. I have been extremely lucky and never ran into this being a factor before. Thanks!


Generally speaking, for many, it’s considered a “good” option. However, it is an option and not enabled by default. Glad you found and fixed it.


I have found a couple of posts here relating to an encoding error when a dash \u2014 appears in the title of a TV Show or Movie. I am seeing this error on Version: 2.0b4 but only in a very strange situation… I have a bash script wrapped around my call to so that I can invoke it from crontab and process multiple shows every night. But to do so I need to redirect stdout. When I do this I get the following error when the file name contains a dash:

Traceback (most recent call last):
File “/media/e7473c2e-f87c-464b-84c3-7af310bac280/surlatablo/bin/”, line 3168, in
doConvert(sl, options, basedirs, filename_pats, transcoder_names)
File “/media/e7473c2e-f87c-464b-84c3-7af310bac280/surlatablo/bin/”, line 1718, in doConvert
print("{0:40s}".format(‘Working on:’) + ‘[’ + fq_filename + ‘]’)
UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u2014’ in position 80: ordinal not in range(128)

But when I run it without redirecting stdout it runs clean. Here is the RIP command that I am using:

./bin/ --noupdate --query $OBJECT_ID --convert --ccaption

OBJECT_ID is one line in a list that I get via the following command:

bin/ -q ‘.’ | grep ^" | cut -d’"’ -f2`

Anyone have any idea why redirecting stdout would have such an effect?


Capt’n George


Python has a lot of evil inside. Thus, there is a huge difference between python to the screen vs. to a file. And neither is flexible. I’ll dig into this a bit tonight and let you know.

Is python a great language? No. Despite its rabid fan club.


Oh, and you need to be running 2.0. That might actually fix things. The betas are just that. The “b” meaning beta. I’ll admit, it probably isn’t clear. I may pull the betas into a subdir…


Oh, and have you considered: --noupdate --query . --queryformat '${rec_id}'

or you could just use one step… --noupdate --query . --convert --ccaption

(perhaps you’re trying to introduce parallelism? You could severely hammer your Tablo btw… but it is something I’ve considered)

By default it won’t overwrite existing files. You could do a DeleteX (+DeleteX to add as transcoder), but it runs independent, so if things don’t go right, it will delete your show :slight_smile:

Yes… I need to get to work on 3.0, it will be different.


One more, if the idea is to pull shows strictly by rec_id, you should use --rec_id (e.g. --rec_id ${OBJECTID}) instead of --query.


A ton of good suggestions here that I will implement into my script as time permits so thanks for the information. I’ll also see about “downgrading” to 2.0 and let you know if that helps. Just FYI, the main reason for running this from a script is that I append the “object ID” to the file name after a successful rip to ensure uniqueness. I have in the past recorded some 2 part shows with the exact same name for both parts and have missed the second half of the show. I also check the return code from the rip before running the deleteX as a separate command. If anyone is interested I can post the script here. Just let me know.


You might want to add:

    'TV':'${Eseries} - s${plex_season_number}e${plex_episode_number} - ${Etitle}-${rec_id}',
    'Sports':'${sport_type} - s${plex_season_number}e${plex_episode_number} - ${Etitle}-${rec_id}',
    'Movie':'${Etitle} (${release_year})-${rec_id}'

to your surlatablo2.conf. To always put the rec_id in the output filenames.

You can also do something like this on demand using the -f option.


I tried to make surlatablo flexible to prevent tossing the “scripting ball” to the Windows folks.


I don’t have a surlatablo2.conf file yet. I see it referenced in the python script as ~/surlatablo2.conf
Assuming I’m running my script from cron as root the file should be in /root/ rather than the directory where bin/ is located correct?



By default, it means it’s looking for the file in the home directory of the user running it (so, yes).


@cjcox, quick question for you.

Since the latest updates from Tablo and Plex all of my shows that I extract using SurLaTablo are truncated by about 5-7 mins. Normally Tablo records 5 mins past the end of the show, so a 30min episode of Jeopardy would be 35mins. For a little while now the shows are showing up in Plex as 28mins. When I play the episode via VLC through a CIFS share the episode shows the full duration. Content that I download shows normally and plays normally. This only seems to be content extracted from Tablo to my Plex media server.

Any thoughts?


@Spunky03 I had the same issue 18 days ago. It was due to truncate_ts being set in the conf.


Thanks for the reply @Arkitct

After reading up in the thread to your other post I see. I to have the default setting of 25 but again it’s never affected anything before. Did you just remove it or change the value?


@Spunky03 I removed the entire line rather than commenting it out. If you want to have it for reference in the future, you may chose to comment it out (inserting a # at beginning of line).


@Arkitct, thanks!

I was just curious how you addressed it. Also kinda curious what it does. I’m trying to find documentation about it but can’t seem to find anything. I assume it truncates the ts file obtained from Tablo to 25mins but that’s a guess. Where did you find it documented?