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

Thanks for your hard work cjcox. It is appreciated..

+1 (or 7 if my wife and 5 cats can vote)

I understand expensive, but on a computer screen 640 x 480 is so, well, CGA  ;-)
I run that when in Windows “safe mode” (honestly, though, no mode is SAFE but that’s what they call it)
I have a pretty potent notebook (i7 quad, 6 gig RAM but I am looking at bumping that up if possible) and my desktop is a 6 core AMD processor, 10 Gig Ram machine that screams along (screaming for Windows) and has no issues with intense processing. It handles SQL just fine as well as graphics work for web sites I deal with. At least with an option if I kill the computer I can always bump it down next pass.

An aside:

Back slashes are the most evil thing in the universe. Windows folks, even Windows knows they are evil which is why they accept forward slashes.  Please don’t make me rewrite all of Python just because you must have evil backslashes.  I hope I don’t have to go into painful detail… for now, please trust me, backslashes… just SAY NO!  or things are going to break…

Oh… and did I mention just how evil back slashes are?   They are evil.  There is no debate, feel free to post and whine, but they are evil.  If you use them in your paths, you are intentionally breaking things.  So let’s do the right thing ok?  Let’s not use something that is inherently evil.

They are evil.

Evil.

Nuff said.

The database json file sure lends itself to Excel format or even being displayed in HTML/web format where a person could have a fresh “friendly view” of what is on Tablo according to your script (assuming one refreshes the info locally) and they could simply go down either the Excel file or HTML page, click a show and have it convert just like that. Pretty simple - well, with a few hours time!

I used to have a script that downloaded the antivirus defs for multiple apps, display them in a web page and the corporate employees could click on a link and it would update their A-V app from that web page. The page simply read a text file, a CSV, that another script updated after downloading and extracting the current definitions files. Any time they hit that company’s intranet page it displayed what was currently available for their app and would update for them. Slick - now, how the #$%^ did I ever do that?  Don’t ask me to duplicate that! I was another person back then. 
But my point is, you’ve got the info local, cached, and in pretty much CSV format, from there you can do almost anything, including display in a web page with links - choose what you want to do, which program to do it to, the options you want, click convert. This could be really “pretty” and usable by even those afraid of things like command lines, scripts and manual queries. Look and choose. 

Argh… (python is giving me fits)

1. Colons are important to Windows, but not allowed anywhere except drive letter, etc.

2. Colons inside of ffmpeg options causes problems and need to be escaped.

3. Python is not going to allow #2 to happen.

4. Getting rid of colons universally breaks #1.

Sigh…

Ah. The fun catch-22s of cross-platform development. Can you use a Unicode escape character ("\u003a") or Ascii escape character ("\x3a")?

@Joltarin, I will experiment with it.

If I can’t find a solution…

1.  Don’t use Windows, or at least no paths with drive_letter: in them
(friends shouldn’t let friends use Windows, just saying)

2.  Live without flexible ffmpeg option handling (where a colon is not allowed and must be escaped).

… really hating Python and Windows at the moment…

Possible solution for a particular scenario…

change directory to drive letter base…

and replace all colons in remaining path…

Getting late, I’ll look into this more tomorrow.

Evil? LOL- there’s a whole lot of Python stuff running in Windows. Other cross-platform languages use them - JAVA for example. 

It’s not simple in VBS either but there’s ways around it. And have fun with SPACES in VBS Like using triple double-quotes to CYA.

Frankly so far any python script I’ve tried - yours and the other one here, has worked fine with my paths. But then I often use batch files to launch them and will eventually use VBScript to launch this script and have it prompt me for the arguments to make it really simple. The VBScript will handle the path to Python, your script and pass arguments to the script as needed based on what I want to do. 
I prefer it that way because I can pre-define a path ONE TIME and pass it as a variable as many times as i wish in the script. To ensure there’s no typos, I can use option exclusive and DIM them so it will check my use of variables. 

There’s always something.
This is why I never finished learning C++ - programming requires a ton of patience, testing, trying again, testing again, and patience is something I was born without and am not capable of. I tried and quit. I also tried to learn Russian - classes given free by my employer, but was never able to get past the first couple of months. No patience to sit still for an hour in class and never did do any homework. 

Backslashes are evil… didn’t I make that clear ? :slight_smile:

Anyhow, I think I have a solution for the majority of cases… I’ll be working on it more tonight.

Escapes are important.  Backslash is THE escape character.  it just is… and I don’t see that changing…

I would argue you have a “whole lot of Python stuff” that does fairly trivial things running in Windows :slight_smile:

\   <— evil (outside of escaping)

More on my solution tonight (I don’t think 0.4 will get rolled out tonight though).

Excellent script, testing it out now on my NAS.  Had to set TMPDIR first as my /tmp is tiny.  Can’t wait to see the results in about 10 minutes.


Couldn’t get it to work on the NAS, but got it all running on a windows machine.


I think the ffmpeg on my NAS is too old, as I get this error
/share/MD0_DATA/homes/admin/keepdir/TabloT_ME1A.ts: Invalid data found when processing input

Even my version of ffmpeg is old.  It’s one of those things that is constantly evolving.

(back to work on 0.4…)

hmmm…wonder why it borked on the run.  The error above was when I tried using a manual command put together from the -d output and by removing all the ', and the metadata tags.


I’ll try it again some time as I’d rather run it locally on the NAS.

Any chance you can upgrade your ffmpeg on the NAS?

Haven’t found a way. It is part of the base firmware image.

Taking small break, created this… something to ponder on… (for those without Plex)…

Time for Something Else…

@cjcox, please add fast forward and rewind buttons, and frame preview, and … :stuck_out_tongue:

Hi,

What is the query to download/convert all recorded files off the tablo?
I am using -q " " and that seems to work for multiple word titles but was wondering if there is a wildcard option. The * character did not seem to work. I want to run the script on a schedule with no clobber.

Nice utility app.
Thanks,
Tom





The --query (-q) takes regular expressions (followed by implicit wildcard).  So -q “.” would match everything.

Running the script with noclobber is exactly what you should do for this scenario.

Since you’re doing a large scale run, could I get you to hold on this until tomorrow and I get 0.4 out?  It’s quite a change (fixes, etc.)

With that said 0.4 contains some radical changes… perhaps a bit more “beta” than usual.


Cool.  I will wait until .4 to do the batch download.


Thanks!
Tom