Opened 18 years ago
Closed 18 years ago
#874 closed patch (fixed)
Patch to mythrename.pl to fix add subdirectory option
Reported by: | Owned by: | xris | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | mythtv | Version: | head |
Severity: | low | Keywords: | |
Cc: | Ticket locked: | no |
Description
This patch adds a 'sub' option to be used in conjunction with the 'link' option to allow for creating links in subdirectories by title.
Attachments (2)
Change History (8)
comment:1 Changed 18 years ago by
comment:2 Changed 18 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Patch doesn't apply after #873 was applied.
comment:3 Changed 18 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Attached new patch that works with SVN 8669. I added a bit more verbosity as well.
As a bonus, this patch actually works! The previous one had a bug in it.
Tom
comment:4 Changed 18 years ago by
Owner: | changed from Isaac Richards to xris |
---|---|
Status: | reopened → new |
Changed 18 years ago by
Attachment: | mythrename-subdirectories.patch added |
---|
Updated patch--should be used instead of mythrename-sub.diff
comment:5 Changed 18 years ago by
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.
If/when this and the verbose ticket get added, then I'll update the patch with verbose options.