Skip to content

Commit

Permalink
Test on real world files
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Nov 10, 2024
1 parent 4e274f0 commit e08ea77
Show file tree
Hide file tree
Showing 3 changed files with 391 additions and 22 deletions.
3 changes: 2 additions & 1 deletion phrydy/mediafile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ class MediaFile:

title: str
"""
The title of a audio file.
The title of an audio file.
"""

artist: str
artists: list[str]
album: str
Expand Down
12 changes: 12 additions & 0 deletions phrydy/mediafile_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ def fields(cls) -> Generator[str, None, None]:
seen.add(field)
yield field

@classmethod
def sorted_fields(cls):
"""Get the names of all writable metadata fields, sorted in the
order that they should be written.
This is a lexicographic order, except for instances of
:class:`DateItemField`, which are sorted in year-month-day
order.
"""
for property in sorted(MediaFile.fields(), key=MediaFile._field_sort_name):
yield property

@classmethod
def readable_fields(cls) -> Generator[str, None, None]:
"""Get all metadata fields: the writable ones from
Expand Down
Loading

0 comments on commit e08ea77

Please sign in to comment.