Use subliminal to fetch subtitles for TV
This commit is contained in:
@@ -63,6 +63,8 @@ class DownloadDispatcher_Source_Plugin_TV extends DownloadDispatcher_Source_Plug
|
|||||||
|
|
||||||
$this->renameOutput($full_output_dir);
|
$this->renameOutput($full_output_dir);
|
||||||
|
|
||||||
|
$this->fetchSubtitles($full_output_dir);
|
||||||
|
|
||||||
// This file has been dealt with, so no need to look at it in subsequent operations
|
// This file has been dealt with, so no need to look at it in subsequent operations
|
||||||
$this->markProcessed($dir . '/' . $file);
|
$this->markProcessed($dir . '/' . $file);
|
||||||
|
|
||||||
@@ -186,7 +188,7 @@ class DownloadDispatcher_Source_Plugin_TV extends DownloadDispatcher_Source_Plug
|
|||||||
|
|
||||||
if (preg_match('/(?:(?:[\s\.](?:19|20)\d{2})?[\s\.])?(?:\d+(\d{2})(?!\d|[\s\.](?:\d+x\d+|s\d[._-]?+ep?\d+))|\[?\s*\d+x(\d+)\s*\]?|s(?:eason ?)?\d+e(?:pisode ?)?(\d+))/i', $name, $matches)) {
|
if (preg_match('/(?:(?:[\s\.](?:19|20)\d{2})?[\s\.])?(?:\d+(\d{2})(?!\d|[\s\.](?:\d+x\d+|s\d[._-]?+ep?\d+))|\[?\s*\d+x(\d+)\s*\]?|s(?:eason ?)?\d+e(?:pisode ?)?(\d+))/i', $name, $matches)) {
|
||||||
return $set_episode($matches);
|
return $set_episode($matches);
|
||||||
} elseif (preg_match('/^(\d+))/i', $name, $matches)) {
|
} elseif (preg_match('/^(\d+)/i', $name, $matches)) {
|
||||||
return $set_episode($matches);
|
return $set_episode($matches);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -322,6 +324,15 @@ EOSH;
|
|||||||
DownloadDispatcher_ForegroundTask::execute($command, $dir);
|
DownloadDispatcher_ForegroundTask::execute($command, $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function fetchSubtitles($dir) {
|
||||||
|
$safe_dir = escapeshellarg($dir);
|
||||||
|
$command = <<<EOSH
|
||||||
|
/usr/bin/subliminal download -Z -l en ${safe_dir}
|
||||||
|
EOSH;
|
||||||
|
DownloadDispatcher_LogEntry::debug($this->log, "Executing subliminal command in '{$dir}': {$command}");
|
||||||
|
DownloadDispatcher_ForegroundTask::execute($command, $dir);
|
||||||
|
}
|
||||||
|
|
||||||
protected function forgetDownload($series, $season, $episode) {
|
protected function forgetDownload($series, $season, $episode) {
|
||||||
$base_url = $this->config->get('sources.TV.flexget-url');
|
$base_url = $this->config->get('sources.TV.flexget-url');
|
||||||
$username = $this->config->get('sources.TV.flexget-username');
|
$username = $this->config->get('sources.TV.flexget-username');
|
||||||
|
|||||||
Reference in New Issue
Block a user