Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sort order tags #30

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ tag.write_with_path("music.m4a", &write_cfg).unwrap();

## Useful Links
- QuickTime spec
- [Overview of QTFF](https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html)
- [Movie Atoms](https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html)
- [Metadata](https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html)
- [Overview of QTFF](https://developer.apple.com/documentation/quicktime-file-format)
- [Movie atoms](https://developer.apple.com/documentation/quicktime-file-format/movie_atoms)
- [User data atoms](https://developer.apple.com/documentation/quicktime-file-format/user_data_atoms)
- [MultimediaWiki QuickTime container](https://wiki.multimedia.cx/index.php/QuickTime_container)
- [AtomicParsley docs](http://atomicparsley.sourceforge.net/mpeg-4files.html)
- [Mutagen docs](https://mutagen.readthedocs.io/en/latest/api/mp4.html)
Expand Down
14 changes: 14 additions & 0 deletions src/atom/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,20 @@ pub const WORK: Fourcc = Fourcc(*b"\xa9wrk");
/// (`shwm`)
pub const SHOW_MOVEMENT: Fourcc = Fourcc(*b"shwm");

// Sort order
/// (`soaa`)
pub const ALBUM_ARTIST_SORT_ORDER: Fourcc = Fourcc(*b"soaa");
/// (`soal`)
pub const ALBUM_SORT_ORDER: Fourcc = Fourcc(*b"soal");
/// (`soar`)
pub const ARTIST_SORT_ORDER: Fourcc = Fourcc(*b"soar");
/// (`soco`)
pub const COMPOSER_SORT_ORDER: Fourcc = Fourcc(*b"soco");
/// (`sonm`)
pub const TITLE_SORT_ORDER: Fourcc = Fourcc(*b"sonm");
/// (`sosn`)
pub const TV_SHOW_NAME_SORT_ORDER: Fourcc = Fourcc(*b"sosn");

// Freeform
/// Mean string of most freeform identifiers (`com.apple.iTunes`)
pub const APPLE_ITUNES_MEAN: &str = "com.apple.iTunes";
Expand Down
6 changes: 6 additions & 0 deletions src/tag/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ impl DerefMut for Tag {
impl fmt::Display for Tag {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.format_album_artists(f)?;
self.format_album_artist_sort_orders(f)?;
self.format_artists(f)?;
self.format_artist_sort_orders(f)?;
self.format_composers(f)?;
self.format_composer_sort_orders(f)?;
self.format_lyricists(f)?;
self.format_album(f)?;
self.format_album_sort_order(f)?;
self.format_title(f)?;
self.format_title_sort_order(f)?;
self.format_genres(f)?;
self.format_year(f)?;
self.format_track(f)?;
Expand All @@ -57,6 +62,7 @@ impl fmt::Display for Tag {
self.format_copyright(f)?;
self.format_encoder(f)?;
self.format_tv_show_name(f)?;
self.format_tv_show_name_sort_order(f)?;
self.format_tv_network_name(f)?;
self.format_tv_episode_name(f)?;
self.format_tv_episode(f)?;
Expand Down
51 changes: 29 additions & 22 deletions src/tag/userdata/generate.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
# This file is used to generate the `generated.rs` file with userdata accessors.

[accessors.single_strings]
"album" = "©alb"
"copyright" = "cprt"
"encoder" = "©too"
"lyrics" = "©lyr"
"movement" = "©mvn"
"title" = "©nam"
"tv_episode_name" = "tven"
"tv_network_name" = "tvnn"
"tv_show_name" = "tvsh"
"work" = "©wrk"
"year" = "©day"
"isrc" = "----:com.apple.iTunes:ISRC"
"album" = "©alb"
"copyright" = "cprt"
"encoder" = "©too"
"lyrics" = "©lyr"
"movement" = "©mvn"
"title" = "©nam"
"tv_episode_name" = "tven"
"tv_network_name" = "tvnn"
"tv_show_name" = "tvsh"
"work" = "©wrk"
"year" = "©day"
"isrc" = "----:com.apple.iTunes:ISRC"
"album_sort_order" = "soal"
"title_sort_order" = "sonm"
"tv_show_name_sort_order" = "sosn"


[accessors.multiple_strings]
"album_artist" = "aART"
"artist" = "©ART"
"category" = "catg"
"comment" = "©cmt"
"composer" = "©wrt"
"custom_genre" = "©gen"
"description" = "desc"
"grouping" = "©grp"
"keyword" = "keyw"
"lyricist" = "----:com.apple.iTunes:LYRICIST"
"album_artist" = "aART"
"artist" = "©ART"
"category" = "catg"
"comment" = "©cmt"
"composer" = "©wrt"
"custom_genre" = "©gen"
"description" = "desc"
"grouping" = "©grp"
"keyword" = "keyw"
"lyricist" = "----:com.apple.iTunes:LYRICIST"
"album_artist_sort_order" = "soaa"
"artist_sort_order" = "soar"
"composer_sort_order" = "soco"

[accessors.bool_flags]
"compilation" = "cpil"
Expand Down
Loading