feat(titles): use track source attribute for service name in filenames

Allow services to set a custom `source` attribute on tracks, which will be used in the filename instead of the service class name.
This commit is contained in:
Andy
2026-01-22 20:21:00 -07:00
parent af49560345
commit b8e2f3da3f
3 changed files with 21 additions and 6 deletions

View File

@@ -155,9 +155,14 @@ class Episode(Title):
resolution = int(primary_video_track.width * (9 / 16)) resolution = int(primary_video_track.width * (9 / 16))
name += f" {resolution}p" name += f" {resolution}p"
# Service # Service (use track source if available)
if show_service: if show_service:
name += f" {self.service.__name__}" source_name = None
if self.tracks:
first_track = next(iter(self.tracks), None)
if first_track and hasattr(first_track, "source") and first_track.source:
source_name = first_track.source
name += f" {source_name or self.service.__name__}"
# 'WEB-DL' # 'WEB-DL'
name += " WEB-DL" name += " WEB-DL"

View File

@@ -90,9 +90,14 @@ class Movie(Title):
resolution = int(primary_video_track.width * (9 / 16)) resolution = int(primary_video_track.width * (9 / 16))
name += f" {resolution}p" name += f" {resolution}p"
# Service # Service (use track source if available)
if show_service: if show_service:
name += f" {self.service.__name__}" source_name = None
if self.tracks:
first_track = next(iter(self.tracks), None)
if first_track and hasattr(first_track, "source") and first_track.source:
source_name = first_track.source
name += f" {source_name or self.service.__name__}"
# 'WEB-DL' # 'WEB-DL'
name += " WEB-DL" name += " WEB-DL"

View File

@@ -101,9 +101,14 @@ class Song(Title):
name = str(self).split(" / ")[1] name = str(self).split(" / ")[1]
if config.scene_naming: if config.scene_naming:
# Service # Service (use track source if available)
if show_service: if show_service:
name += f" {self.service.__name__}" source_name = None
if self.tracks:
first_track = next(iter(self.tracks), None)
if first_track and hasattr(first_track, "source") and first_track.source:
source_name = first_track.source
name += f" {source_name or self.service.__name__}"
# 'WEB-DL' # 'WEB-DL'
name += " WEB-DL" name += " WEB-DL"