summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-03-14 12:51:20 +0100
committerCarlos Garnacho <carlosg@gnome.org>2016-03-14 12:51:20 +0100
commit0ae8c86fb0c763e9dbc05539b99c8d92a9aaeb93 (patch)
treeca0d3876ab8d2ed0e3ec4a5f385cab5a6db51e0f
parent1c5ad8bb308c54b418d1a4895529f8cab069412e (diff)
downloadtracker-0ae8c86fb0c763e9dbc05539b99c8d92a9aaeb93.tar.gz
tracker-extract: Ensure all cue sheet MusicPieces have a nfo:duration
The last entry in the TrackerToc may lack duration information, because it's not specified in the cue file, but is determined from the audio file itself. In this case, fill this info in.
-rw-r--r--src/tracker-extract/tracker-extract-gstreamer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 9c9dd7d42..a419b54c7 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -1013,6 +1013,16 @@ extract_track_metadata (MetadataExtractor *extractor,
if (toc_entry->duration > 0) {
tracker_sparql_builder_predicate (postupdate, "nfo:duration");
tracker_sparql_builder_object_int64 (postupdate, (gint64)toc_entry->duration);
+ } else if (extractor->toc->entry_list &&
+ toc_entry == g_list_last (extractor->toc->entry_list)->data) {
+ /* The last element may not have a duration, because it depends
+ * on the duration of the media file rather than info from the
+ * cue sheet. In this case figure the data out from the total
+ * duration.
+ */
+ tracker_sparql_builder_predicate (postupdate, "nfo:duration");
+ tracker_sparql_builder_object_int64 (postupdate,
+ (gint64) extractor->duration - toc_entry->start);
}
tracker_sparql_builder_predicate (postupdate, "nfo:audioOffset");