[tracker-miners/sam/libav-testing: 8/12] tracker-extract-libav: Split musicpiece from musicalbum extraction
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/libav-testing: 8/12] tracker-extract-libav: Split musicpiece from musicalbum extraction
- Date: Wed, 31 Aug 2022 11:07:06 +0000 (UTC)
commit 97c7b98dc1b38b4f36659635945e2ad6d543d4e9
Author: Sam Thursfield <sam thursfield codethink co uk>
Date: Wed Aug 31 11:54:20 2022 +0200
tracker-extract-libav: Split musicpiece from musicalbum extraction
src/tracker-extract/tracker-extract-libav.c | 35 +++++++++++++++++++----------
1 file changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-libav.c b/src/tracker-extract/tracker-extract-libav.c
index cd2df0dea..4c0a223cf 100644
--- a/src/tracker-extract/tracker-extract-libav.c
+++ b/src/tracker-extract/tracker-extract-libav.c
@@ -122,9 +122,7 @@ extract_music_piece_info(TrackerResource *metadata,
AVFormatContext *format,
AVStream *audio_stream)
{
- g_autoptr(TrackerResource) album_artist = NULL, artist = NULL, performer = NULL;
- char *album_artist_name = NULL;
- char *album_title = NULL;
+ g_autoptr(TrackerResource) artist = NULL, performer = NULL;
g_autofree char *content_created = NULL;
AVDictionaryEntry *tag = NULL;
@@ -144,15 +142,6 @@ extract_music_piece_info(TrackerResource *metadata,
}
}
- if ((tag = find_tag (format, audio_stream, NULL, "album"))) {
- album_title = tag->value;
- }
-
- if (album_title && (tag = find_tag (format, audio_stream, NULL, "album_artist"))) {
- album_artist_name = tag->value;
- album_artist = tracker_extract_new_artist (album_artist_name);
- }
-
if ((tag = find_tag (format, audio_stream, NULL, "artist"))) {
artist = tracker_extract_new_artist (tag->value);
}
@@ -181,8 +170,29 @@ extract_music_piece_info(TrackerResource *metadata,
tracker_resource_set_relation (metadata, "nmm:composer", composer);
g_object_unref (composer);
}
+}
+
+static void
+extract_music_album_info(TrackerResource *metadata,
+ AVFormatContext *format,
+ AVStream *audio_stream)
+{
+ g_autoptr(TrackerResource) album_artist = NULL;
+ const char *album_artist_name = NULL;
+ const char *album_title = NULL;
+ AVDictionaryEntry *tag = NULL;
+
+ if ((tag = find_tag (format, audio_stream, NULL, "album"))) {
+ album_title = tag->value;
+ }
+
+ if (album_title && (tag = find_tag (format, audio_stream, NULL, "album_artist"))) {
+ album_artist_name = tag->value;
+ album_artist = tracker_extract_new_artist (album_artist_name);
+ }
if (album_title) {
+ const char *content_created = tracker_resource_get_first_string (metadata,
"nie:contentCreated");
int disc_number = 1;
TrackerResource *album_disc;
@@ -255,6 +265,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info,
extract_video_info (metadata, format, video_stream);
} else if (audio_stream) {
extract_music_piece_info (metadata, format, audio_stream);
+ extract_music_album_info (metadata, format, audio_stream);
}
if (format->bit_rate > 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]