[tracker-miners/sam/libav-testing: 10/12] tracker-extract-libav: Extract albumTrackCount for Vorbis metadata
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/libav-testing: 10/12] tracker-extract-libav: Extract albumTrackCount for Vorbis metadata
- Date: Wed, 31 Aug 2022 10:54:12 +0000 (UTC)
commit 65cfaec06a99f07ecea012961175fb60d9402ba7
Author: Sam Thursfield <sam thursfield codethink co uk>
Date: Wed Aug 31 12:36:38 2022 +0200
tracker-extract-libav: Extract albumTrackCount for Vorbis metadata
src/tracker-extract/tracker-extract-libav.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/src/tracker-extract/tracker-extract-libav.c b/src/tracker-extract/tracker-extract-libav.c
index 80c005cc8..00f7f616f 100644
--- a/src/tracker-extract/tracker-extract-libav.c
+++ b/src/tracker-extract/tracker-extract-libav.c
@@ -281,6 +281,7 @@ extract_music_album_info(const gchar *uri,
const char *album_title = NULL;
const char *content_created;
int disc_number = 1;
+ int album_track_count = 0;
AVDictionaryEntry *tag = NULL;
if ((tag = find_tag (format, audio_stream, "album"))) {
@@ -308,6 +309,21 @@ extract_music_album_info(const gchar *uri,
tracker_resource_set_relation (metadata, "nmm:musicAlbumDisc", album_disc);
tracker_resource_set_relation (metadata, "nmm:musicAlbum", tracker_resource_get_first_relation
(album_disc, "nmm:albumDiscAlbum"));
+ /* There is no officially specified 'total tracks' field, these two names
+ * are taken from MusicBrainz Picard tag mapping for Vorbis comments.
+ *
+ * https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html
+ */
+ if ((tag = find_tag (format, audio_stream, "TOTALTRACKS"))) {
+ album_track_count = atoi (tag->value);
+ } else if ((tag = find_tag (format, audio_stream, "TRACKTOTAL"))) {
+ album_track_count = atoi (tag->value);
+ }
+
+ if (album_track_count > 0) {
+ tracker_resource_set_int (album, "nmm:albumTrackCount", album_track_count);
+ }
+
if ((tag = find_tag (format, audio_stream, "MUSICBRAINZ_ALBUMID"))) {
const char *mb_release_id = tag->value;
g_autofree char *mb_release_uri = g_strdup_printf("https://musicbrainz.org/release/%s",
mb_release_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]