From: Zeeshan Ali (Khattak) Date: Wed, 23 Apr 2008 13:53:33 +0000 (+0000) Subject: Host user's home directory as '/media' and update paths accordingly. X-Git-Tag: RYGEL_0_2~344 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9125e4c05a385380f9f5e85b680e39256e3e24e4;p=profile%2Fivi%2Frygel.git Host user's home directory as '/media' and update paths accordingly. svn path=/trunk/; revision=129 --- diff --git a/ChangeLog b/ChangeLog index 7648972..42d237d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ - Implement 'BrowseMetadata'. - Mime-type of mp3 files should be 'audio/mpeg' rather than 'audio/mp3'. + - Host user's home directory as '/media' and update paths accordingly. 2008-04-21 Zeeshan Ali Khattak diff --git a/src/gupnp-media-server.c b/src/gupnp-media-server.c index 5e8abe7..a4a037c 100644 --- a/src/gupnp-media-server.c +++ b/src/gupnp-media-server.c @@ -30,6 +30,8 @@ #include "gupnp-media-server.h" +#define HOME_DIR_ALIAS "/media" + G_DEFINE_TYPE (GUPnPMediaServer, gupnp_media_server, GUPNP_TYPE_ROOT_DEVICE); @@ -43,16 +45,19 @@ struct _GUPnPMediaServerPrivate { GUPnPSearchCriteriaParser *search_parser; }; -/* Hard-coded items (mime, title, path) */ +/* Hard-coded items (mime, title, path) + * + * paths are relative to home directory + * */ char *items[3][4] = { { "4000", "audio/mpeg", "Maa", - "/home/zeenix/entertainment/songs/Maa.mp3" }, + "entertainment/songs/Maa.mp3" }, { "4001", "audio/mpeg", "Hoo", - "/home/zeenix/entertainment/songs/Ho.mp3" }, + "entertainment/songs/Ho.mp3" }, { NULL } }; @@ -108,6 +113,7 @@ gupnp_media_server_constructor (GType type, GObjectClass *object_class; GUPnPMediaServer *server; GUPnPServiceInfo *service; + GUPnPContext *context; object_class = G_OBJECT_CLASS (gupnp_media_server_parent_class); object = object_class->constructor (type, @@ -139,6 +145,11 @@ gupnp_media_server_constructor (GType type, } } + context = gupnp_device_info_get_context (GUPNP_DEVICE_INFO (server)); + + /* Host user's home dir */ + gupnp_context_host_path (context, g_get_home_dir (), HOME_DIR_ALIAS); + return object; } @@ -223,9 +234,10 @@ add_item (GUPnPContext *context, gupnp_didl_lite_resource_reset (&res); /* URI */ - res.uri = g_strdup_printf ("http://%s:%d%s", + res.uri = g_strdup_printf ("http://%s:%d%s/%s", gupnp_context_get_host_ip (context), gupnp_context_get_port (context), + HOME_DIR_ALIAS, path); /* Protocol info */