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

Hi,

Maybe a logic bug in version .3. If a title contains a character not allowed in a file name then Windows does not save the file. It downloads every time I use the -q “.” -c command.
The character in this case is the ?. Apparently Windows does not like the following characters. \/:*?"<>|
Not sure if they should be deleted or escaped.

Thanks,
Tom

[ ./TV/F Troop/Season 2/F Troop - s02e09 - Did Your Father Come From Ireland?.mp4 ]
[ http://192.168.1.88:18080/pvr/8893/segs -> c:\users\tom\appdata\local\temp\Tablo8mwqgr.ts]
[‘ffmpeg.exe’, ‘-i’, ‘c:\\users\\tom\\appdata\\local\\temp\\Tablo8mwqgr.ts’, ‘-bsf:a’, ‘aac_adtstoasc’, ‘-c:v’, ‘copy’, ‘-c:a’, ‘copy’, ‘-metadata:s:a:0’, ‘language=eng’, ‘-metadata’, ‘title=Did Your Father Come From Ireland?’, ‘-metadata’, ‘date=1966-11-03’, ‘-metadata’, ‘network=MeTV’, ‘-metadata’, ‘album=F Troop’, ‘-metadata’, ‘show=F Troop’, ‘-metadata’, ‘genre=Sitcom’, ‘-metadata’, ‘episode_id=s02e09’, ‘-metadata’, “synopsis=O’Rourke’s devilish father arrives from Ireland while the sergeant is on vacation.”, ‘-metadata’, “description=O’Rourke’s devilish father arrives from Ireland while the sergeant is on vacation.”, ‘-metadata’, “comment=O’Rourke’s devilish father arrives from Ireland while the sergeant is on vacation.”, ‘./TV/F Troop/Season 2/F Troop - s02e09 - Did Your Father Come From Ireland?.mp4’]

It is one of the fixes in .4

Thanks. I should have taken your advice and waited but wanted to test the wildcard which works great. Looking forward to .4.


Tom

Dunno where he finds the time to do that and test it, etc. Just figuring out how to access the data inside Tablo had to have taken a few minutes at least  ;-)


At some point I’ll be using perhaps this script to grab all of the westerns my wife records and put them on a drive and organize them for her. 

I use his python script to backup files from my Tablo to my Windows Plex server. It also runs my security cameras recording 24/7 (Blue Iris). Works great.


Tom

SurLaTablo 0.4 is here!

SurLaTablo



0.4 -
   1. You may now have a SLT_GLOBAL[‘CONF’] file (defaults to homedir
      surlatablo.conf) which can be used to override the configuration variables.
      This way you won’t have to keep editing the source file for local site
      changes.
   2. TV shows with season 0 and episode 0 (e.g. News) will now default
      to s<lair_date_month>e<lair_date_day> and Unknown titles will default
      to Episode - <lair_date_year>-<lair_date_month>-<lair_date_day>.  You can
      disable this by setting NOZERTV = False in your .conf file (see #1).
      original_air_date cannot be used for this because quite often it is wrong.
   3. Pathnames for output files are now santized for Windows.
   4. surlatablo.py now takes arugments beyond switches which are to specify
      the transcodes to do on the downloaded data.  Default if not present is
      just Mp4.  You can override the default by setting in you .conf file:
       TRANSCODER_DEFAULT = [ ‘Mp4’, ‘Gif’, etc. ]
      You can specify on the command like:
       surlatablo.py … Mp4 Gif Json
      or
       surlatablo.py … +Gif +Json
      The ‘+’ means in addition to the TRANSCODER_DEFAULT values.
      Use ‘-t’ option to see brief description of available transcoders.
   5. Options --wcrop (-w) and --cropformat (-W) have been removed.  Create and
      use a new TRANSCODER_OPTS definition for this.
   6. You can now use --keepdir @ to say you want to save the .ts and .srt file
      in the output directory with the other files.
   7. New predefined TRANSCODER_OPTS have been added, created. (see -t option)
        a. Mp4 - (the norm) to create a passthrough .mp4
        b. Gif - create short duration animated gif
        c. Flash - create an .flv
        d. HardSubs - (assumes use of -C) to embed subitles directly in .mp4
        e. Shrink - create a more compressed .mp4
        f. Json - create .json file containing SurLaTablo meta information for program
        g. Null - used mainly to say “no transcode”, for times when you want to use
            --keepdir @ to output and save just the .ts and (optionally) .srt
        h. … (more)
   8. Replace sanitizeFilename with sltSanitize for dynamic meta type strings
      like Etitle, ESeries, essentially things that could be used in path and filenames.
      Special dynamic variable Efriendly_title2 is a two line escaped string for
      internal ffmpeg option use (see Gif).
   9. Bug fixes… etc…

Crashed. Hope it’s something simple. Windows 8.1. I ran the update again on version 3 (different cache db location) and it ran perfectly.


Thanks,
Tom


Traceback (most recent call last):
  File “D:\Plex\tablo4.py”, line 2139, in
    doConvert(db_recs[rec_id], options, basedirs, filename_pats, transcoder_name
s)
  File “D:\Plex\tablo4.py”, line 1030, in doConvert
    db_rec[‘Eseries’] = sltSanitize(db_rec[‘series’])
KeyError: ‘series’

I’ll take a look at this tonight.  There could a 0.5 in the near future!

As a quick workaround, the Eseries assignment should have a try/pass around it.  So go to line 1030 and change that assignment to:

try:<br>    db_rec['Eseries'] = sltSanitize(db_rec['series'])<br>except:<br>    pass

Will test in about 7 hours when I get home.


Thanks,
Tom

0.5 released to fix my one and only bug :slight_smile:

@cjcox that sounds like a challenge :smiley:

Actually, I kinda warned that there might be problems in 0.4… but I wasn’t expecting one so obvious.

0.5 released to fix my one and only bug :)

Obviously an ex-Microsoft employee! Just kidding, not intended as an insult, kidding!

Of course, if I were a current Microsoft employee, the program would be binary only, unmodifiable, and work only on Windows 10 (forcing you to purchase the upgrade).  If I were an ex-Microsoft employee, I would be too busy with my therapy sessions to write free software.

@cjcox that is priceless.

Version .5 seems to be working perfectly in my limited testing ( -q "." -c). No crashes. I did update the pgm_version variable to 0.5 in the python code while I was configuring it for my system.

Thanks,
Tom


I’ll live fix that mistake… oopsie!

Preview, version 0.6 will eliminate CCOFFSET handling it will move to options and the offset will be applied for “Live” shows.  Thanks to @pundit for helping out with Live designation.  Oh… and that’s a meta data addition, so requires cache rebuild… but 0.6 isn’t out yet :slight_smile:

Of course, if I were a current Microsoft employee, the program would be binary only, unmodifiable, and work only on Windows 10 (forcing you to purchase the upgrade).  If I were an ex-Microsoft employee, I would be too busy with my therapy sessions to write free software.

LOVE IT!
Don’t forget that you’d waste half the code embedding fun easter eggs…