[mythtv-users] A script to locate moved files and (locally) find cover art.

Mark Kasson mkasson at sigmgt.com
Wed Dec 20 20:48:09 UTC 2006

Wrote a script for mythvideo in PHP4 that you might find useful.  I got to
the point where I didn't want to reorganize my video files because I didn't
want to break their entries in the mythvideo db.  Didn't want to lose the
files' categories and association with cover art.
This script will:
1) Confirm that each entry in the mythvideo db is still in its proper place.
    If a file is missing, it will look for it in the videos dir and all
    If $FINDFILESUPDATE is set to 1 below, it will update the location in
the db
    otherwise it will just print what it wants to do.
2) For mythvideo entries that do not already have cover art, look for .jpg
or .gif
     files with an otherwise identical name in the video file's dir or the
.covers dir.
     Failing that, if the folder has a folder.jpg file it will use that.
     e.g. /myth/video/Movies/Charade.avi can find
/myth/video/Movies/Charade.jpg or
     also /myth/video/TV/Sopranos/S1/Sopranos_S1E1.avi probably would not
have a Sopranos_S1E1.jpg,
     but it (and other episodes) would find
     If $FINDARTUPDATE is set to 1 below, it will update the db to point to
the art file
     otherwise it will just print what it wants to do.
Here's the code:
http://pastebin.ca/2866 <http://pastebin.ca/286614> 14
I'm not the most experienced coder, so there's probably better ways to do
things.  I'll incorporate any comments and suggestions.  e.g. any ideas for
other things to tidy up from command line?  Or other scriptable functions to
make mythvideo easier to manage?  Anyone want to test it/debug in PHP5?
If there are material changes and people are interested, I'll find a better
host than pastebin.
I'm thinking of adding a feature to set the category (if none is set) based
on text in braces in the filename.  e.g. Sopranos_S1E1[TV].  If I recall
correctly, braced text does not make it into the title of a mythvideo entry.
Greyfoxx suggested a (separate) script to relocate or rename a file and
update the mythvideo db.  Shouldn't be too tough.

Mark S. Kasson, Principal
SIG Management

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20061220/cd449328/attachment-0001.htm 

More information about the mythtv-users mailing list