Skip to content

Commit

Permalink
Just adding disc and track number to metadata (#167)
Browse files Browse the repository at this point in the history
* replace frame requires updating position

* formatting (...)

* more (enougj) formating

* bell fix

* Update bell

* Update bell

* Add disc & track number

* add  Episode (podcast) number as well

* initialize discNumber to 0 in podcast
  • Loading branch information
philippe44 authored Jan 15, 2024
1 parent 7e3930d commit 541fed5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cspot/bell
2 changes: 1 addition & 1 deletion cspot/include/TrackQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CDNAudioFile;
// Used in got track info event
struct TrackInfo {
std::string name, album, artist, imageUrl, trackId;
uint32_t duration;
uint32_t duration, number, discNumber;

void loadPbTrack(Track* pbTrack, const std::vector<uint8_t>& gid);
void loadPbEpisode(Episode* pbEpisode, const std::vector<uint8_t>& gid);
Expand Down
3 changes: 3 additions & 0 deletions cspot/protobuf/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ message Artist {
message Track {
optional bytes gid = 1;
optional string name = 2;
optional sint32 number = 5;
optional sint32 disc_number = 6;
optional sint32 duration = 0x7;
optional Album album = 0x3;
repeated Artist artist = 0x4;
Expand All @@ -44,6 +46,7 @@ message Episode {
optional bytes gid = 1;
optional string name = 2;
optional sint32 duration = 7;
optional sint32 number = 65;
repeated AudioFile file = 12;
repeated Restriction restriction = 0x4B;
optional ImageGroup covers = 0x44;
Expand Down
4 changes: 4 additions & 0 deletions cspot/src/TrackQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ void TrackInfo::loadPbTrack(Track* pbTrack, const std::vector<uint8_t>& gid) {
}
}

number = pbTrack->has_number ? pbTrack->number : 0;
discNumber = pbTrack->has_disc_number ? pbTrack->disc_number : 0;
duration = pbTrack->duration;
}

Expand All @@ -113,6 +115,8 @@ void TrackInfo::loadPbEpisode(Episode* pbEpisode,
imageUrl = "https://i.scdn.co/image/" + bytesToHexString(imageId);
}

number = pbEpisode->has_number ? pbEpisode->number : 0;
discNumber = 0;
duration = pbEpisode->duration;
}

Expand Down

0 comments on commit 541fed5

Please sign in to comment.