Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#6869 closed defect (fixed)

Subtitles not working for avi with multiple dots in filename

Reported by: Paul Kendall <paul@…> Owned by: danielk
Priority: trivial Milestone: unknown
Component: MythTV - General Version: head
Severity: low Keywords:
Cc: Ticket locked: yes

Description

If you have an avi file such as a.b.avi and subtitle file a.b.srt, the subtitle file is not found.

The code in revision [20879] has a small bug using the QFileInfo::baseName instead of ::fileName. The docs for ::baseName say that it is up to the first '.'. There is also code after that call to file the last '.', which will then never be used.

Either use the ::baseName call passing 'true' and remove the magic remove the extension or just call ::fileName.

Attachments (1)

subtitle.patch (493 bytes) - added by Paul Kendall <paul@…> 15 years ago.
Patch to use ::fileName call

Download all attachments as: .zip

Change History (10)

Changed 15 years ago by Paul Kendall <paul@…>

Attachment: subtitle.patch added

Patch to use ::fileName call

comment:1 Changed 15 years ago by Paul Kendall <paul@…>

Looks like the ::baseName call with a parameter is no longer supported, so the patch provided seems to be the best solution.

comment:2 Changed 15 years ago by danielk

Owner: changed from Isaac Richards to danielk
Priority: minortrivial
Severity: mediumlow
Status: newassigned
Version: unknownhead

We want to continue strip at least the last extension, so the patch and suggestions don't work. But if someone comes up with a patch that doesn't break existing mythtv setups and allows multiple dots in the filename I'll consider it. Should be easy enough with QString::lastIndexOf(".") & QString::left() calls; just deal with the corner cases.

comment:3 Changed 15 years ago by stuartm

QString::section() with a negative (reverse search) would be the simplest solution.

comment:4 Changed 15 years ago by Paul Kendall <paul@…>

Actually, the patch does work. By using fileName instead of baseName you get the full filename and the code under the path strips of the part after and including the last dot.

The current code works if there is only a single dot because the baseName call returns the name less the extension and the second part of the code is never executed!

So, the patch won't break existing setups either.

comment:5 Changed 14 years ago by danielk

Resolution: fixed
Status: assignedclosed

(In [22800]) Fixes #6869. Allow multiple dots in external subtitle filenames.

comment:6 in reply to:  4 Changed 14 years ago by S2

Replying to Paul Kendall <paul@…>:

Actually, the patch does work.

I can confirm that the patch works on 0.22-fixes branch.

comment:7 Changed 14 years ago by leipzig@…

Hi there,

I have had some trouble with the subtitling. The patch solved the multidot filenames issue, but it seems that for files with "?" characters there is one more problem.

The substitution in the filter pattern works fine in order to find files on QDir, but now baseName contains the /replaced/ version too (http://qt.nokia.com/doc/4.6/qstring.html#replace), so this code

257	        QFileInfo fi(dirName + "/" + baseName + (*cit).right(4));

looks for a file with "?" characters on it, which does not exist.

I have replaced that line with

257	        QFileInfo fi(dirName + "/" + *cit);

and now my compilation seems to work fine.

What do you think?

--Héctor

comment:8 Changed 14 years ago by leipzig@…

By the way, this patch has not made its way to 0.22-fixes yet!

comment:9 Changed 14 years ago by stuartm

Ticket locked: set
Note: See TracTickets for help on using tickets.