[rygel] media-export: Provide a custom MediaItem class
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Subject: [rygel] media-export: Provide a custom MediaItem class
- Date: Fri, 5 Jun 2009 12:02:39 -0400 (EDT)
commit 47f08e65c39982f3b51530cb1cb7620e1bd0b67a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Jun 4 19:40:28 2009 +0300
media-export: Provide a custom MediaItem class
---
src/plugins/media-export/Makefile.am | 3 ++
...rygel-media-export-directory-search-result.vala | 35 +-------------------
2 files changed, 4 insertions(+), 34 deletions(-)
diff --git a/src/plugins/media-export/Makefile.am b/src/plugins/media-export/Makefile.am
index 0dba7fe..8a6182e 100644
--- a/src/plugins/media-export/Makefile.am
+++ b/src/plugins/media-export/Makefile.am
@@ -12,6 +12,7 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
BUILT_SOURCES = rygel-media-export-root-container.c \
rygel-media-export-container.c \
+ rygel-media-export-item.c \
rygel-media-export-directory-search-result.c \
rygel-media-export-plugin.c
@@ -24,6 +25,8 @@ librygel_media_media_export_la_SOURCES = \
rygel-media-export-root-container.vala \
rygel-media-export-container.c \
rygel-media-export-container.vala \
+ rygel-media-export-item.c \
+ rygel-media-export-item.vala \
rygel-media-export-directory-search-result.c \
rygel-media-export-directory-search-result.vala
diff --git a/src/plugins/media-export/rygel-media-export-directory-search-result.vala b/src/plugins/media-export/rygel-media-export-directory-search-result.vala
index 18e1602..f1ba194 100644
--- a/src/plugins/media-export/rygel-media-export-directory-search-result.vala
+++ b/src/plugins/media-export/rygel-media-export-directory-search-result.vala
@@ -67,7 +67,7 @@ public class Rygel.MediaExportDirectorySearchResult :
f);
} else {
- media_obj = get_media_item (
+ media_obj = new Rygel.MediaExportItem (
(MediaContainer) source_object,
f,
file_info);
@@ -115,38 +115,5 @@ public class Rygel.MediaExportDirectorySearchResult :
return children;
}
-
- private MediaItem? get_media_item (MediaContainer parent,
- File file,
- FileInfo info) {
- string content_type = info.get_content_type ();
- string item_class = null;
- string id = Checksum.compute_for_string (ChecksumType.MD5,
- info.get_name ());
-
- // use heuristics based on content type; will use MediaHarvester
- // when it's ready
-
- if (content_type.has_prefix ("video/")) {
- item_class = MediaItem.VIDEO_CLASS;
- } else if (content_type.has_prefix ("audio/")) {
- item_class = MediaItem.AUDIO_CLASS;
- } else if (content_type.has_prefix ("image/")) {
- item_class = MediaItem.IMAGE_CLASS;
- }
-
- if (null == item_class) {
- return null;
- }
-
- MediaItem item = new Rygel.MediaItem (id,
- parent,
- info.get_name (),
- item_class);
- item.mime_type = content_type;
- item.uris.add (file.get_uri ());
-
- return item;
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]