Coverage for downtify/content_advisory.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.17.4, created at 2026-11-21 22:18 +0000

1"""The "explicit" mark of a song, as it is stored in an audio file. 

2 

3Spotify, YouTube Music and Deezer all say whether a song has explicit 

4lyrics. Downtify keeps that in the file itself, the way iTunes does and the 

5media servers that read it (Navidrome among them) expect: the ``rtng`` atom 

6in MP4 (1 = explicit, 2 = clean) and an ``ITUNESADVISORY`` text everywhere 

7else - a TXXX frame in ID3, a comment in Vorbis, FLAC and Opus. 

8 

9Only the explicit mark is written: a song the service doesn't flag is left 

10as it is, since nobody has said it is clean. Writing is in 

11:mod:`downtify.downloader`, reading in :mod:`downtify.library_metadata`. 

12""" 

13 

14from __future__ import annotations 

15 

16ADVISORY_TAG = 'ITUNESADVISORY' 

17MP4_ADVISORY_ATOM = 'rtng' 

18 

19#: What gets written for an explicit song. 

20ADVISORY_EXPLICIT = '1' 

21 

22#: What marks one when read: 1, and the older 4. (2 is "clean".) 

23EXPLICIT_VALUES = frozenset({'1', '4'})