sane-tag-music: remove special-casing for Singles

This commit is contained in:
2024-07-10 08:10:29 +00:00
parent 50add19b14
commit e1c80c9abc

View File

@@ -311,24 +311,22 @@ class Tags:
self.artist = self.albumartist self.artist = self.albumartist
def rewrite_singles(self) -> None: def rewrite_singles(self) -> None:
""" idiom is for singles to belong to self-titled album. else each artist's singles get merged into one massive album """ """
Singles shouldn't generally have a track number: delete it
"""
if len(self.album) != 1: if len(self.album) != 1:
return return
for artist in self.albumartist[::-1] + self.artist[::-1]: if loose_compare_str(self.album[0], "Singles"):
if loose_compare_str(self.album[0], "Singles") or loose_compare_str(self.album[0], artist): self.tracknumber = []
self.album = [ artist ]
self.tracknumber = []
def to_path(self, ext: str) -> str | None: def to_path(self, ext: str) -> str | None:
artist = self.albumartist or self.artist artist = self.albumartist or self.artist
is_single = self.album in [self.albumartist, self.artist]
# if not (artist and self.album and self.title and (self.tracknumber or is_single) and ext):
if not (artist and self.album and self.title and ext): if not (artist and self.album and self.title and ext):
return None return None
artist = clean_fields_for_fs(artist, single_fields=False) artist = clean_fields_for_fs(artist, single_fields=False)
album = "Singles" if is_single else clean_fields_for_fs(self.album) album = clean_fields_for_fs(self.album)
trackno = self.tracknumber and clean_fields_for_fs(self.tracknumber) trackno = self.tracknumber and clean_fields_for_fs(self.tracknumber)
trackno = [f"{trackno:>02}"] if trackno else [] trackno = [f"{trackno:>02}"] if trackno else []
title = clean_fields_for_fs(self.title) title = clean_fields_for_fs(self.title)