Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
azuline committed Apr 20, 2024
1 parent f54aaa7 commit a5054bf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
16 changes: 8 additions & 8 deletions rose/audiotags.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,18 @@ def _write_tag_with_description(name: str, value: str | None) -> None:
m.tags = mutagen.mp4.MP4Tags()
m.tags["----:net.sunsetglow.rose:ID"] = (self.id or "").encode()
m.tags["----:net.sunsetglow.rose:RELEASEID"] = (self.release_id or "").encode()
m.tags["\xa9nam"] = (self.title or "").encode()
m.tags["\xa9day"] = str(self.releaseyear).zfill(4).encode()
m.tags["\xa9nam"] = self.title or ""
m.tags["\xa9day"] = str(self.releaseyear).zfill(4)
m.tags["----:net.sunsetglow.rose:COMPOSITIONYEAR"] = (
str(self.compositionyear).zfill(4).encode()
)
m.tags["\xa9alb"] = (self.release or "").encode()
m.tags["\xa9gen"] = ";".join(self.genre).encode()
m.tags["\xa9alb"] = self.release or ""
m.tags["\xa9gen"] = ";".join(self.genre)
m.tags["----:com.apple.iTunes:LABEL"] = ";".join(self.label).encode()
m.tags["----:com.apple.iTunes:CATALOGNUMBER"] = (self.catalognumber or "").encode()
m.tags["----:com.apple.iTunes:RELEASETYPE"] = self.releasetype.encode()
m.tags["aART"] = format_artist_string(self.releaseartists).encode()
m.tags["\xa9ART"] = format_artist_string(self.trackartists).encode()
m.tags["aART"] = format_artist_string(self.releaseartists)
m.tags["\xa9ART"] = format_artist_string(self.trackartists)
# Wipe the alt. role artist tags, since we encode the full artist into the main tag.
with contextlib.suppress(KeyError):
del m.tags["----:com.apple.iTunes:REMIXER"]
Expand Down Expand Up @@ -417,8 +417,8 @@ def _get_tag(t: Any, keys: list[str], *, split: bool = False, first: bool = Fals
f"Encountered a tag value of type {type(val)}"
)
if first:
return values[0] if values else None
return r" \\ ".join(values)
return (values[0] or None) if values else None
return r" \\ ".join(values) or None
except (KeyError, ValueError):
pass
return None
Expand Down
2 changes: 1 addition & 1 deletion rose/releases_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def test_edit_release(monkeypatch: Any, config: Config, source_dir: Path) -> Non
releasetype="single",
releaseyear=2222,
compositionyear=1800,
catalognumber="lalala",
catalognumber="Lalala",
new=False,
disctotal=1,
genres=["J-Pop", "Pop-Rap"],
Expand Down
17 changes: 17 additions & 0 deletions rose/templates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,61 +115,78 @@ def test_preview_templates(config: Config) -> None:
Source Directory - Release:
Sample 1: Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: BTS - 2016. Young Forever (花樣年華)
Sample 3: Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
Source Directory - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
1. All Releases - Release:
Sample 1: Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: BTS - 2016. Young Forever (花樣年華)
Sample 3: Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
1. All Releases - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
2. New Releases - Release:
Sample 1: Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: BTS - 2016. Young Forever (花樣年華)
Sample 3: Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
2. New Releases - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
3. Recently Added Releases - Release:
Sample 1: [2023-04-20] Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: [2023-06-09] BTS - 2016. Young Forever (花樣年華)
Sample 3: [2023-09-06] Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
3. Recently Added Releases - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
4. Artists - Release:
Sample 1: Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: BTS - 2016. Young Forever (花樣年華)
Sample 3: Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
4. Artists - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
5. Genres - Release:
Sample 1: Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: BTS - 2016. Young Forever (花樣年華)
Sample 3: Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
5. Genres - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
6. Labels - Release:
Sample 1: Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: BTS - 2016. Young Forever (花樣年華)
Sample 3: Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
6. Labels - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
7. Collages - Release:
Sample 1: 1. Kim Lip - 2017. Kim Lip - Single [NEW]
Sample 2: 2. BTS - 2016. Young Forever (花樣年華)
Sample 3: 3. Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - 1992. Images
7. Collages - Track:
Sample 1: 01. Eclipse.opus
Sample 2: 02-05. House of Cards.opus
Sample 3: 01-01. Gigues: Modéré.opus.opus
8. Playlists - Track:
Sample 1: 1. Kim Lip - Eclipse.opus
Sample 2: 2. BTS - House of Cards.opus
Sample 3: 3. Claude Debussy performed by Cleveland Orchestra under Pierre Boulez - Gigues: Modéré.opus.opus
"""
)

0 comments on commit a5054bf

Please sign in to comment.