[mythtv-commits] Ticket #874: Patch to mythrename.pl to fix add subdirectory option

MythTV mythtv at cvs.mythtv.org
Tue Jan 24 17:50:36 UTC 2006


#874: Patch to mythrename.pl to fix add subdirectory option
-------------------------------------+--------------------------------------
 Reporter:  tom at redpepperracing.com  |        Owner:  xris
     Type:  patch                    |       Status:  new 
 Priority:  minor                    |    Milestone:      
Component:  mythtv                   |      Version:  head
 Severity:  low                      |   Resolution:      
-------------------------------------+--------------------------------------
Comment (by sphery <mtdean at thirdcontact.com>):

 The mythrename-subdirectories patch is an updated version of the patch
 that provides more complete functionality and is more flexible than the
 original patches.  (I didn't replace the original because it required
 ticket admin privileges.)  mythrename-subdirectories.patch should be
 applied without the mythrename-sub.diff patch.

 This patch allows the user to create subdirectories within a directory of
 links to recordings by using a format specifier to separate directory and
 filenames.  This allows the user to create directories based on any
 desired field or combination of fields as well as creating any number of
 subdirectory levels within the destination directory.

 Note that /all/ links within the destination directory and its
 subdirectories (recursive) will be removed when creating links to
 recordings.  Also, any empty directories beneath the destination directory
 will be removed when creating links.

 If the user specifies the path separator format specifier ("%F") but is
 attempting to rename files, the path separator will, instead, be replaced
 with the replacement character ("%-"), thereby preventing the user from
 attempting to move files.  This behavior is required because the Perl
 implementation of rename varies wildly and usually will not work across
 filesystem boundaries.

 BTW, I used "%F" as an abbreviation of "folder" since "%d" (as in
 "directory") was already used (for day of month) and I thought it would be
 easier for most users to remember than "%P" for "path separator".
 However, I included all three terms in the field description just for safe
 measure. ;)

 Because of the possibility of the existence of a character sequence like
 the path separator format specifier ("%F") inside a valid generated
 filename, it was unsafe to defer replacement of the path separator.
 However, the illegal character replacement needs to be performed on all
 the directories and filenames.  Since the format specifier replacement
 code has code to deal with the possibility of generated character
 sequences that look like format specifiers, I needed to replace the path
 separator at the same time.  Therefore, I simply replaced the path
 separator with a "placeholder" that could never appear in a generated
 filename and that's not being replaced--the null character.  The null
 character is then replaced with "/" after the illegal character
 replacement.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/874>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list