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
Featured Plugins
UPnP / DLNA Media Server
UPnP / DLNA Media Server for MediaPortal 2
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="FreakyJ" data-source="post: 1151712" data-attributes="member: 106003"><p>[USER=48495]@morpheus_xx[/USER]</p><p>Sorry to bother you:</p><p>I read this:</p><p></p><p></p><p>And this code:</p><p></p><p>returns 'null'</p><p></p><p>What are the reasons that the ProviderResourceAspect is unavailable?</p><p>If I take a look into the DB I have 77 entries for in the MediaItem Aspect and 77 entries in Resourceprovidersource table.</p><p>But I get for every MediaItem 'null' while trying the Resourcelocator...</p><p></p><p>Part of the whole function:</p><p>[code]public static MetadataContainer ParseMediaItem(MediaItem item)</p><p> {</p><p> MetadataContainer info = new MetadataContainer();</p><p> var mediaIteamLocator = item.GetResourceLocator();</p><p> try</p><p> {</p><p> var mediaItemPath = mediaIteamLocator.NativeResourcePath;</p><p> var mediaItemDirectoryPath = ResourcePathHelper.Combine(mediaItemPath, "../");</p><p> using (var mediaItemAccessor = new ResourceLocator(mediaIteamLocator.NativeSystemId, mediaItemDirectoryPath).CreateAccessor())</p><p> {</p><p> //IResourceAccessor mediaItemAccessor = item.GetResourceLocator().CreateAccessor();</p><p> if (mediaItemAccessor is IFileSystemResourceAccessor)</p><p> {</p><p> using (var fsra = (IFileSystemResourceAccessor)mediaItemAccessor.Clone())</p><p> {</p><p> if (!fsra.IsFile)</p><p> return null;</p><p> using (var lfsra = StreamedResourceToLocalFsAccessBridge.GetLocalFsResourceAccessor(fsra))</p><p> {</p><p> info.Metadata.Source = lfsra.LocalFileSystemPath;</p><p> }</p><p> }</p><p> info.Metadata.Size = new FileInfo(info.Metadata.Source).Length;</p><p> }</p><p> else if (mediaItemAccessor is INetworkResourceAccessor)</p><p> {</p><p> using (var nra = (INetworkResourceAccessor)mediaItemAccessor.Clone())</p><p> {</p><p> info.Metadata.Source = nra.URL;</p><p> }</p><p> info.Metadata.Size = 0;</p><p> }</p><p> }</p><p> }</p><p> catch (Exception ex)</p><p> {</p><p>//#if DEBUG</p><p> var name = item.Aspects[MediaAspect.ASPECT_ID].GetAttributeValue(MediaAspect.ATTR_TITLE);</p><p> Logger.Warn("DlnaMediaServer: Error while accessing Mediaitem '{0}' in ParseMediaItem()", ex, name);</p><p>//#endif</p><p> info.Metadata.Size = 0;</p><p> }[/code]</p><p></p><p>Log:</p><p></p><p></p><p>Edit:</p><p>The exception is caused because 'mediaIteamLocator ' is null</p></blockquote><p></p>
[QUOTE="FreakyJ, post: 1151712, member: 106003"] [USER=48495]@morpheus_xx[/USER] Sorry to bother you: I read this: And this code: returns 'null' What are the reasons that the ProviderResourceAspect is unavailable? If I take a look into the DB I have 77 entries for in the MediaItem Aspect and 77 entries in Resourceprovidersource table. But I get for every MediaItem 'null' while trying the Resourcelocator... Part of the whole function: [code]public static MetadataContainer ParseMediaItem(MediaItem item) { MetadataContainer info = new MetadataContainer(); var mediaIteamLocator = item.GetResourceLocator(); try { var mediaItemPath = mediaIteamLocator.NativeResourcePath; var mediaItemDirectoryPath = ResourcePathHelper.Combine(mediaItemPath, "../"); using (var mediaItemAccessor = new ResourceLocator(mediaIteamLocator.NativeSystemId, mediaItemDirectoryPath).CreateAccessor()) { //IResourceAccessor mediaItemAccessor = item.GetResourceLocator().CreateAccessor(); if (mediaItemAccessor is IFileSystemResourceAccessor) { using (var fsra = (IFileSystemResourceAccessor)mediaItemAccessor.Clone()) { if (!fsra.IsFile) return null; using (var lfsra = StreamedResourceToLocalFsAccessBridge.GetLocalFsResourceAccessor(fsra)) { info.Metadata.Source = lfsra.LocalFileSystemPath; } } info.Metadata.Size = new FileInfo(info.Metadata.Source).Length; } else if (mediaItemAccessor is INetworkResourceAccessor) { using (var nra = (INetworkResourceAccessor)mediaItemAccessor.Clone()) { info.Metadata.Source = nra.URL; } info.Metadata.Size = 0; } } } catch (Exception ex) { //#if DEBUG var name = item.Aspects[MediaAspect.ASPECT_ID].GetAttributeValue(MediaAspect.ATTR_TITLE); Logger.Warn("DlnaMediaServer: Error while accessing Mediaitem '{0}' in ParseMediaItem()", ex, name); //#endif info.Metadata.Size = 0; }[/code] Log: Edit: The exception is caused because 'mediaIteamLocator ' is null [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Featured Plugins
UPnP / DLNA Media Server
UPnP / DLNA Media Server for MediaPortal 2
Contact us
RSS
Top
Bottom