Jump to content

Error refreshing item added with channel plugin


Go to solution Solved by nack,

Recommended Posts

Posted

Hey guys :)

I'm writing my own channel plugin for personal use. I'm having a problem with Emby handling the meta data. Below is the log and the code causing the problem.
You'll notice the log is trying to create a handle to 'C:\Users\me\AppData\Roaming\Emby-Server\system\http:\192.168.1.2:44101\movie\1234\1234', which I assume isn't supposed to be like that?The media source is a remote mkv accessed via http.
Please can you help me? Let me know if I've not provided enough information.

Cheers

2024-10-13 21:58:55.663 Info Main: Application path: C:\Users\me\AppData\Roaming\Emby-Server\system\EmbyServer.dll
2024-10-13 21:58:56.460 Info App: Setting default culture to en-GB
2024-10-13 21:58:56.465 Info Main: Emby
	Command line: C:\Users\me\AppData\Roaming\Emby-Server\system\EmbyServer.dll -nointerface
	Operating system: Microsoft Windows 10.0.22631
	Framework: .NET 6.0.33
	OS/Process: x64/x64
	Runtime: C:/Users/me/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: C:\Users\me\AppData\Roaming\Emby-Server\programdata
	Application path: C:\Users\me\AppData\Roaming\Emby-Server\system
2024-10-13 21:58:56.465 Info Main: Logs path: C:\Users\me\AppData\Roaming\Emby-Server\programdata\logs
2024-10-13 21:58:56.465 Info Main: Cache path: C:\Users\me\AppData\Roaming\Emby-Server\programdata\cache
2024-10-13 21:58:56.465 Info Main: Internal metadata path: C:\Users\me\AppData\Roaming\Emby-Server\programdata\metadata
2024-10-13 21:58:56.486 Info App: Emby Server Version: 4.8.10.0

...

2024-10-13 21:59:33.442 Debug App: Running FFProbeProvider for Chief of Station
2024-10-13 21:59:33.442 Debug App: Running MovieNfoProvider for Chief of Station
2024-10-13 21:59:33.442 Debug App: MovieNfoProvider returned no metadata for Chief of Station
2024-10-13 21:59:33.442 Debug App: Running MovieDbProvider for Chief of Station
2024-10-13 21:59:33.442 Info HttpClient: GET https://api.themoviedb.org/3/movie/Chief of Station?api_key=x_secret1_x&append_to_response=alternative_titles,reviews,casts,releases,images,keywords,trailers&language=en-US&include_image_language=en-US,null
2024-10-13 21:59:33.592 Debug App: MovieDbProvider returned no metadata for Chief of Station
2024-10-13 21:59:33.592 Debug App: Running OmdbItemProvider for Chief of Station
2024-10-13 21:59:33.592 Info HttpClient: GET https://private.omdbapi.com?apikey=x_secret2_x&plot=full&r=json&t=Chief of Station&type=movie
2024-10-13 21:59:34.348 Info HttpClient: GET https://private.omdbapi.com?apikey=x_secret2_x&i=tt21301418&plot=short&r=json
2024-10-13 21:59:34.949 Debug HttpClient: GET http://192.168.1.1:58666/rootDesc.xml
2024-10-13 21:59:35.078 Debug PortMapper: Parsing serviceType urn:schemas-upnp-org:service:Layer3Forwarding:1, controlUrl: /ctl/L3F
2024-10-13 21:59:35.078 Debug PortMapper: Parsing serviceType urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1, controlUrl: /ctl/CmnIfCfg
2024-10-13 21:59:35.078 Debug PortMapper: Parsing serviceType urn:schemas-upnp-org:service:WANIPConnection:1, controlUrl: /ctl/IPConn
2024-10-13 21:59:35.078 Debug PortMapper: 192.168.1.1:58666: Found upnp service urn:schemas-upnp-org:service:WANIPConnection:1 at http://192.168.1.1:58666/ctl/IPConn
2024-10-13 21:59:35.088 Debug App: Running TvdbMovieProvider for Chief of Station
2024-10-13 21:59:35.088 Info HttpClient: GET https://api4.thetvdb.com/v4/search?type=movie&q=tt21301418&remote_id=tt21301418
2024-10-13 21:59:35.107 Debug PortMapper: Creating port map on local port 8096 to public port 8096 with device 192.168.1.174
2024-10-13 21:59:35.138 Debug HttpClient: POST http://192.168.1.1:58666/ctl/IPConn
2024-10-13 21:59:35.154 Error HttpClient: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>718</errorCode><errorDescription>ConflictInMappingEntry</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>
2024-10-13 21:59:35.184 Debug HttpClient: POST http://192.168.1.1:58666/ctl/IPConn
2024-10-13 21:59:35.218 Debug PortMapper: Found GetSpecificPortMappingEntryResponse response
2024-10-13 21:59:35.220 Debug PortMapper: Port mapping already exists.
2024-10-13 21:59:35.222 Debug PortMapper: Creating port map on local port 8920 to public port 8920 with device 192.168.1.174
2024-10-13 21:59:35.222 Debug HttpClient: POST http://192.168.1.1:58666/ctl/IPConn
2024-10-13 21:59:35.239 Error HttpClient: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>718</errorCode><errorDescription>ConflictInMappingEntry</errorDescription></UPnPError></detail></s:Fault></s:Body></s:Envelope>
2024-10-13 21:59:35.242 Debug HttpClient: POST http://192.168.1.1:58666/ctl/IPConn
2024-10-13 21:59:35.261 Debug PortMapper: Found GetSpecificPortMappingEntryResponse response
2024-10-13 21:59:35.261 Debug PortMapper: Port mapping already exists.
2024-10-13 21:59:35.277 Info HttpClient: GET https://api4.thetvdb.com/v4/movies/356456/extended?meta=translations
2024-10-13 21:59:35.531 Debug App: Running MovieDbImageProvider for http://192.168.1.2:44101/movie/1234/1234/1690879.mkv
2024-10-13 21:59:35.531 Info HttpClient: GET https://api.themoviedb.org/3/movie/1093995?api_key=x_secret1_x&append_to_response=alternative_titles,reviews,casts,releases,images,keywords,trailers
2024-10-13 21:59:35.640 Debug App: Running FanartMovieImageProvider for http://192.168.1.2:44101/movie/1234/1234/1690879.mkv
2024-10-13 21:59:35.641 Info HttpClient: GET https://webservice.fanart.tv/v3/movies/1093995?api_key=x_secret4_x
2024-10-13 21:59:35.781 Error BaseItem: Error refreshing item Chief of Station 112 http://192.168.1.2:44101/movie/1234/1234/1690879.mkv
	*** Error Report ***
	Version: 4.8.10.0
	Command line: C:\Users\me\AppData\Roaming\Emby-Server\system\EmbyServer.dll -nointerface
	Operating system: Microsoft Windows 10.0.22631
	Framework: .NET 6.0.33
	OS/Process: x64/x64
	Runtime: C:/Users/me/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: C:\Users\me\AppData\Roaming\Emby-Server\programdata
	Application path: C:\Users\me\AppData\Roaming\Emby-Server\system
	System.IO.IOException: System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Users\me\AppData\Roaming\Emby-Server\system\http:\192.168.1.2:44101\movie\1234\1234'
	   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
	   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
	   at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
	   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
	   at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
	   at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
	   at System.IO.DirectoryInfo.EnumerateFileSystemInfos(String searchPattern, EnumerationOptions enumerationOptions)
	   at Emby.Server.Implementations.IO.ManagedFileSystem.EnumerateFileSystemInfos(DirectoryInfo dir, Boolean recursive)
	   at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileSystemEntries(String path, Boolean recursive, FileSystemCredentials credentials)
	   at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntriesInternal(String path)
	   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
	   at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path)
	   at Emby.Providers.Manager.MetadataService`2.GetActorsFolderPathFromParentFolder(String folder, IDirectoryService directoryService)
	   at Emby.Providers.Manager.MetadataService`2.ImportPeopleImagesFromActorsSubfolder(BaseItem item, List`1 people, IDirectoryService directoryService)
	   at Emby.Providers.Manager.MetadataService`2.SaveItem(MetadataResult`1 result, Boolean isFirstRefresh, LibraryOptions libraryOptions, ItemUpdateType reason, IDirectoryService directoryService, MetadataRefreshOptions metadataRefreshOptions, CancellationToken cancellationToken)
	   at Emby.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, BaseItem[] collectionFolders, LibraryOptions libraryOptions, CancellationToken cancellationToken)
	   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, BaseItem[] collectionFolders, LibraryOptions libraryOptions, CancellationToken cancellationToken)
	   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadataRecursive(BaseItem[] children, MetadataRefreshOptions refreshOptions, BaseItem[] collectionFolders, LibraryOptions libraryOptions, Boolean recursive, Dictionary`2 newItemIds, IProgress`1 progress, CancellationToken cancellationToken)
	Source: System.Private.CoreLib
	TargetSite: IntPtr CreateDirectoryHandle(System.String, Boolean)

---

private async Task<List<ChannelItemInfo>> GetMovieChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
{
	var folderId = query.FolderId.TrimStart('\\');
	var categoryPath = Path.Combine(dataPath, folderId);
	var folders = fileSystem.GetDirectories(categoryPath, false);

	return (await ReadMovieInfosFromDiskAsync(folders, cancellationToken))
		.Select((tuple) =>
		{
			var movie = tuple.Item1;
			var info = tuple.Item2;
			var apiUriBuilder = new APIURIBuilder();
			var path = apiUriBuilder.Build();

			var channelItemInfo = new ChannelItemInfo();
			channelItemInfo.ContentType = ChannelMediaContentType.Movie;
			channelItemInfo.Id = $@"{query.FolderId}\{movie.id}";
			channelItemInfo.MediaSources = new List<MediaSourceInfo>
			{
				new MediaSourceInfo
				{
					Path = path,
					Protocol = MediaProtocol.Http,
					Container = movie.container,
					Name = movie.name,
					Id = path.GetMD5().ToString("N"),
					IsRemote = true,
					Bitrate = info.GetBitrate(),
				}
			};

			channelItemInfo.MediaType = ChannelMediaType.Video;
			channelItemInfo.Name = movie.name;
			channelItemInfo.ProviderIds = new ProviderIdDictionary()
			{
				{ MetadataProviders.Tmdb.ToString(), tuple.GetProviderID()  }
			};

			channelItemInfo.Type = ChannelItemType.Media;
			return channelItemInfo;
		})
		.ToList();
}

 

Posted

Hi, we'll take a look at it. Thanks.

Posted

I think I have figured it out, I'll report back when I'm certain, just letting you know because I don't want you to spend time on it if there's no need :)

Posted

It's something I'm doing wrong when I'm setting the path on channel item info. I'm not quite sure which properties I should be assigning the url to. If I assign to MediaSourceInfo.Path, the media plays but meta data fails, and subtitles cannot be downloaded. If I assign the url to DirectStreamUrl, meta data works but the stream doesn't play. I know I'm doing something wrong but I can't figure out what and there's no documentation.

 

Thanks for reading.

  • Solution
Posted (edited)

Okay, in the end I used strm files. It was the easiest solution with least effort to add to what I already had. I put them in a folder within the plugin folder.

For anyone reading, place the address of your remote stream in a .strm plain text file and set the path of the media source info, to the location of the strm. Emby will do the rest.

Edited by nack
info
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...