Permalink
Browse files

fixed: subtitle files detection for archived video files under cdX/

E.g. in case of
CD1/video.rar containing video.avi
Subs/video.sub
we want to search the ../Subs directory for subtitles. However, since
the directory of video.avi is actually video.rar, the current cdX
directory maching code doesn't add the parent directory to the subtitle
search paths.

Fix that by checking also the name of the directory containing the
archive for cdX.
  • Loading branch information...
1 parent 514495d commit a0b0a23c531ad389d80d0f6adf7c2f00589bfd33 @anssih anssih committed May 1, 2012
Showing with 17 additions and 12 deletions.
  1. +17 −12 xbmc/Util.cpp
View
@@ -2293,20 +2293,25 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
strLookInPaths.push_back(strPath);
}
- // checking if any of the common subdirs exist ..
- CStdStringArray directories;
- int nTokens = StringUtils::SplitString( strPath, "/", directories );
- if (nTokens == 1)
- StringUtils::SplitString( strPath, "\\", directories );
-
- // if it's inside a cdX dir, add parent path
- if (directories.size() >= 2 && directories[directories.size()-2].size() == 3 && directories[directories.size()-2].Left(2).Equals("cd")) // SplitString returns empty token as last item, hence size-2
+ int iSize = strLookInPaths.size();
+ for (int i=0; i<iSize; ++i)
{
- CStdString strPath2;
- URIUtils::GetParentPath(strPath,strPath2);
- strLookInPaths.push_back(strPath2);
+ CStdStringArray directories;
+ int nTokens = StringUtils::SplitString( strLookInPaths[i], "/", directories );
+ if (nTokens == 1)
+ StringUtils::SplitString( strLookInPaths[i], "\\", directories );
+
+ // if it's inside a cdX dir, add parent path
+ if (directories.size() >= 2 && directories[directories.size()-2].size() == 3 && directories[directories.size()-2].Left(2).Equals("cd")) // SplitString returns empty token as last item, hence size-2
+ {
+ CStdString strPath2;
+ URIUtils::GetParentPath(strLookInPaths[i], strPath2);
+ strLookInPaths.push_back(strPath2);
+ }
}
- int iSize = strLookInPaths.size();
+
+ // checking if any of the common subdirs exist ..
+ iSize = strLookInPaths.size();
for (int i=0;i<iSize;++i)
{
for (int j=0; common_sub_dirs[j]; j++)

0 comments on commit a0b0a23

Please sign in to comment.