Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix for duplicate subtitles found on windows #1434

Closed
wants to merge 1 commit into from

2 participants

@Paxxi
Collaborator

When using subtitles in a subs subdirectory on Windows XBMC loads the subtitles twice and displays twice as many subs/languages in the sub dialog.

I picked this solution since we can have a case sensitive source even if we're on Windows so it still checks for that and if a directory is found twice it skips adding it to the list.

Any feedback welcome.

@ghost

this will break if there actually is a subs and a Subs on a case sensitive fs.

@Paxxi
Collaborator

Cptspiff: yah it'll break in that case and maybe it's not the best solution. My reasoning for this method was that it should be extremely rare to find both a subs and Subs folder in the movie folder. However the fix solves it for any case insensitive case where there's only one subs folder which is probably a more common scenario. I feel the trade off is worth it in the absence of a better solution.

@t-nelson

Why not invert the search? List the basedir, test if any subdirs are in the common_sub_dir list. It should be fast since the dir list is likely cached already and it saves us the stats on slow FS.

@Paxxi
Collaborator

T-nelson: sounds like a good idea.

@Paxxi Paxxi closed this
@Paxxi Paxxi deleted the Paxxi:subtitles branch
@LongChair LongChair referenced this pull request from a commit in plexinc/plex-home-theater-public
@LongChair LongChair Don't display User / pin dialog upon screensaver wakeup if we're play…
…ing something, fixes #1434
d15ddbc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 16, 2012
  1. @Paxxi
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 1 deletion.
  1. +15 −1 xbmc/Util.cpp
View
16 xbmc/Util.cpp
@@ -2328,7 +2328,21 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
{
CStdString strPath2 = URIUtils::AddFileToFolder(strLookInPaths[i],common_sub_dirs[j]);
if (CDirectory::Exists(strPath2))
- strLookInPaths.push_back(strPath2);
+ {
+ //check that no duplicate paths are added for case-insesitive sources e.g.
+ //subs and Subs would cause duplicate subtitles to be loaded.
+ bool bInsert = true;
+ for (int k=0; k<strLookInPaths.size(); k++)
+ {
+ if(0 == strLookInPaths[k].CompareNoCase(strPath2))
+ {
+ bInsert = false;
+ break;
+ }
+ }
+ if (bInsert)
+ strLookInPaths.push_back(strPath2);
+ }
}
}
// .. done checking for common subdirs
Something went wrong with that request. Please try again.