home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Plugin Development
Get MediaItem object from a MediaItemId (Guid)
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="McGoober" data-source="post: 821013" data-attributes="member: 24098"><p>I'm developing a UPNP DLNA plugin. I need to expose to the connecting device some form of unique id so that the device and the plugin can keep track of where in the media tree the device is. I was thinking of doing this with the media item ID (GUID). This way I know what the child items are by calling library.Browse, but the other thing the device could ask for is "give me more information about this item", and for that I need to turn a media item guid back into a MediaItem object. </p><p></p><p>Example...</p><p>So the connecting device might say, give me all items from the root node, and I return..</p><p></p><p>var library = ServiceRegistration.Get<IMediaLibrary>();</p><p>var shares = library.GetShares(null);</p><p>var result = from share in shares select library.LoadItem(share.Value.SystemId, share.Value.BaseResourcePath, necessaryMiaTypes, null).MediaItemId;</p><p></p><p>The connecting device might then say, give me more information about item: 466bc397-d646-4f3d-bca6-0de2e7ce38ae</p><p>I want to load the media item to get a MediaItem object again.</p><p></p><p>Guid mediaItemGuid = new Guid("466bc397-d646-4f3d-bca6-0de2e7ce38ae");</p><p>var library = ServiceRegistration.Get<IMediaLibrary>();</p><p>var item = library.<em>GetMediaItem</em>(mediaItemGuid, necessaryMIATypeIDs, optionalMIATypeIDs);</p><p></p><p>I hope that makes more sense <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>The device could return me any media item and would be of any aspect.</p></blockquote><p></p>
[QUOTE="McGoober, post: 821013, member: 24098"] I'm developing a UPNP DLNA plugin. I need to expose to the connecting device some form of unique id so that the device and the plugin can keep track of where in the media tree the device is. I was thinking of doing this with the media item ID (GUID). This way I know what the child items are by calling library.Browse, but the other thing the device could ask for is "give me more information about this item", and for that I need to turn a media item guid back into a MediaItem object. Example... So the connecting device might say, give me all items from the root node, and I return.. var library = ServiceRegistration.Get<IMediaLibrary>(); var shares = library.GetShares(null); var result = from share in shares select library.LoadItem(share.Value.SystemId, share.Value.BaseResourcePath, necessaryMiaTypes, null).MediaItemId; The connecting device might then say, give me more information about item: 466bc397-d646-4f3d-bca6-0de2e7ce38ae I want to load the media item to get a MediaItem object again. Guid mediaItemGuid = new Guid("466bc397-d646-4f3d-bca6-0de2e7ce38ae"); var library = ServiceRegistration.Get<IMediaLibrary>(); var item = library.[I]GetMediaItem[/I](mediaItemGuid, necessaryMIATypeIDs, optionalMIATypeIDs); I hope that makes more sense :) The device could return me any media item and would be of any aspect. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Get MediaItem object from a MediaItemId (Guid)
Contact us
RSS
Top
Bottom