Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
feat: support clean rating
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldObservationLog committed Jun 5, 2024
1 parent 4bedff5 commit 21b8607
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,19 @@ def parse_from_song_data(cls, song_data: Datum):
record_company=song_data.relationships.albums.data[0].attributes.recordLabel,
upc=song_data.relationships.albums.data[0].attributes.upc,
isrc=song_data.attributes.isrc,
rtng=1 if song_data.attributes.contentRating and song_data.attributes.contentRating == 'explicit' else 0,
rtng=cls._rating(song_data.attributes.contentRating),
song_id=song_data.id, album_id=song_data.relationships.albums.data[0].id
)

@staticmethod
def _rating(content_rating: Optional[str]) -> int:
if not content_rating:
return 0
if content_rating == "explicit":
return 1
if content_rating == "clean":
return 2

def set_lyrics(self, lyrics: str):
self.lyrics = lyrics

Expand Down

0 comments on commit 21b8607

Please sign in to comment.