[tracker] tracker-extract: Ensure all cue sheet MusicPieces have a nfo:duration
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract: Ensure all cue sheet MusicPieces have a nfo:duration
- Date: Mon, 14 Mar 2016 22:28:55 +0000 (UTC)
commit 0ae8c86fb0c763e9dbc05539b99c8d92a9aaeb93
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 14 12:51:20 2016 +0100
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.
src/tracker-extract/tracker-extract-gstreamer.c | 10 ++++++++++
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 9c9dd7d..a419b54 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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]