[rygel/wip/dvd: 96/103] wip: Hook up DVD analyzer with new extract binary
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/dvd: 96/103] wip: Hook up DVD analyzer with new extract binary
- Date: Wed, 16 Sep 2015 12:25:14 +0000 (UTC)
commit 739b646484b314f02adc1c00f767e96cc840094d
Author: Jens Georg <mail jensge org>
Date: Sun Aug 9 03:58:15 2015 +0200
wip: Hook up DVD analyzer with new extract binary
Signed-off-by: Jens Georg <mail jensge org>
src/plugins/media-export/Makefile.am | 4 ++--
.../rygel-media-export-dvd-parser.vala | 12 +++++++++---
.../media-export/rygel-media-export-extract.vala | 17 ++++++++++++-----
.../rygel-media-export-info-serializer.vala | 2 ++
4 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/media-export/Makefile.am b/src/plugins/media-export/Makefile.am
index adf651b..483b90e 100644
--- a/src/plugins/media-export/Makefile.am
+++ b/src/plugins/media-export/Makefile.am
@@ -10,7 +10,8 @@ include $(top_srcdir)/common.am
pkglibexec_PROGRAMS = mx-extract
mx_extract_SOURCES = \
rygel-media-export-extract.vala \
- rygel-media-export-info-serializer.vala
+ rygel-media-export-info-serializer.vala \
+ rygel-media-export-dvd-parser.vala
mx_extract_VALAFLAGS = \
--enable-experimental \
@@ -33,7 +34,6 @@ plugin_DATA = media-export.plugin
librygel_media_export_la_SOURCES = \
rygel-media-export-plugin.vala \
- rygel-media-export-dvd-parser.vala \
rygel-media-export-db-container.vala \
rygel-media-export-sql-factory.vala \
rygel-media-export-media-cache.vala \
diff --git a/src/plugins/media-export/rygel-media-export-dvd-parser.vala
b/src/plugins/media-export/rygel-media-export-dvd-parser.vala
index 19e9993..f9af718 100644
--- a/src/plugins/media-export/rygel-media-export-dvd-parser.vala
+++ b/src/plugins/media-export/rygel-media-export-dvd-parser.vala
@@ -20,11 +20,12 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-internal class Rygel.MediaExport.DVDParser : GLib.Object {
+internal class Rygel.DVDParser : GLib.Object {
/// URI to the image / toplevel directory
public File file { public get; construct; }
private File cache_file;
+ private string id;
public DVDParser (File file) {
Object (file : file);
@@ -32,12 +33,12 @@ internal class Rygel.MediaExport.DVDParser : GLib.Object {
public override void constructed () {
unowned string user_cache = Environment.get_user_cache_dir ();
+ this.id = this.get_id (this.file);
var cache_folder = Path.build_filename (user_cache,
"rygel",
"dvd-content");
DirUtils.create_with_parents (cache_folder, 0700);
- var cache_path = Path.build_filename (cache_folder,
- MediaCache.get_id (this.file));
+ var cache_path = Path.build_filename (cache_folder, this.id);
this.cache_file = File.new_for_path (cache_path);
}
@@ -123,4 +124,9 @@ internal class Rygel.MediaExport.DVDParser : GLib.Object {
return null;
}
+
+ private string get_id (File file) {
+ return Checksum.compute_for_string (ChecksumType.MD5,
+ file.get_uri ());
+ }
}
diff --git a/src/plugins/media-export/rygel-media-export-extract.vala
b/src/plugins/media-export/rygel-media-export-extract.vala
index 2ff25da..e0b735b 100644
--- a/src/plugins/media-export/rygel-media-export-extract.vala
+++ b/src/plugins/media-export/rygel-media-export-extract.vala
@@ -33,6 +33,7 @@ const string UPNP_CLASS_PHOTO = "object.item.imageItem.photo";
const string UPNP_CLASS_MUSIC = "object.item.audioItem.musicTrack";
const string UPNP_CLASS_VIDEO = "object.item.videoItem";
const string UPNP_CLASS_PLAYLIST = "object.item.playlistItem";
+const string UPNP_CLASS_PLAYLIST_CONTAINER = "object.container.playlistContainer";
const string STATUS_LINE_TEMPLATE = "RESULT|%s|%" + size_t.FORMAT + "|%s\n";
const string ERROR_LINE_TEMPLATE = "ERROR|%s|%d|%s\n";
@@ -101,12 +102,18 @@ async void run () {
GLib.Memory.copy (last_uri.data,
(void *) parts[0],
parts[0].length);
- var is_text = parts[1].has_prefix ("text/") ||
- parts[1].has_suffix ("xml");
- if (metadata && !is_text) {
- info = discoverer.discover_uri (parts[0]);
-
- debug ("Finished discover on URI %s", parts[0]);
+ if (metadata) {
+ var is_text = parts[1].has_prefix ("text/") ||
+ parts[1].has_suffix ("xml");
+ if (parts[1] == "application/x-cd-image") {
+ var file = File.new_for_uri (parts[0]);
+ var parser = new Rygel.DVDParser (file);
+ yield parser.run ();
+ } else if (!is_text) {
+ info = discoverer.discover_uri (parts[0]);
+
+ debug ("Finished discover on URI %s", parts[0]);
+ }
}
yield process_meta_data (parts[0], info);
} catch (Error error) {
diff --git a/src/plugins/media-export/rygel-media-export-info-serializer.vala
b/src/plugins/media-export/rygel-media-export-info-serializer.vala
index 906d819..40b8c86 100644
--- a/src/plugins/media-export/rygel-media-export-info-serializer.vala
+++ b/src/plugins/media-export/rygel-media-export-info-serializer.vala
@@ -87,6 +87,8 @@ internal class Rygel.InfoSerializer : GLib.Object {
upnp_class = UPNP_CLASS_MUSIC;
} else if (mime.has_suffix ("/xml")) { // application/xml or text/xml
upnp_class = UPNP_CLASS_PLAYLIST;
+ } else if (mime == "application/x-cd-image") {
+ upnp_class = UPNP_CLASS_PLAYLIST_CONTAINER;
} else {
debug ("Unsupported content-type %s, skipping %s…",
mime,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]