Skip to content

Commit

Permalink
improved archive unpacking in Napisy24 engine #47
Browse files Browse the repository at this point in the history
  • Loading branch information
krzemin committed Dec 20, 2015
1 parent 28a9799 commit 888b4d4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/engines/qnapisy24engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,20 +441,22 @@ bool QNapisy24Engine::unpack()
while((offset = r.indexIn(resp, offset)) != -1)
{
QString filePath = r.cap(1);
pathMatches << filePath;
offset += r.matchedLength();
}

if(filePath != tmpPackedFile && !filePath.endsWith(".url"))
{
pathMatches << filePath;
QString subFileName = "";
QStringList subExts = GlobalConfig().subtitleExtensions();
foreach (QString archiveFileName, pathMatches) {
if(subExts.contains(QFileInfo(archiveFileName).suffix(), Qt::CaseInsensitive)) {
subFileName = archiveFileName;
break;
}

offset += r.matchedLength();
}

if(pathMatches.isEmpty())
if(subFileName.isEmpty())
return false;

QString subFileName = pathMatches.first();

subtitlesTmp = tmpPath + "/" + subFileName;
if(QFile::exists(subtitlesTmp))
QFile::remove(subtitlesTmp);
Expand Down

0 comments on commit 888b4d4

Please sign in to comment.