This pull request brings in changes mainly to media.py and video.py. The purpose is to make use of as much of the data as possible returned by the TIDAL API videos/contributors endpoint. So, most of the changes are in the models.VideosContributorsResponseJSON.__post_init__() method and the media.TAG_MAPPING dictionary.
A couple of changes to track.py as well: particularly properly formatting the PERFORMER tag in .flac files; the name of the performer should be surrounded in brackets and this is a bit tricky with Python's f-string formatting, but it boils down to the following:
from typing import List
# old, wrong:
piano_credits: List[str] =[f"{pc} (piano)" for pc in self.credits.piano]
# correct, fixed by this PR:
piano_credits: List[str] = [f"{{{pc}}} (piano)" for pc in self.credits.piano]
Lastly, the most salient change brought in by this PR is to consider multiple contributor types as the same MP4 tag type. For example, the engineer metadata tag is ----:com.apple.iTunes:ENGINEER, but TIDAL specifies plain Engineer, Mastering Engineer, Vocal Engineer, Mixing Engineer, etc. All but the latter are considered "engineer" in terms of the credits of the video, so the following concatenates all engineer-like contributors with ";" into the MP4 file's ----:com.apple.iTunes:ENGINEER tag:
for tag in {"engineer", "mastering_engineer", "vocal_engineer"}:
try:
_credits_tag: str = ";".join(getattr(self.contributors, tag))
except (TypeError, AttributeError): # NoneType problems
pass
else:
tags[tag_map["engineer"]] = _credits_tag
This pull request brings in changes mainly to media.py and video.py. The purpose is to make use of as much of the data as possible returned by the TIDAL API videos/contributors endpoint. So, most of the changes are in the
models.VideosContributorsResponseJSON.__post_init__()
method and themedia.TAG_MAPPING
dictionary.A couple of changes to
track.py
as well: particularly properly formatting thePERFORMER
tag in .flac files; the name of the performer should be surrounded in brackets and this is a bit tricky with Python's f-string formatting, but it boils down to the following:Lastly, the most salient change brought in by this PR is to consider multiple contributor types as the same MP4 tag type. For example, the engineer metadata tag is
----:com.apple.iTunes:ENGINEER
, but TIDAL specifies plainEngineer
,Mastering Engineer
,Vocal Engineer
,Mixing Engineer
, etc. All but the latter are considered "engineer" in terms of the credits of the video, so the following concatenates all engineer-like contributors with ";" into the MP4 file's----:com.apple.iTunes:ENGINEER
tag: