Opened 12 years ago

Closed 12 years ago

#4058 closed enhancement (fixed)

Perl bindings: allow disabling illegal character replacement in format_name()

Reported by: sphery <mtdean@…> Owned by: xris
Priority: minor Milestone: unknown
Component: perl / nuvexport Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The attached trivial patch, mythtv-perl_bindings-disable_replacements_in_format_name.patch , allows a user to specify that replacement of illegal characters should not be performed in the format_name() method of MythTV::Program. It simply adds a new parameter to the method ($no_replace) which defaults to 0 (false--replacements occur by default, as before).

The patch allows the use of format_name() for "general-purpose" formatting (even for non-filename uses).

To disable illegal character replacement, use:

my $name = $show->format_name($format,$separator,$replacement,$allow_dirs,$underscores,1);

To enable illegal character replacement, specify a 0 or simply do not specify a value for $no_replace (so the above would be identical, but the ",1" would be changed to ",0" or removed from the method call).

This patch was tested with mythrename.pl, the only place in the current mythtv distribution where format_name() is used, and it works without modification even after this patch is applied. I've also written my own scripts and specified only one parameter (the format) and illegal character replacement worked the same as before the patch.

Attachments (1)

mythtv-perl_bindings-disable_replacements_in_format_name.patch (1.7 KB) - added by sphery <mtdean@…> 12 years ago.

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by sphery <mtdean@…>

comment:1 Changed 12 years ago by xris

Resolution: fixed
Status: newclosed

(In [14625]) From sphery, add a new parameter to format_name that disables the cleanup of 'illegal' filesystem characters, since some people use this method in circumstances unrelated to filesystems. closes #4058

Note: See TracTickets for help on using tickets.