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

Documentation in two places: https://endlessnow.com/ten/SurLaTablo/CHANGELOG

And that same CHANGELOG is stored in comment form inside the program itself.

@cjcox, thanks for chiming in.

Just checked the docs and program.

Can’t find any mention of “transcode_ts” at all.

Not trying to be a jerk or anything just trying to understand so appreciate the help!

truncate_ts

Specifically from the CHANGELOG:

1.1 -

  1. Added options[‘truncate_ts’]. This is better for -z than using truncate. A
    value of options[‘truncate_ts’] = 75 should clip off about 5 min. off the original
    ts from the Tablo, and commercial processing will come after that.

1.0 -

  1. Added options[‘truncate’] to allow clipping off some seconds from end
    of show. Many people might set options[‘truncate’] = 300 in their
    surlatablo.conf file (truncate last 5 minutes).

Just wanted to let you know that I finally had a chance to “downgrade” to the non beta version (2.0) and still have the “Unicode” problem when redirecting the output of surlatablo.py to a file:

===============================================================

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

===============================================================

The particular title is:

Young Sheldon - s01e08 - Cape Canaveral, Schr\u00f6dinger’s Cat, and Cyndi Lauper’s Hair

And the offending Unicode character is an umlauted O.

Again it works just fine if I allow the output to go back to the shell without redirecting.

George

Thanks, I’ll look into this. I you could private message me the json line from the surlatablo db (does that make sense, or do you need more?) for the show in question, that way I can replicate this problem exactly. Don’t worry if this doesn’t make sense, I’ll figure it out anyhow.

:slight_smile: check your spelling, it’s truncate_ts not transcode_ts

Ugh…

Dam cut and paste from another project…

Spunky hangs his head in shame. Let the flames begin.

SurLaTablo 2.1

2.1 - Fix for filename print output when redirected to convert to utf-8. This is just for hosts (not Windows) that handle utf-8 filenames.

Chris,
2.1 seemed to have fixed the issues I was having with recording names until just a few days ago. This time the delete function in SurLaTablo is failing:

surlatablo/bin/surlatablo.py -q 92476 -c DeleteX

Trying to remove /recordings/series/episodes/92476
REMOVED:{
REMOVED: “air_date”: “2018-01-30T09:00Z”,
REMOVED: “air_date_day”: “30”,
REMOVED: “air_date_hour”: “09”,
REMOVED: “air_date_minute”: “00”,
REMOVED: “air_date_month”: “01”,
REMOVED: “air_date_string”: “2018-01-30 09:00”,
REMOVED: “air_date_year”: “2018”,
REMOVED: “air_date_year_day”: “030”,
REMOVED: “cast_”: “Craig Sechler”,
REMOVED: “channel_affiliate”: “PBS”,
REMOVED: “channel_num”: “13.1”,
REMOVED: “channel_res_height”: “1080”,
REMOVED: “channel_res_name”: “1080i”,
REMOVED: “channel_res_width”: “1920”,
REMOVED: “channel_resolution”: “hd_1080”,
REMOVED: “channel_sign”: “KERA-HD”,
REMOVED: “description”: “How the ancient people of Petra built their city of stone.”,
REMOVED: “episode_number”: 5,
REMOVED: “friendly_title”: “NOVA - s42e05 - Petra \u2014 Lost City of Stone”,
REMOVED: “genres_”: “”,
REMOVED: “lair_date”: “2018-01-30T03:00-0600”,
REMOVED: “lair_date_day”: “30”,
REMOVED: “lair_date_hour”: “03”,
REMOVED: “lair_date_minute”: “00”,
REMOVED: “lair_date_month”: “01”,
REMOVED: “lair_date_string”: “2018-01-30 03:00”,
REMOVED: “lair_date_tz”: “US/Central”,
REMOVED: “lair_date_year”: “2018”,
REMOVED: “lair_date_year_day”: “030”,
REMOVED: “lang”: “en”,
REMOVED: “long_description”: “How the ancient people of Petra built their city of stone.”,
REMOVED: “meta_type”: “TV”,
REMOVED: “original_air_date”: “1900-01-01”,
REMOVED: “original_air_date_day”: “01”,
REMOVED: “original_air_date_month”: “01”,
REMOVED: “original_air_date_year”: “1900”,
REMOVED: “path”: “/recordings/series/episodes/92476”,
REMOVED: “qualifiers_”: “cc”,
REMOVED: “rec_id”: 92476,
REMOVED: “season_number”: 42,
REMOVED: “season_path”: “/recordings/series/seasons/79392”,
REMOVED: “series”: “NOVA”,
REMOVED: “series_path”: “/recordings/series/67852”,
REMOVED: “sort_title”: “Petra \u2014 Lost City of Stone”,
REMOVED: “tablo_ip”: “192.168.1.65”,
REMOVED: “title”: “Petra \u2014 Lost City of Stone”,
REMOVED: “tms_id”: “EP000031630697”,
REMOVED: “video_duration”: 3922,
REMOVED: “video_durationh”: “1:05:22”,
REMOVED: “video_height”: 720,
REMOVED: “video_offsetend”: 304,
REMOVED: “video_offsetstart”: -15,
REMOVED: “video_size”: 1619566592,
REMOVED: “video_sizeh”: “1.5GiB”,
REMOVED: “video_state”: “finished”,
REMOVED: “video_width”: 1280
REMOVED:}
Working on: [./TV/NOVA/Season 42/NOVA - s42e05 - Petra — Lost City of Stone.92476]
Executing (deleteResource, .always)
Deleting [NOVA - s42e05 - Petra — Lost City of Stone]
Cannot find allowed function [deleteResource]
Skipping…

Other (possibly useful) information:
There is an “EM DASH” (/2014 HEX 0xE2 0x80 0x94) character in the name between the words Petra and Lost. Of course it is possible that this has nothing to do with UTF-8 / UniCode…

You’re not by any chance supplanting the whole transcoder array in your surlatablo2.conf file are you? If so, I can probably help you figure out the right way to do what you’re wanting to do.

I am not. The only thing in my conf file is:

FILENAME_PATS={‘Default’:’${Etitle}-${rec_id}’,
‘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}’

As I want to add rec_id to the saved file name.

In this particular case I am trying to delete the NOVA show by its record ID (92476). And in fact this is how I delete all recordings from the Tablo after they have been ripped to my Linux box. For some odd reason this particular show is failing to be deleted.

George

I will look into this tonight. Thanks for the report.

The error received is what you’d get if you tried to delete an entry that has already been deleted. That’s my best guess as to what has happened here.

Ran across a recording that does not get processed -
cmd:

python surlatablo.py -q ‘Formula*’ -c Mp4

output:

## (357803) Canadian Grand Prix ##
Sunday, June 10, 2018 at 12:30 PM
KOCO-HD(ABC) - 1080i [3:45:20]
${genres}

Description:
Formula 1 Racing - Canadian Grand Prix
Traceback (most recent call last):
  File "surlatablo.py", line 3264, in <module>
    doConvert(sl, options, basedirs, filename_pats, transcoder_names)
  File "surlatablo.py", line 1632, in doConvert
    db_rec['plex_season_number'] = '{0:02d}'.format(season_number)
ValueError: Unknown format code 'd' for object of type 'unicode'

Is their a workaround for this? Thanks!

Got to your surlatablo.py file and edit it. On line 1632 replace the two db_rec assignments for plex_season_number and plex_episode_number with:

    try:
        db_rec['plex_season_number'] = '{0:02d}'.format(season_number)
    except:
        db_rec['plex_season_number'] = '00'
    try:
        db_rec['plex_episode_number'] = '{0:02d}'.format(episode_number)
    except:
        db_rec['plex_episode_number'] = '00'

See if that works around the problem. The root cause is bad metadata. But that happens sometimes from the guide provider.

SurLaTablo 2.2

2.2 - Fix for redundant entries in cache dbs when you have more than one Tablo. Remove your SURLATABLO_ROOT cache directories and reprocess (run surlatablo.py) your Tablos.

This is a major (but simple) fix if you have more than one Tablo device. You will need to remove your cache db’s under your SURLATABLO_ROOT directory and regen the cache dbs with a full run of surlatablo.py.

That worked, thanks!

Thanks, I"ll work that into the next release.

I must be slow, but I’m just not getting how to use the meta types. The example I’ve been trying to figure out is simply to get all of a specific season of a specific series. For example, Alfred Hitchcock Presents, season 3. I’ve tried every permutation I can think of but I can’t get a combination of the series meta type and season_number type to produce anything but an error. Usually that it couldn’t find the transcoder after the name of the last thing I put on the command line.

surlatablo.py -q 'Alfred Hitchcock Presents - s03'