Opened 18 years ago

Closed 18 years ago

#874 closed patch (fixed)

Patch to mythrename.pl to fix add subdirectory option

Reported by: tom@… 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)

mythrename-sub.diff (5.5 KB) - added by tom@… 18 years ago.
patch that works with SVN 8669
mythrename-subdirectories.patch (3.7 KB) - added by sphery <mtdean@…> 18 years ago.
Updated patch--should be used instead of mythrename-sub.diff

Download all attachments as: .zip

Change History (8)

comment:1 Changed 18 years ago by tom@…

If/when this and the verbose ticket get added, then I'll update the patch with verbose options.

comment:2 Changed 18 years ago by Isaac Richards

Resolution: invalid
Status: newclosed

Patch doesn't apply after #873 was applied.

Changed 18 years ago by tom@…

Attachment: mythrename-sub.diff added

patch that works with SVN 8669

comment:3 Changed 18 years ago by anonymous

Resolution: invalid
Status: closedreopened

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 cpinkham

Owner: changed from Isaac Richards to xris
Status: reopenednew

Changed 18 years ago by sphery <mtdean@…>

Updated patch--should be used instead of mythrename-sub.diff

comment:5 Changed 18 years ago by sphery <mtdean@…>

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.

comment:6 Changed 18 years ago by xris

Resolution: fixed
Status: newclosed

(In [8711]) apply patch to close #874. Changed %F to / -- why reinvent the wheel when you're just going to replace it with / later, anyway?

Note: See TracTickets for help on using tickets.