Generate file name matching movie database
This allows to auto scrap info for tv show episodes from movie database on kodi.
This commit is contained in:
parent
97a389909d
commit
2d411d7160
2 changed files with 14 additions and 11 deletions
|
@ -64,13 +64,12 @@ class VideoInfo
|
||||||
|
|
||||||
public function getTitleForHumans(): string
|
public function getTitleForHumans(): string
|
||||||
{
|
{
|
||||||
$title = ucwords(str_replace('-', ' ', $this->getTitle()));
|
return ''
|
||||||
|
. ($this->hasSeason() ? 'S' . str_pad($this->getSeasonNumber(), 2, '0', STR_PAD_LEFT) : '')
|
||||||
if ($this->hasEpisode()) {
|
. ($this->hasEpisode() ? 'E' . str_pad($this->getEpisodeNumber(), 2, '0', STR_PAD_LEFT) : '')
|
||||||
$title = str_pad($this->getEpisodeNumber(), 2, '0', STR_PAD_LEFT) . ' - ' . $title;
|
. ($this->hasSeason() || $this->hasEpisode() ? ' - ' : '')
|
||||||
}
|
. ucwords(str_replace('-', ' ', $this->getTitle()));
|
||||||
|
;
|
||||||
return $title;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTargetFilePath(): string
|
public function getTargetFilePath(): string
|
||||||
|
|
|
@ -197,13 +197,17 @@ class VideoInfoTest extends TestCase
|
||||||
'filename' => 'Sherlock-Holmes_Der-Vampir-Von-Whitechapel_hq.mp4',
|
'filename' => 'Sherlock-Holmes_Der-Vampir-Von-Whitechapel_hq.mp4',
|
||||||
'expectedTargetFilePath' => 'Sherlock-Holmes/Der Vampir Von Whitechapel.mp4',
|
'expectedTargetFilePath' => 'Sherlock-Holmes/Der Vampir Von Whitechapel.mp4',
|
||||||
],
|
],
|
||||||
'Series no seasons' => [
|
'Series no seasons without episode' => [
|
||||||
'filename' => 'Storage-Hunters_episode-2_trucker-auktion_hq.mp4',
|
'filename' => 'Storage-Hunters_episode-2_trucker-auktion_hq.mp4',
|
||||||
'expectedTargetFilePath' => 'Storage-Hunters/02 - Trucker Auktion.mp4',
|
'expectedTargetFilePath' => 'Storage-Hunters/E02 - Trucker Auktion.mp4',
|
||||||
],
|
],
|
||||||
'Series with seasons' => [
|
'Series with seasons without episode' => [
|
||||||
'filename' => 'The-Big-Bang-Theory_season-1_episode-12_das-jerusalem-projekt_hq.mp4',
|
'filename' => 'The-Big-Bang-Theory_season-1_episode-12_das-jerusalem-projekt_hq.mp4',
|
||||||
'expectedTargetFilePath' => 'The-Big-Bang-Theory/Staffel-01/12 - Das Jerusalem Projekt.mp4',
|
'expectedTargetFilePath' => 'The-Big-Bang-Theory/Staffel-01/S01E12 - Das Jerusalem Projekt.mp4',
|
||||||
|
],
|
||||||
|
'Series with seasons and episode' => [
|
||||||
|
'filename' => 'The-Big-Bang-Theory_season-1_episode-12_das-jerusalem-projekt_hq.mp4',
|
||||||
|
'expectedTargetFilePath' => 'The-Big-Bang-Theory/Staffel-01/S01E12 - Das Jerusalem Projekt.mp4',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue