[mythtv-users] Resurrecting mythadder.py to repopulate videometadata when plugging in a usb drive with media

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Jul 20 02:29:43 UTC 2022


On Tue, 19 Jul 2022 14:53:41 -0400, you wrote:

>
>
>> On Jul 19, 2022, at 2:44 PM, Roland Ernst <rcrernst at gmail.com> wrote:
>> 
>> 
>> On Tue, Jul 19, 2022 at 7:21 PM Jay Harbeston <jharbestonus at gmail.com <mailto:jharbestonus at gmail.com>> wrote:
>> I remember there being issues long ago with udisks2 vs. udisks and I don’t recall where the problem was..
>> 
>> Questions regarding using external usb drives with media:
>> 
>> 1. Was the problem with udisks2 within mythtv code itself or in the mythadder.py routine?  While looking at the code in mythaddr.py,  I don’t see any reference to udisks  in it. It does add a rule for udev. 
>> 
>> 2. Also, I see that it uses the full path of the video files into the filename field of video metadata including the leading ‘/‘ .  If a file has the full path including the leading ‘/‘ does it use the full path when playing the video file?
>> 
>> 3. Should the external drive be attached to the backend, or can it be attached to the frontend only machine?
>> 
>> 
>> I also understand that I will need to add new fields to it that have been added since it was created. As well as the handling of them.
>> 
>> Regards, and thanks in advance!
>> 
>> Mythadder was published 2010 (MythTV 0.22)  and last known good in 2012 (MythTV 0.24).
>> See https://www.mythtv.org/wiki/Mythadder.py <https://www.mythtv.org/wiki/Mythadder.py>
>> 
>> Maybe, it is a better way to describe what you want to do and what you want to achieve?
>> There might be other solutions available by now.  
>
>What I would like is to ‘archive’ video metadata after I have moved video files to an external drive. And then when I feel the need, I can reattach the drive, and reload metadata for the media that is currently stored offline on the drive. 
>
>My understanding is that when you do a scan of the video directories, that the metadata for missing files(archived to external disk) is wiped out of the video metadata table(has been so in the past.
>
>Mythadder was very useful in keeping offline video metadata available in a table indexed by the drives UUID  that was then accessed when the given drive was plugged in again in the future.
>
>The key is ‘remembering’ the video metadata for video that was moved off to external access. And then being able to reload that data when plugging the drive back in in the future.
>
>Regards!

It looks like mythadder.py is Python 2, so the first thing it needs is
to be converted to Python 3.  There does not look to be too much
problem with that.

For handling the new fields in the database, I would suggest you look
at what I do in mythimport:

http://www.jsw.gen.nz/mythtv/mythimport/mythimport

def _get_wanted_columns(dbc, table_name):

    # Get column names for table, omitting unwanted `recordedid`
columns.
    wanted_columns = ''
    dbc.execute('desc ' + table_name + ';')
    for row in dbc:
        if row[0] != 'recordedid':
            wanted_columns += row[0] + ','
    return wanted_columns[:-1];

This reads the column names from the database "desc" command (except
for the unwanted ones), so that any new fields that get added in later
versions will be handled automatically.

It would also be possible to dump the metadata for the files on the
USB partition to a backup .sql.gz file on the USB.  When the USB was
later used again, the data could be automatically restored from the
backup.


More information about the mythtv-users mailing list