Tags: Expose Composer tag through interfaces

Implement the composer field interface to playlist item tag
reading and writing.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2023-09-02 20:14:30 -07:00
parent 1bffcaa429
commit a3c8149612
No known key found for this signature in database
4 changed files with 20 additions and 2 deletions

View file

@ -79,6 +79,7 @@
@property(nonatomic) NSString *_Nullable artist;
@property(nonatomic) NSString *_Nullable rawTitle;
@property(nonatomic) NSString *_Nullable genre;
@property(nonatomic) NSString *_Nullable composer;
@property(nonatomic) int32_t disc;
@property(nonatomic) int32_t track;
@property(nonatomic) int32_t year;

View file

@ -686,6 +686,15 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path) {
[self setValue:@"artist" fromString:artist];
}
@dynamic composer;
- (NSString *)composer {
return [self readAllValuesAsString:@"composer"];
}
- (void)setComposer:(NSString *)composer {
[self setValue:@"composer" fromString:composer];
}
@dynamic rawTitle;
- (NSString *)rawTitle {
return [self readAllValuesAsString:@"title"];

View file

@ -60,7 +60,7 @@
const TagLib::Tag *tag = f.tag();
if(tag) {
TagLib::String artist, albumartist, title, album, genre, comment, unsyncedlyrics;
TagLib::String artist, albumartist, composer, title, album, genre, comment, unsyncedlyrics;
int year, track, disc;
float rgAlbumGain, rgAlbumPeak, rgTrackGain, rgTrackPeak;
TagLib::String cuesheet;
@ -68,6 +68,7 @@
artist = tag->artist();
albumartist = tag->albumartist();
composer = tag->composer();
title = tag->title();
album = tag->album();
genre = tag->genre();
@ -117,6 +118,9 @@
if(!albumartist.isEmpty())
[dict setObject:[NSString stringWithUTF8String:albumartist.toCString(true)] forKey:@"albumartist"];
if(!composer.isEmpty())
[dict setObject:[NSString stringWithUTF8String:composer.toCString(true)] forKey:@"composer"];
if(!album.isEmpty())
[dict setObject:[NSString stringWithUTF8String:album.toCString(true)] forKey:@"album"];

View file

@ -73,7 +73,7 @@
const TagLib::Tag *tag = f.tag();
if(tag) {
TagLib::String artist, albumartist, title, album, genre, comment, unsyncedlyrics;
TagLib::String artist, albumartist, composer, title, album, genre, comment, unsyncedlyrics;
int year, track, disc;
float rgAlbumGain, rgAlbumPeak, rgTrackGain, rgTrackPeak;
TagLib::String cuesheet;
@ -81,6 +81,7 @@
artist = tag->artist();
albumartist = tag->albumartist();
composer = tag->composer();
title = tag->title();
;
album = tag->album();
@ -132,6 +133,9 @@
if(!albumartist.isEmpty())
[dict setObject:[NSString stringWithUTF8String:albumartist.toCString(true)] forKey:@"albumartist"];
if(!composer.isEmpty())
[dict setObject:[NSString stringWithUTF8String:composer.toCString(true)] forKey:@"composer"];
if(!album.isEmpty())
[dict setObject:[NSString stringWithUTF8String:album.toCString(true)] forKey:@"album"];