[mythtv-users] Deleting recordings after conversion

Michael T. Dean mtdean at thirdcontact.com
Sun Oct 20 02:09:48 UTC 2013


On 10/19/2013 09:07 AM, Thomas Boehm wrote:
> Michael T. Dean wrote:
>> On 10/16/2013 01:40 PM, Thomas Boehm wrote:
>>> echo "update recorded set recgroup = 'Deleted', autoexpire = 999 where
>>> chanid = '$3' and starttime = '$4';"`|mysql --batch --skip-column-names
>>> --user="${DBUserName}" --password="${DBPassword}" -h "${DBHostName}"
>>> "${DBName}"
>>>
>>> This moves the recording into the "Deleted" recording group and gives it
>>> a high auto expire priority. Of course you need to substitute the
>>> variables with yours.
>> Much better than using bash + echo + mysql  + direct DB editing (which
>> can result in corrupt data in your DB) would be to use a simple Python
>> script to delete the recording.  That way, in the event (or when, I
>> should say) the database schema changes, your user job will continue to
>> work and you won't break anything.
> To a non-(python)programmer that script looks by far more complicated
> than that simple bash one liner.

Yes, because that script is meant to provide an interactive, 
command-line tool to delete one or more recordings quickly based on any 
search criteria the user provides in the command-line arguments.  Nearly 
all of the script is there to provide the interactivity and 
flexibility.  It's really about 2 lines of code to do what needs done 
for this case, but such a script isn't written (or at least isn't posted 
to the wiki), yet, and I don't have time to test the code, right now, 
and won't post untested code, so I haven't shown just how little is needed.

If someone else gets a few minutes to play with it, feel free to post 
the code...

> And are you saying that in the future the table "recorded" or the
> columns "recgroup" or "autoexpire" could be named differently?

Yes, internal implementation is almost guaranteed to change over time 
(and, I can guarantee things that are used in the SQL provided will no 
longer work when I get time to implement some changes that I've been 
planning).

>   And what
> guaranties that the python script keeps working in that case?

The Python bindings.  A Python script written using the Python bindings 
is saying what to do, whereas the bindings themselves say how to do it.  
In other words, all of the internal implementation is abstracted out by 
the bindings.  That's the whole purpose of the bindings.  When internal 
implementation changes, the bindings are updated to work with the changes.

Mike


More information about the mythtv-users mailing list