diff options
author | Ludovic Ferrandis <ludovic.ferrandis@intel.com> | 2013-03-27 14:19:22 +0100 |
---|---|---|
committer | Ludovic Ferrandis <ludovic.ferrandis@intel.com> | 2013-05-14 15:12:55 +0200 |
commit | 8adb58d6e787482fa57beb1b28f5542270d40781 (patch) | |
tree | b2d02aff4f9df54b4cabf77b2991f49cc22d18f3 | |
parent | a9010e5e993c3eea826d5539de444d8a3585a00f (diff) | |
download | dleyna-server-8adb58d6e787482fa57beb1b28f5542270d40781.tar.gz |
[API] Remove CreatePlaylist/CreatePlaylistInAny API
Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
-rw-r--r-- | doc/server/dbus/API.txt | 30 | ||||
-rw-r--r-- | libdleyna/server/async.c | 6 | ||||
-rw-r--r-- | libdleyna/server/async.h | 8 | ||||
-rw-r--r-- | libdleyna/server/device.c | 424 | ||||
-rw-r--r-- | libdleyna/server/device.h | 4 | ||||
-rw-r--r-- | libdleyna/server/interface.h | 8 | ||||
-rw-r--r-- | libdleyna/server/server.c | 49 | ||||
-rw-r--r-- | libdleyna/server/task.c | 37 | ||||
-rw-r--r-- | libdleyna/server/task.h | 18 | ||||
-rw-r--r-- | libdleyna/server/upnp.c | 105 | ||||
-rw-r--r-- | libdleyna/server/upnp.h | 8 | ||||
-rw-r--r-- | test/dbus/mediaconsole.py | 14 |
12 files changed, 2 insertions, 709 deletions
diff --git a/doc/server/dbus/API.txt b/doc/server/dbus/API.txt index 920e2dc..7a3b770 100644 --- a/doc/server/dbus/API.txt +++ b/doc/server/dbus/API.txt @@ -249,7 +249,7 @@ is emitted when this property changes. Methods: --------- -The com.intel.dLeynaServer.MediaDevice interface currently exposes seven methods: +The com.intel.dLeynaServer.MediaDevice interface currently exposes six methods: UploadToAnyContainer(s DisplayName, s FilePath) -> (u UploadId, o ObjectPath) @@ -273,20 +273,6 @@ A special value of ['*'] indicates that no restriction is placed on the types of objects that can be stored in the container. The path of the newly created object is returned. -CreatePlayListInAnyContainer(s Title, s Creator, s Genre, s Desc, - ao PlaylistItems ) -> (u UploadId, o ObjectPath) - -Create a new Playlist. The DMS chooses the best place to create this new -container. Title is the name of the Playlist, Creator is the name of the -creator of the Playlist, Genre is the genre of the playlist, Desc is a short -description of the playlist and PlaylistItems is an array of Item path to be -added in the playlist. Creator, Genre and Desc are optional, you can pass -empty strings for these parameters. -The successful completion of this method indicates that the upload has begun, -but has not necessarily finished. There are two return values. The UploadId, -which can be used to monitor the progress of the upload and to -cancel it and ObjectPath, which contains the path of the newly created object. - GetUploadStatus(u UploadId) -> (s UploadStatus, t Length, t Total) GetUploadStatus returns the current status of an upload previously @@ -601,7 +587,7 @@ in Resources/Additional properties. New Methods: ------------ -Eight new methods have been added. These methods are: +Seven new methods have been added. These methods are: ListChildrenEx(u Offset, u Max, as Filter, s SortBy) -> aa{sv} @@ -615,9 +601,6 @@ Upload(s DisplayName, s FilePath) -> (u UploadId, o ObjectPath) CreateContainer(s DisplayName, s Type, as ChildTypes) -> o ObjectPath -CreatePlayList(s Title, s Creator, s Genre, s Desc, ao PlaylistItems ) - -> (u UploadId, o ObjectPath) - GetCompatibleResources(s protocol_info, as filter) -> a{sv} The first four methods are identical in function and behaviour to @@ -689,15 +672,6 @@ A special value of ['*'] indicates that no restriction is placed on the types of objects that can be stored in the container. The path of the newly created object is returned. -The CreatePlayList method allows the creation of a playlist to -the org.gnome.UPnP.MediaContainer2 object upon which it was executed. -It is identical in function and behavior to -com.intel.dLeynaServer.MediaDevice CreatePlaylistInAnyContainer with the sole -exception that CreatePlayList allows the client to specify the server-side -container into which the Playlist is to be uploaded whereas -CreatePlaylistInAnyContainer leaves it up to the server to determine the most -suitable location for the file. - The GetCompatibleResources method: see description in MediaItem2. Recommended Usage: diff --git a/libdleyna/server/async.c b/libdleyna/server/async.c index fcdbe9a..324e8ee 100644 --- a/libdleyna/server/async.c +++ b/libdleyna/server/async.c @@ -47,12 +47,6 @@ void dls_async_task_delete(dls_async_task_t *cb_data) g_free(cb_data->ut.update.current_tag_value); g_free(cb_data->ut.update.new_tag_value); break; - case DLS_TASK_CREATE_PLAYLIST: - case DLS_TASK_CREATE_PLAYLIST_IN_ANY: - g_free(cb_data->ut.playlist.didl); - if (cb_data->ut.playlist.collection) - g_object_unref(cb_data->ut.playlist.collection); - break; default: break; } diff --git a/libdleyna/server/async.h b/libdleyna/server/async.h index 8efb8c5..e14db6e 100644 --- a/libdleyna/server/async.h +++ b/libdleyna/server/async.h @@ -77,13 +77,6 @@ struct dls_async_update_t_ { GHashTable *map; }; -typedef struct dls_async_playlist_t_ dls_async_playlist_t; -struct dls_async_playlist_t_ { - const dleyna_task_queue_key_t *queue_id; - GUPnPMediaCollection *collection; - gchar *didl; -}; - struct dls_async_task_t_ { dls_task_t task; /* pseudo inheritance - MUST be first field */ dls_upnp_task_complete_t cb; @@ -98,7 +91,6 @@ struct dls_async_task_t_ { dls_async_get_all_t get_all; dls_async_upload_t upload; dls_async_update_t update; - dls_async_playlist_t playlist; } ut; }; diff --git a/libdleyna/server/device.c b/libdleyna/server/device.c index bccee4f..e275294 100644 --- a/libdleyna/server/device.c +++ b/libdleyna/server/device.c @@ -91,13 +91,6 @@ struct prv_new_device_ct_t_ { GHashTable *property_map; }; -typedef struct prv_new_playlist_ct_t_ prv_new_playlist_ct_t; -struct prv_new_playlist_ct_t_ { - dls_async_task_t *cb_data; - gchar *id; - gchar *parent_id; -}; - static void prv_get_child_count(dls_async_task_t *cb_data, dls_device_count_cb_t cb, const gchar *id); static void prv_retrieve_child_count_for_list(dls_async_task_t *cb_data); @@ -4061,423 +4054,6 @@ void dls_device_update_object(dls_client_t *client, DLEYNA_LOG_DEBUG("Exit"); } -static void prv_didls_free(gpointer data) -{ - prv_new_playlist_ct_t *priv_t = (prv_new_playlist_ct_t *)data; - - if (priv_t) { - g_free(priv_t->id); - g_free(priv_t->parent_id); - g_free(priv_t); - } -} - -static void prv_playlist_upload_cb(GUPnPServiceProxy *proxy, - GUPnPServiceProxyAction *action, - gpointer user_data) -{ - dls_async_task_t *cb_data = user_data; - gchar *didls; - - didls = gupnp_media_collection_get_string( - cb_data->ut.playlist.collection); - - DLEYNA_LOG_DEBUG_NL(); - DLEYNA_LOG_DEBUG("Collection: %s", didls); - DLEYNA_LOG_DEBUG_NL(); - - prv_generic_upload_cb(cb_data, NULL, didls, strlen(didls), "text/xml"); -} - -static void prv_create_didls_item_parse_object(GUPnPDIDLLiteParser *parser, - GUPnPDIDLLiteObject *object, - gpointer user_data) -{ - const char *class; - const char *title; - const char *artist; - const char *album; - const char *uri = NULL; - GList *resources; - GUPnPDIDLLiteObject *item_obj; - GUPnPDIDLLiteItem *item; - GUPnPDIDLLiteResource *res; - GUPnPMediaCollection *collection = user_data; - - if (GUPNP_IS_DIDL_LITE_CONTAINER(object)) - goto exit; - - class = gupnp_didl_lite_object_get_upnp_class(object); - title = gupnp_didl_lite_object_get_title(object); - artist = gupnp_didl_lite_object_get_artist(object); - album = gupnp_didl_lite_object_get_album(object); - resources = gupnp_didl_lite_object_get_resources(object); - - if (resources != NULL) { - if (resources->data != NULL) - uri = gupnp_didl_lite_resource_get_uri(resources->data); - - g_list_free_full(resources, g_object_unref); - } - - DLEYNA_LOG_DEBUG("Create DIDL_S Item"); - DLEYNA_LOG_DEBUG("title: %s", title); - DLEYNA_LOG_DEBUG("class: %s", class); - DLEYNA_LOG_DEBUG("Artist: %s", artist); - DLEYNA_LOG_DEBUG("album: %s", album); - DLEYNA_LOG_DEBUG("URI: %s", uri); - DLEYNA_LOG_DEBUG_NL(); - - item = gupnp_media_collection_add_item(collection); - item_obj = GUPNP_DIDL_LITE_OBJECT(item); - - if (title && *title) - gupnp_didl_lite_object_set_title(item_obj, title); - - if (class && *class) - gupnp_didl_lite_object_set_upnp_class(item_obj, class); - - if (artist && *artist) - gupnp_didl_lite_object_set_artist(item_obj, artist); - - if (album && *album) - gupnp_didl_lite_object_set_album(item_obj, album); - - if (uri && *uri) { - res = gupnp_didl_lite_object_add_resource(item_obj); - gupnp_didl_lite_resource_set_uri(res, uri); - g_object_unref(res); - } - - g_object_unref(item); - -exit: - return; -} - -static void prv_create_didls_item_browse_cb(GUPnPServiceProxy *proxy, - GUPnPServiceProxyAction *action, - gpointer user_data) -{ - GError *error = NULL; - prv_new_playlist_ct_t *priv_t = user_data; - dls_async_task_t *cb_data = priv_t->cb_data; - GUPnPDIDLLiteParser *parser = NULL; - gchar *result = NULL; - const gchar *message; - gboolean end; - - end = gupnp_service_proxy_end_action(proxy, action, &error, - "Result", G_TYPE_STRING, - &result, NULL); - - if (!end || (result == NULL)) { - message = (error != NULL) ? error->message : "Invalid result"; - DLEYNA_LOG_WARNING("Browse Object operation failed: %s", - message); - DLEYNA_LOG_DEBUG_NL(); - - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_OPERATION_FAILED, - "Browse operation failed: %s", - message); - goto on_exit; - } - - DLEYNA_LOG_DEBUG_NL(); - DLEYNA_LOG_DEBUG("Result: %s", result); - DLEYNA_LOG_DEBUG_NL(); - - parser = gupnp_didl_lite_parser_new(); - - g_signal_connect(parser, "object-available", - G_CALLBACK(prv_create_didls_item_parse_object), - cb_data->ut.playlist.collection); - - if (gupnp_didl_lite_parser_parse_didl(parser, result, &error)) - goto on_exit; - - if (error->code == GUPNP_XML_ERROR_EMPTY_NODE) { - DLEYNA_LOG_WARNING("Property not defined for object"); - - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_UNKNOWN_PROPERTY, - "Property not defined for object"); - } else { - DLEYNA_LOG_WARNING("Unable to parse results of browse: %s", - error->message); - - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_OPERATION_FAILED, - "Unable to parse results of browse: %s", - error->message); - } - -on_exit: - - if (cb_data->error != NULL) - dleyna_task_processor_cancel_queue( - cb_data->ut.playlist.queue_id); - - if (parser) - g_object_unref(parser); - - if (error) - g_error_free(error); - - g_free(result); -} - -static GUPnPServiceProxyAction *prv_create_didls_item_browse( - dleyna_service_task_t *task, - GUPnPServiceProxy *proxy, - gboolean *failed) -{ - prv_new_playlist_ct_t *priv_t; - - priv_t = (prv_new_playlist_ct_t *)dleyna_service_task_get_user_data( - task); - *failed = FALSE; - - DLEYNA_LOG_DEBUG("Browse for ID: %s", priv_t->id); - - return gupnp_service_proxy_begin_action( - proxy, "Browse", - dleyna_service_task_begin_action_cb, task, - "ObjectID", G_TYPE_STRING, priv_t->id, - "BrowseFlag", G_TYPE_STRING, "BrowseMetadata", - "Filter", G_TYPE_STRING, "upnp:artist,upnp:album,res", - "StartingIndex", G_TYPE_INT, 0, - "RequestedCount", G_TYPE_INT, 1, - "SortCriteria", G_TYPE_STRING, "", NULL); -} - -static gboolean prv_create_chain_didls_items(dls_task_t *task, - GUPnPServiceProxy *proxy, - dls_async_task_t *cb_data) -{ - gchar *root_path = NULL; - gchar *path; - gchar *id = NULL; - prv_new_playlist_ct_t *priv_t; - dls_async_playlist_t *a_playlist = &cb_data->ut.playlist; - GVariantIter iter; - - DLEYNA_LOG_DEBUG_NL(); - - a_playlist->collection = gupnp_media_collection_new(); - gupnp_media_collection_set_title(a_playlist->collection, - task->ut.playlist.title); - gupnp_media_collection_set_author(a_playlist->collection, - task->ut.playlist.creator); - - g_variant_iter_init(&iter, task->ut.playlist.item_path); - - while (g_variant_iter_next(&iter, "&o", &path)) { - if (!dls_path_get_path_and_id(path, &root_path, &id, NULL)) { - DLEYNA_LOG_DEBUG("Can't get id for path %s", path); - cb_data->error = g_error_new( - DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_OBJECT_NOT_FOUND, - "Unable to find object for path: %s", - path); - goto on_error; - } - - DLEYNA_LOG_DEBUG("Create Task: @id: %s - Root: %s", - id, root_path); - - g_free(root_path); - - priv_t = g_new0(prv_new_playlist_ct_t, 1); - priv_t->cb_data = cb_data; - priv_t->id = id; - - dleyna_service_task_add(a_playlist->queue_id, - prv_create_didls_item_browse, - proxy, - prv_create_didls_item_browse_cb, - prv_didls_free, priv_t); - } - - DLEYNA_LOG_DEBUG_NL(); - return TRUE; - -on_error: - - return FALSE; -} - -static void prv_create_playlist_object(dls_task_create_playlist_t *t_playlist, - dls_async_playlist_t *a_playlist, - char *parent_id) -{ - GUPnPDIDLLiteWriter *writer; - GUPnPDIDLLiteObject *item; - GUPnPProtocolInfo *protocol_info; - GUPnPDIDLLiteResource *res; - GUPnPDIDLLiteContributor *creator; - GUPnPDIDLLiteContributor *author; - GTimeVal time_v; - gchar *time_c; - - writer = gupnp_didl_lite_writer_new(NULL); - item = GUPNP_DIDL_LITE_OBJECT(gupnp_didl_lite_writer_add_item(writer)); - - gupnp_didl_lite_object_set_id(item, ""); - gupnp_didl_lite_object_set_title(item, t_playlist->title); - gupnp_didl_lite_object_set_genre(item, t_playlist->genre); - gupnp_didl_lite_object_set_description(item, t_playlist->desc); - - creator = gupnp_didl_lite_object_add_creator(item); - author = gupnp_didl_lite_object_add_author(item); - gupnp_didl_lite_contributor_set_name(creator, t_playlist->creator); - gupnp_didl_lite_contributor_set_name(author, t_playlist->creator); - - gupnp_didl_lite_object_set_parent_id(item, parent_id); - gupnp_didl_lite_object_set_upnp_class(item, "object.item.playlistItem"); - gupnp_didl_lite_object_set_restricted(item, FALSE); - - protocol_info = gupnp_protocol_info_new(); - gupnp_protocol_info_set_mime_type(protocol_info, "text/xml"); - gupnp_protocol_info_set_protocol(protocol_info, "*"); - gupnp_protocol_info_set_network(protocol_info, "*"); - gupnp_protocol_info_set_dlna_profile(protocol_info, "DIDL_S"); - - res = gupnp_didl_lite_object_add_resource(item); - gupnp_didl_lite_resource_set_protocol_info(res, protocol_info); - - g_get_current_time(&time_v); - time_c = g_time_val_to_iso8601(&time_v); - gupnp_didl_lite_object_set_date(item, time_c); - - /* TODO: Need to compute DLNA Profile */ - - a_playlist->didl = gupnp_didl_lite_writer_get_string(writer); - - DLEYNA_LOG_DEBUG("Playlist object %s created", t_playlist->title); - - g_object_unref(res); - g_object_unref(protocol_info); - g_object_unref(creator); - g_object_unref(author); - g_object_unref(item); - g_object_unref(writer); - g_free(time_c); -} - -static void prv_create_didls_chain_end(gboolean cancelled, gpointer data) -{ - prv_new_playlist_ct_t *priv_t = data; - dls_async_task_t *cb_data = priv_t->cb_data; - dls_async_playlist_t *a_playlist; - dls_task_create_playlist_t *t_playlist; - - DLEYNA_LOG_DEBUG("Enter"); - - if (cb_data->cancel_id) { - if (!g_cancellable_is_cancelled(cb_data->cancellable)) - g_cancellable_disconnect(cb_data->cancellable, - cb_data->cancel_id); - cb_data->cancel_id = 0; - } - - if (cancelled) - goto on_clear; - - t_playlist = &cb_data->task.ut.playlist; - a_playlist = &cb_data->ut.playlist; - prv_create_playlist_object(t_playlist, a_playlist, priv_t->parent_id); - - DLEYNA_LOG_DEBUG("Creating object"); - cb_data->action = gupnp_service_proxy_begin_action( - cb_data->proxy, - "CreateObject", - prv_playlist_upload_cb, cb_data, - "ContainerID", G_TYPE_STRING, priv_t->parent_id, - "Elements", G_TYPE_STRING, a_playlist->didl, - NULL); - - cb_data->cancel_id = g_cancellable_connect( - cb_data->cancellable, - G_CALLBACK(dls_async_task_cancelled_cb), - cb_data, NULL); -on_clear: - - if (cancelled) { - if (!cb_data->error) - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_CANCELLED, - "Operation cancelled."); - (void) g_idle_add(dls_async_task_complete, cb_data); - } - - prv_didls_free(priv_t); - - cb_data->ut.playlist.queue_id = NULL; - - DLEYNA_LOG_DEBUG("Exit"); -} - -static void prv_create_chain_cancelled(GCancellable *cancellable, - gpointer user_data) -{ - dls_async_task_t *cb_data = user_data; - const dleyna_task_queue_key_t *queue_id = cb_data->ut.playlist.queue_id; - - DLEYNA_LOG_DEBUG("Enter"); - - dleyna_task_processor_cancel_queue(queue_id); -} - -void dls_device_playlist_upload(dls_client_t *client, - dls_task_t *task, - const gchar *parent_id) -{ - dls_async_task_t *cb_data = (dls_async_task_t *)task; - dls_device_context_t *context; - prv_new_playlist_ct_t *priv_t; - const dleyna_task_queue_key_t *queue_id; - - DLEYNA_LOG_DEBUG("Enter"); - DLEYNA_LOG_DEBUG("Uploading playlist to %s", parent_id); - - priv_t = g_new0(prv_new_playlist_ct_t, 1); - priv_t->cb_data = cb_data; - priv_t->parent_id = g_strdup(parent_id); - - queue_id = dleyna_task_processor_add_queue( - dls_server_get_task_processor(), - dleyna_service_task_create_source(), - DLS_SERVER_SINK, - DLEYNA_TASK_QUEUE_FLAG_AUTO_REMOVE, - dleyna_service_task_process_cb, - dleyna_service_task_cancel_cb, - dleyna_service_task_delete_cb); - dleyna_task_queue_set_finally(queue_id, prv_create_didls_chain_end); - dleyna_task_queue_set_user_data(queue_id, priv_t); - - context = dls_device_get_context(task->target.device, client); - - cb_data->proxy = context->service_proxy; - cb_data->ut.playlist.queue_id = queue_id; - - g_object_add_weak_pointer((G_OBJECT(context->service_proxy)), - (gpointer *)&cb_data->proxy); - - if (prv_create_chain_didls_items(task, cb_data->proxy, cb_data)) { - cb_data->cancel_id = g_cancellable_connect( - cb_data->cancellable, - G_CALLBACK(prv_create_chain_cancelled), - cb_data, NULL); - dleyna_task_queue_start(queue_id); - } else { - (void) g_idle_add(dls_async_task_complete, cb_data); - } - - DLEYNA_LOG_DEBUG("Exit"); -} - static void prv_get_object_metadata_cb(GUPnPServiceProxy *proxy, GUPnPServiceProxyAction *action, gpointer user_data) diff --git a/libdleyna/server/device.h b/libdleyna/server/device.h index 9a47c6e..d657f37 100644 --- a/libdleyna/server/device.h +++ b/libdleyna/server/device.h @@ -131,10 +131,6 @@ void dls_device_update_object(dls_client_t *client, dls_task_t *task, const gchar *upnp_filter); -void dls_device_playlist_upload(dls_client_t *client, - dls_task_t *task, - const gchar *parent_id); - void dls_device_get_object_metadata(dls_client_t *client, dls_task_t *task, const gchar *parent_id); diff --git a/libdleyna/server/interface.h b/libdleyna/server/interface.h index d845ee8..9a8a337 100644 --- a/libdleyna/server/interface.h +++ b/libdleyna/server/interface.h @@ -183,14 +183,6 @@ enum dls_interface_type_ { #define DLS_INTERFACE_TO_DELETE "ToDelete" #define DLS_INTERFACE_CANCEL "Cancel" -#define DLS_INTERFACE_CREATE_PLAYLIST "CreatePlaylist" -#define DLS_INTERFACE_CREATE_PLAYLIST_TO_ANY "CreatePlaylistInAnyContainer" -#define DLS_INTERFACE_TITLE "Title" -#define DLS_INTERFACE_CREATOR "Creator" -#define DLS_INTERFACE_GENRE "Genre" -#define DLS_INTERFACE_DESCRIPTION "Description" -#define DLS_INTERFACE_PLAYLIST_ITEMS "PlaylistItems" - #define DLS_INTERFACE_GET_METADATA "GetMetaData" #define DLS_INTERFACE_METADATA "MetaData" diff --git a/libdleyna/server/server.c b/libdleyna/server/server.c index 9dd45f5..7b9705c 100644 --- a/libdleyna/server/server.c +++ b/libdleyna/server/server.c @@ -260,22 +260,6 @@ static const gchar g_server_introspection[] = " <arg type='o' name='"DLS_INTERFACE_PATH"'" " direction='out'/>" " </method>" - " <method name='"DLS_INTERFACE_CREATE_PLAYLIST"'>" - " <arg type='s' name='"DLS_INTERFACE_TITLE"'" - " direction='in'/>" - " <arg type='s' name='"DLS_INTERFACE_CREATOR"'" - " direction='in'/>" - " <arg type='s' name='"DLS_INTERFACE_GENRE"'" - " direction='in'/>" - " <arg type='s' name='"DLS_INTERFACE_DESCRIPTION"'" - " direction='in'/>" - " <arg type='ao' name='"DLS_INTERFACE_PLAYLIST_ITEMS"'" - " direction='in'/>" - " <arg type='u' name='"DLS_INTERFACE_UPLOAD_ID"'" - " direction='out'/>" - " <arg type='o' name='"DLS_INTERFACE_PATH"'" - " direction='out'/>" - " </method>" " <method name='"DLS_INTERFACE_GET_COMPATIBLE_RESOURCE"'>" " <arg type='s' name='"DLS_INTERFACE_PROTOCOL_INFO"'" " direction='in'/>" @@ -409,22 +393,6 @@ static const gchar g_server_introspection[] = " </method>" " <method name='"DLS_INTERFACE_CANCEL"'>" " </method>" - " <method name='"DLS_INTERFACE_CREATE_PLAYLIST_TO_ANY"'>" - " <arg type='s' name='"DLS_INTERFACE_TITLE"'" - " direction='in'/>" - " <arg type='s' name='"DLS_INTERFACE_CREATOR"'" - " direction='in'/>" - " <arg type='s' name='"DLS_INTERFACE_GENRE"'" - " direction='in'/>" - " <arg type='s' name='"DLS_INTERFACE_DESCRIPTION"'" - " direction='in'/>" - " <arg type='ao' name='"DLS_INTERFACE_PLAYLIST_ITEMS"'" - " direction='in'/>" - " <arg type='u' name='"DLS_INTERFACE_UPLOAD_ID"'" - " direction='out'/>" - " <arg type='o' name='"DLS_INTERFACE_PATH"'" - " direction='out'/>" - " </method>" " <property type='s' name='"DLS_INTERFACE_PROP_LOCATION"'" " access='read'/>" " <property type='s' name='"DLS_INTERFACE_PROP_UDN"'" @@ -637,14 +605,6 @@ static void prv_process_async_task(dls_task_t *task) dls_upnp_update_object(g_context.upnp, client, task, prv_async_task_complete); break; - case DLS_TASK_CREATE_PLAYLIST: - dls_upnp_create_playlist(g_context.upnp, client, task, - prv_async_task_complete); - break; - case DLS_TASK_CREATE_PLAYLIST_IN_ANY: - dls_upnp_create_playlist_in_any(g_context.upnp, client, task, - prv_async_task_complete); - break; case DLS_TASK_GET_OBJECT_METADATA: dls_upnp_get_object_metadata(g_context.upnp, client, task, prv_async_task_complete); @@ -984,10 +944,6 @@ static void prv_con_method_call(dleyna_connector_id_t conn, task = dls_task_create_container_new_generic(invocation, DLS_TASK_CREATE_CONTAINER, object, parameters, &error); - else if (!strcmp(method, DLS_INTERFACE_CREATE_PLAYLIST)) - task = dls_task_create_playlist_new(invocation, - DLS_TASK_CREATE_PLAYLIST, - object, parameters, &error); else if (!strcmp(method, DLS_INTERFACE_GET_COMPATIBLE_RESOURCE)) task = dls_task_get_resource_new(invocation, object, parameters, &error); @@ -1071,11 +1027,6 @@ static void prv_device_method_call(dleyna_connector_id_t conn, } else if (!strcmp(method, DLS_INTERFACE_CANCEL_UPLOAD)) { task = dls_task_cancel_upload_new(invocation, object, parameters, &error); - } else if (!strcmp(method, DLS_INTERFACE_CREATE_PLAYLIST_TO_ANY)) { - task = dls_task_create_playlist_new( - invocation, - DLS_TASK_CREATE_PLAYLIST_IN_ANY, - object, parameters, &error); } else if (!strcmp(method, DLS_INTERFACE_CANCEL)) { task = NULL; diff --git a/libdleyna/server/task.c b/libdleyna/server/task.c index 5455f37..c10a7cc 100644 --- a/libdleyna/server/task.c +++ b/libdleyna/server/task.c @@ -111,15 +111,6 @@ static void prv_delete(dls_task_t *task) if (task->ut.update.to_delete) g_variant_unref(task->ut.update.to_delete); break; - case DLS_TASK_CREATE_PLAYLIST: - case DLS_TASK_CREATE_PLAYLIST_IN_ANY: - g_free(task->ut.playlist.title); - g_free(task->ut.playlist.creator); - g_free(task->ut.playlist.genre); - g_free(task->ut.playlist.desc); - if (task->ut.playlist.item_path) - g_variant_unref(task->ut.playlist.item_path); - break; default: break; } @@ -490,34 +481,6 @@ finished: return task; } -dls_task_t *dls_task_create_playlist_new(dleyna_connector_msg_id_t invocation, - dls_task_type_t type, - const gchar *path, - GVariant *parameters, - GError **error) -{ - dls_task_t *task; - - task = prv_m2spec_task_new(type, invocation, path, - "(uo)", error, FALSE); - if (!task) - goto finished; - - g_variant_get(parameters, "(ssss@ao)", - &task->ut.playlist.title, - &task->ut.playlist.creator, - &task->ut.playlist.genre, - &task->ut.playlist.desc, - &task->ut.playlist.item_path); - - task->multiple_retvals = TRUE; - -finished: - - return task; - -} - dls_task_t *dls_task_update_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters, GError **error) diff --git a/libdleyna/server/task.h b/libdleyna/server/task.h index f38d21b..41dfd8a 100644 --- a/libdleyna/server/task.h +++ b/libdleyna/server/task.h @@ -52,8 +52,6 @@ enum dls_task_type_t_ { DLS_TASK_CREATE_CONTAINER_IN_ANY, DLS_TASK_UPDATE_OBJECT, DLS_TASK_GET_OBJECT_METADATA, - DLS_TASK_CREATE_PLAYLIST, - DLS_TASK_CREATE_PLAYLIST_IN_ANY }; typedef enum dls_task_type_t_ dls_task_type_t; @@ -130,15 +128,6 @@ struct dls_task_update_t_ { GVariant *to_delete; }; -typedef struct dls_task_create_playlist_t_ dls_task_create_playlist_t; -struct dls_task_create_playlist_t_ { - gchar *title; - gchar *creator; - gchar *genre; - gchar *desc; - GVariant *item_path; -}; - typedef struct dls_task_target_info_t_ dls_task_target_info_t; struct dls_task_target_info_t_ { gchar *path; @@ -169,7 +158,6 @@ struct dls_task_t_ { dls_task_upload_action_t upload_action; dls_task_create_container_t create_container; dls_task_update_t update; - dls_task_create_playlist_t playlist; } ut; }; @@ -250,12 +238,6 @@ dls_task_t *dls_task_create_container_new_generic( GVariant *parameters, GError **error); -dls_task_t *dls_task_create_playlist_new(dleyna_connector_msg_id_t invocation, - dls_task_type_t type, - const gchar *path, - GVariant *parameters, - GError **error); - dls_task_t *dls_task_update_new(dleyna_connector_msg_id_t invocation, const gchar *path, GVariant *parameters, GError **error); diff --git a/libdleyna/server/upnp.c b/libdleyna/server/upnp.c index 1a34d78..c44e62e 100644 --- a/libdleyna/server/upnp.c +++ b/libdleyna/server/upnp.c @@ -1012,111 +1012,6 @@ on_error: DLEYNA_LOG_DEBUG("Exit"); } -void dls_upnp_create_playlist(dls_upnp_t *upnp, dls_client_t *client, - dls_task_t *task, - dls_upnp_task_complete_t cb) -{ - dls_async_task_t *cb_data = (dls_async_task_t *)task; - dls_task_create_playlist_t *task_data; - - DLEYNA_LOG_DEBUG("Enter"); - - cb_data->cb = cb; - task_data = &task->ut.playlist; - - DLEYNA_LOG_DEBUG("Root Path: %s - Id: %s", task->target.root_path, - task->target.id); - - if (!task_data->title || !*task_data->title) - goto on_param_error; - - if (!g_variant_n_children(task_data->item_path)) - goto on_param_error; - - DLEYNA_LOG_DEBUG_NL(); - DLEYNA_LOG_DEBUG("Title = %s", task_data->title); - DLEYNA_LOG_DEBUG("Creator = %s", task_data->creator); - DLEYNA_LOG_DEBUG("Genre = %s", task_data->genre); - DLEYNA_LOG_DEBUG("Desc = %s", task_data->desc); - DLEYNA_LOG_DEBUG_NL(); - - dls_device_playlist_upload(client, task, task->target.id); - - DLEYNA_LOG_DEBUG("Exit"); - - return; - -on_param_error: - - DLEYNA_LOG_WARNING("Invalid Parameter"); - - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_OPERATION_FAILED, - "Invalid Parameter"); - - (void) g_idle_add(dls_async_task_complete, cb_data); - - DLEYNA_LOG_DEBUG("Exit failure"); -} - -void dls_upnp_create_playlist_in_any(dls_upnp_t *upnp, dls_client_t *client, - dls_task_t *task, - dls_upnp_task_complete_t cb) -{ - dls_async_task_t *cb_data = (dls_async_task_t *)task; - dls_task_create_playlist_t *task_data; - - DLEYNA_LOG_DEBUG("Enter"); - - cb_data->cb = cb; - task_data = &task->ut.playlist; - - DLEYNA_LOG_DEBUG("Root Path: %s - Id: %s", task->target.root_path, - task->target.id); - - if (strcmp(task->target.id, "0")) { - DLEYNA_LOG_WARNING("Bad path %s", task->target.path); - - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_BAD_PATH, - "CreatePlayListInAny must be executed on a root path"); - - goto on_error; - } - - if (!task_data->title || !*task_data->title) - goto on_param_error; - - if (!g_variant_n_children(task_data->item_path)) - goto on_param_error; - - DLEYNA_LOG_DEBUG_NL(); - DLEYNA_LOG_DEBUG("Title = %s", task_data->title); - DLEYNA_LOG_DEBUG("Creator = %s", task_data->creator); - DLEYNA_LOG_DEBUG("Genre = %s", task_data->genre); - DLEYNA_LOG_DEBUG("Desc = %s", task_data->desc); - DLEYNA_LOG_DEBUG_NL(); - - dls_device_playlist_upload(client, task, "DLNA.ORG_AnyContainer"); - - DLEYNA_LOG_DEBUG("Exit"); - - return; - -on_param_error: - - DLEYNA_LOG_WARNING("Invalid Parameter"); - - cb_data->error = g_error_new(DLEYNA_SERVER_ERROR, - DLEYNA_ERROR_OPERATION_FAILED, - "Invalid Parameter"); -on_error: - - (void) g_idle_add(dls_async_task_complete, cb_data); - - DLEYNA_LOG_DEBUG("Exit failure"); -} - void dls_upnp_get_object_metadata(dls_upnp_t *upnp, dls_client_t *client, dls_task_t *task, dls_upnp_task_complete_t cb) { diff --git a/libdleyna/server/upnp.h b/libdleyna/server/upnp.h index 2fa0812..e06cc44 100644 --- a/libdleyna/server/upnp.h +++ b/libdleyna/server/upnp.h @@ -93,14 +93,6 @@ void dls_upnp_update_object(dls_upnp_t *upnp, dls_client_t *client, dls_task_t *task, dls_upnp_task_complete_t cb); -void dls_upnp_create_playlist(dls_upnp_t *upnp, dls_client_t *client, - dls_task_t *task, - dls_upnp_task_complete_t cb); - -void dls_upnp_create_playlist_in_any(dls_upnp_t *upnp, dls_client_t *client, - dls_task_t *task, - dls_upnp_task_complete_t cb); - void dls_upnp_get_object_metadata(dls_upnp_t *upnp, dls_client_t *client, dls_task_t *task, dls_upnp_task_complete_t cb); diff --git a/test/dbus/mediaconsole.py b/test/dbus/mediaconsole.py index 1a05dc1..d5dfe39 100644 --- a/test/dbus/mediaconsole.py +++ b/test/dbus/mediaconsole.py @@ -139,11 +139,6 @@ class Container(MediaObject): path = self._containerIF.CreateContainer(name, type, child_types) print u"New container path: " + path - def create_playlist(self, title, items, creator="", genre="", desc=""): - (tid, path) = self._containerIF.CreatePlaylist(title, creator, genre, - desc, items) - print "Transfer ID: " + str(tid) - print u"Path: " + path def print_compatible_resource(self, protocol_info, fltr): print_properties(self._containerIF.GetCompatibleResource(protocol_info, @@ -184,15 +179,6 @@ class Device(Container): def cancel(self): return self._deviceIF.Cancel() - def create_playlist_in_any(self, title, items, creator="", genre="", desc=""): - (tid, path) = self._deviceIF.CreatePlaylistInAnyContainer(title, - creator, - genre, - desc, - items) - print "Transfer ID: " + str(tid) - print u"Path: " + path - class UPNP(object): |