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: | 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)
Change History (10)
Changed 15 years ago by
Attachment: | subtitle.patch added |
---|
comment:1 Changed 15 years ago by
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
Owner: | changed from Isaac Richards to danielk |
---|---|
Priority: | minor → trivial |
Severity: | medium → low |
Status: | new → assigned |
Version: | unknown → head |
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
QString::section() with a negative (reverse search) would be the simplest solution.
comment:4 follow-up: 6 Changed 15 years ago by
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
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:6 Changed 14 years ago by
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
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:9 Changed 14 years ago by
Ticket locked: | set |
---|
Patch to use ::fileName call