<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2900.3020" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006>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.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=703022820-20122006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006>This script
will:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN class=co2>1)
Confirm that each entry in the mythvideo db is still in its proper
place.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2></SPAN><SPAN class=co2> If a file is missing, it
will look for it in the videos dir and all subdirs.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2></SPAN><SPAN class=co2> If $FINDFILESUPDATE is set
to 1 below, it will update the location in the db</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2></SPAN><SPAN class=co2> otherwise it will just print what
it wants to do.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN class=co2>2)
For mythvideo entries that do not already have cover art, look for .jpg or
.gif</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2> </SPAN><SPAN class=co2> files with an
otherwise identical name in the video file's dir or the .covers
dir.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2> Failing that, if the folder has a folder.jpg
file it will use that.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2> e.g. /myth/video/Movies/Charade.avi can find
/myth/video/Movies/Charade.jpg or</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2>
/myth/video/.covers/Charade.jpg</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2> also
/myth/video/TV/Sopranos/S1/Sopranos_S1E1.avi probably would not have a
Sopranos_S1E1.jpg,</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2> but it (and other episodes) would find
/myth/video/TV/Sopranos/S1/folder.jpg.</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2> If $FINDARTUPDATE is set to 1 below, it will
update the db to point to the art file</SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=703022820-20122006><SPAN
class=co2> </SPAN><SPAN class=co2> otherwise it will just
print what it wants to do.</SPAN></DIV></SPAN></FONT>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial size=2>Here's the
code:</FONT></SPAN></DIV>
<DIV><A href="http://pastebin.ca/286614">http://pastebin.ca/2866<SPAN
class=703022820-20122006>1</SPAN>4</A></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial size=2>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?</FONT></SPAN></DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial size=2>If there are
material changes and people are interested, I'll find a better host than
pastebin.</FONT></SPAN></DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial size=2>Greyfoxx suggested a
(separate) script to relocate or rename a file and update the mythvideo
db. Shouldn't be too tough.</FONT></SPAN></DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=703022820-20122006><FONT face=Arial
size=2>Enjoy!</FONT></SPAN></DIV>
<P><FONT size=2>Mark S. Kasson, Principal<BR>SIG Management<BR></FONT></P>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>