Skip to content

A self-hosted media server and file management system

fix: #340 Malformed Titles when episode not found

aminnausin79e126672e24
diff --git a/app/Jobs/VerifyFiles.php b/app/Jobs/VerifyFiles.php
index 47985f4c..ded9f4c7 100755
--- a/app/Jobs/VerifyFiles.php
+++ b/app/Jobs/VerifyFiles.php
@@ -341,14 +341,9 @@ class VerifyFiles extends ManagedSubTask {
}
if (is_null($metadata->title) && ! $is_audio) {
- $newTitle = count($season) == 1 ? 'S' . $season[0] : '';
- $newTitle .= count($episode) == 1 ? 'E' . $episode[0] : '';
-
- if ($newTitle != '') {
- $changes['title'] = $newTitle;
- } else {
- $changes['title'] = $video->name;
- }
+ $seasonStr = count($season) == 1 ? 'S' . (int) $season[0] : '';
+ $episodeStr = count($episode) == 1 ? 'E' . sprintf('%02d', $episode[0]) : '';
+ $changes['title'] = $episodeStr != '' ? $seasonStr . $episodeStr : $video->name;
}
// Only update title from audioMetadata if not set or file is of type audio with an embedded title and was updated