Prevent archives being extracted multiple times

This commit is contained in:
2012-08-27 00:35:35 +01:00
parent 1d4461dbc9
commit 954fdc534b
2 changed files with 6 additions and 2 deletions

View File

@@ -204,8 +204,8 @@ class DownloadDispatcher_Source_Plugin_TV extends DownloadDispatcher_Source_Plug
foreach ($iterator as /** @var SplFileInfo */ $existing_file) {
$existing_episode = $this->episode($existing_file->getFilename());
if ($existing_episode == $episode) {
// Only reject duplicates with the same extension, so we can keep meta data or high/low def copies
if ($this->filetype($file) == $this->filetype($existing_file->getFilename())) {
// Only reject duplicates for media files with the same extension, so we can keep meta data or high/low def copies
if (DownloadDispatcher_Utility_MediaFile::isArchivefile($file) || $this->filetype($file) == $this->filetype($existing_file->getFilename())) {
throw new DownloadDispatcher_Exception_DuplicateContent($file);
}
}

View File

@@ -14,6 +14,10 @@ class DownloadDispatcher_Utility_MediaFile {
return preg_match('/(?<!(?:\.|-)sample)\.(srt|smi)$/i', $filename);
}
public static function isArchiveFile($filename) {
return preg_match('/(?<!(?:\.|-)sample)\.(rar)$/i', $filename);
}
}