Prevent archives being extracted multiple times
This commit is contained in:
@@ -204,8 +204,8 @@ class DownloadDispatcher_Source_Plugin_TV extends DownloadDispatcher_Source_Plug
|
|||||||
foreach ($iterator as /** @var SplFileInfo */ $existing_file) {
|
foreach ($iterator as /** @var SplFileInfo */ $existing_file) {
|
||||||
$existing_episode = $this->episode($existing_file->getFilename());
|
$existing_episode = $this->episode($existing_file->getFilename());
|
||||||
if ($existing_episode == $episode) {
|
if ($existing_episode == $episode) {
|
||||||
// Only reject duplicates with the same extension, so we can keep meta data or high/low def copies
|
// Only reject duplicates for media files with the same extension, so we can keep meta data or high/low def copies
|
||||||
if ($this->filetype($file) == $this->filetype($existing_file->getFilename())) {
|
if (DownloadDispatcher_Utility_MediaFile::isArchivefile($file) || $this->filetype($file) == $this->filetype($existing_file->getFilename())) {
|
||||||
throw new DownloadDispatcher_Exception_DuplicateContent($file);
|
throw new DownloadDispatcher_Exception_DuplicateContent($file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ class DownloadDispatcher_Utility_MediaFile {
|
|||||||
return preg_match('/(?<!(?:\.|-)sample)\.(srt|smi)$/i', $filename);
|
return preg_match('/(?<!(?:\.|-)sample)\.(srt|smi)$/i', $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isArchiveFile($filename) {
|
||||||
|
return preg_match('/(?<!(?:\.|-)sample)\.(rar)$/i', $filename);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user