Opened 17 years ago

Closed 16 years ago

#2754 closed defect (worksforme)

Colon in subtitle confuses mythfrontend, MythWeb

Reported by: ylee@… Owned by: Nigel
Priority: minor Milestone: unknown
Component: mythtv Version: 0.20
Severity: medium Keywords: mythrename.pl colon
Cc: Ticket locked: no

Description

I formerly ran the following script every hour in my crontab to gain human-readable filenames:

perl /usr/share/doc/mythtv-0.20/contrib/mythrename.pl --format "\%T \%- \%Y-\%m-\%d, \%g-\%i \%A, ch\%c %- %S" --replacement -

This caused problems with four recordings. The one thing they have in common is that they all have a colon in their subtitles:

Rick Steves' Europe Highlights of Paris: Eiffel and Monet to Crème Brulée

Great Museums: Year of the Museum Specials Boston Children's Museum: Mind Over Matter

Great Museums: Year of the Museum Specials National Baseball Hall of Fame: Home Base

Great Museums: Year of the Museum Specials Riches, Rivals and Radicals: 100 Years of Museums in America

Neither mythfrontend nor MythWeb was able to find the recordings after the renamings, even though the file names matched what MythWeb would tell me it couldn't find when I clicked on one of these recordings.

When I altered the crontab entry to read

perl /usr/share/doc/mythtv-0.20/contrib/mythrename.pl --format "\%T \%- \%Y-\%m-\%d, \%g-\%i \%A, ch\%c %- %S" --replacement -

--in other words, no longer include subtitles in the human-readable filenames--mythfrontend was able to see and play the newly-renamed recordings (also, of course, showing that mythbackend never lost track of the files, as the script was able to work through it to rename them again). Also note that this issue has nothing to do with having a colon or other punctuation in recordings' titles; I've watched plenty of other episodes of Rick Steves' Europe, for example.

This issue existed at least as far back as 0.19 and still exists in 0.20-fixes.

Change History (5)

comment:1 Changed 17 years ago by Nigel

Yeechang, I can't easily test this, so could you try this patch:

Index: mythrename.pl
===================================================================
--- mythrename.pl       (revision 12168)
+++ mythrename.pl       (working copy)
@@ -228,9 +228,11 @@
     # Format the name
         my $name = $show->format_name($format,$separator,$replacement,$dest,$underscores);
     # Get a shell-safe version of the filename (yes, I know it's not needed in this case, but I'm anal about such things)
-        my $safe_file = $show->{'local_path'};
-        $safe_file =~ s/'/'\\''/sg;
-        $safe_file = "'$safe_file'";
+        my $safe_name = quotemeta($name);
+        if ( $name ne $safe_name ) {
+            print "Changing unsafe filename '$name' to '$safe_name'\n";
+            $name = $safe_name;
+        }
     # Figure out the suffix
         my $suffix = ($show->{'finfo'}->{'is_mpeg'}) ? '.mpg' : '.nuv';
     # Link destination

comment:2 Changed 17 years ago by Nigel

Owner: changed from Isaac Richards to Nigel
Status: newassigned

comment:3 in reply to:  1 Changed 17 years ago by ylee@…

Replying to nigel:

Yeechang, I can't easily test this, so could you try this patch:

Sadly, no luck; not only are the same recordings still inaccessible, prefixing all "unsafe" characters regardless of what they are makes what are meant to be human-readable filenames less readable:

That Thing You Do! - 2006-12-02, 6-29 AM, ch1324.nuv

becomes

That\ Thing\ You\ Do\!\ \-\ 2006\-12\-02\,\ 6\-29\ AM\,\ ch1324.nuv

In other words, human-readable filenames become less readable by humans.

(By the way, I put typos in the two sample mythrename.pl lines I listed as using above. They should read:

perl /usr/share/doc/mythtv-0.20/contrib/mythrename.pl --format "\%T \%- \%Y-\%m-\%d, \%g-\%i \%A, ch\%c \%- \%S" --replacement -

and

perl /usr/share/doc/mythtv-0.20/contrib/mythrename.pl --format "\%T \%- \%Y-\%m-\%d, \%g-\%i \%A, ch\%c" --replacement -

respectively.)

comment:4 Changed 17 years ago by Nigel

I have tried to reproduce this fault, but failed. When the script renames the file, the frontend temporarily has the cached old name and cannot open it, but exiting out of the TV section and back in fixes this. (I was using 0.19 fixes with Classic menu theme)
Would it be possible to attach database information for the defective renamed recordings?

mysql -u mythtv -p mythconverg
...
select basename from recorded;

comment:5 Changed 16 years ago by Nigel

Resolution: worksforme
Status: acceptedclosed

I can't reproduce, Yeechang hasn't provided any more debug. Closing.

Note: See TracTickets for help on using tickets.