[rygel/wip/create-container: 2/5] WIP
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/create-container: 2/5] WIP
- Date: Sat, 23 Feb 2013 14:07:02 +0000 (UTC)
commit 6105a2d17eef9f62515286dbbd8265fbccdb53e6
Author: Jens Georg <jensg openismus com>
Date: Wed Feb 20 14:27:51 2013 +0100
WIP
src/librygel-server/rygel-media-container.vala | 1 +
src/librygel-server/rygel-writable-container.vala | 4 ++++
.../rygel-media-export-writable-db-container.vala | 16 ++++++++++++++++
3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/librygel-server/rygel-media-container.vala b/src/librygel-server/rygel-media-container.vala
index c1081b9..99094da 100644
--- a/src/librygel-server/rygel-media-container.vala
+++ b/src/librygel-server/rygel-media-container.vala
@@ -67,6 +67,7 @@ public abstract class Rygel.MediaContainer : MediaObject {
public const string MUSIC_ALBUM = UPNP_CLASS + ".album.musicAlbum";
public const string MUSIC_ARTIST = UPNP_CLASS + ".person.musicArtist";
public const string MUSIC_GENRE = UPNP_CLASS + ".genre.musicGenre";
+ public const string PLAYLIST = UPNP_CLASS + ".playlistContainer";
private const string DEFAULT_SORT_CRITERIA = "+upnp:class,+dc:title";
public const string ALBUM_SORT_CRITERIA = "+upnp:class," +
diff --git a/src/librygel-server/rygel-writable-container.vala
b/src/librygel-server/rygel-writable-container.vala
index 48d6056..1c3b47c 100644
--- a/src/librygel-server/rygel-writable-container.vala
+++ b/src/librygel-server/rygel-writable-container.vala
@@ -82,6 +82,10 @@ public interface Rygel.WritableContainer : MediaContainer {
public async abstract void add_item (MediaItem item,
Cancellable? cancellable) throws Error;
+
+ /**
+ * Add a new container directly under this container.
+ *
/**
* Remove an item directly under this container that has the ID @id.
*
diff --git a/src/plugins/media-export/rygel-media-export-writable-db-container.vala
b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
index d8940b9..fc72774 100644
--- a/src/plugins/media-export/rygel-media-export-writable-db-container.vala
+++ b/src/plugins/media-export/rygel-media-export-writable-db-container.vala
@@ -49,6 +49,9 @@ internal class Rygel.MediaExport.WritableDbContainer : TrackableDbContainer,
this.create_classes.add (Rygel.AudioItem.UPNP_CLASS);
this.create_classes.add (Rygel.MusicItem.UPNP_CLASS);
this.create_classes.add (Rygel.PlaylistItem.UPNP_CLASS);
+
+ this.create_classes.add (Rygel.MediaContainer.STORAGE_FOLDER);
+ this.create_classes.add (Rygel.MediaContainer.PLAYLIST);
}
public async void add_item (Rygel.MediaItem item, Cancellable? cancellable)
@@ -63,6 +66,19 @@ internal class Rygel.MediaExport.WritableDbContainer : TrackableDbContainer,
yield this.add_child_tracked (item);
}
+ public async void add_container (MediaContainer container,
+ Cancellable? cancellable)
+ throws Error {
+ container.parent = this;
+ var file = File.new_for_uri (item.uris)) {
+ if (file.is_native () &&
+ container.upnp_class == MediaContainer.STORAGE_FOLDER) {
+ file.mkdir_with_parents (cancellable);
+ }
+ }
+ yield this.add_child_tracked (container);
+ }
+
public async void remove_item (string id, Cancellable? cancellable)
throws Error {
var object = this.media_db.get_object (id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]