Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed support for subtitles in rar and zip file #938

Merged
merged 1 commit into from May 6, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion xbmc/Util.cpp
Expand Up @@ -2370,7 +2370,8 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
// is this a rar or zip-file
if (URIUtils::IsRAR(strItem) || URIUtils::IsZIP(strItem))
{
ScanArchiveForSubtitles( items[j]->GetPath(), strMovieFileNameNoExt, vecSubtitles );
// zip-file name equals strMovieFileNameNoExt, don't check in zip-file
ScanArchiveForSubtitles( items[j]->GetPath(), "", vecSubtitles );
}
else // not a rar/zip file
{
Expand All @@ -2385,6 +2386,15 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
}
}
}
else
{
// is this a rar or zip-file
if (URIUtils::IsRAR(strItem) || URIUtils::IsZIP(strItem))
{
// check strMovieFileNameNoExt in zip-file
ScanArchiveForSubtitles( items[j]->GetPath(), strMovieFileNameNoExt, vecSubtitles );
}
}
}
g_directoryCache.ClearDirectory(strLookInPaths[step]);
}
Expand Down Expand Up @@ -2463,6 +2473,11 @@ int CUtil::ScanArchiveForSubtitles( const CStdString& strArchivePath, const CStd
}
// done checking if this is a rar-in-rar

// check that the found filename matches the movie filename
int fnl = strMovieFileNameNoExt.size();
if (fnl && !URIUtils::GetFileName(strPathInRar).Left(fnl).Equals(strMovieFileNameNoExt))
continue;

int iPos=0;
while (sub_exts[iPos])
{
Expand Down