Search the Community
Showing results for tags 'c#'.
-
GetSearchResults - Long Time issue - sometimes (often) runs twice
mickle026 posted a topic in Developer API
Can I ask why this often gets called twice when the user requests it once? I have noticed this many times, and in one of my plugins I actually cancel duplicate tasks, but why after all this time (a few years) is this still often getting called twice? At first I was wondering if it was if the user clicked identfy in the Gui having filled in the Name dialog, before the Provider Ids Text boxes load, but its not. It still does it even if the user waits for the dialog to fully load. Is it something in Emby, or maybe because results wernt returned fast enough? Is there a timeout before it gets recalled? I log my plugins and can see this happening, sometimes the second task runs before the first is finished, causing the log to wriite interleaved into the first ones text. The functionallity still works just fine, but its annoying..as the results can reload or even just blank out (return nothing). -
Is there any way at all to get album path without probing songs? C#
mickle026 posted a topic in Developer API
I am wanting to use this interface for some data importing public Task<MetadataResult<MusicAlbum>> GetMetadata(ItemInfo info, LibraryOptions libraryOptions, IDirectoryService directoryService, CancellationToken cancellationToken) however from here I can get Album Name and The Album Id , but thats about it. I want to be able to get the Albums root path. I know how to get it from the Audio (song) by getting the parent path, but thats not the interface I want to use, I do not wish to probe every song when I probably don't need to. I only want to work at album level. Is that still possible? public Task<MetadataResult<Audio>> GetMetadata(ItemInfo info, LibraryOptions libraryOptions, IDirectoryService directoryService, CancellationToken cancellationToken) info.Path is blank/empty. info.ContaingFolder is blank/empty. I understand this decision was probably made to drop duplicate iformation from the database, but you are able to get the base path somehow when you select an album to delete it. So I am currently trying to get the delete paths, so that I can thus apply some logic and determine the basepath from that. var pathx = libraryManager.GetItemById(info.Id); List<FileSystemMetadata> dpths = pathx.GetDeletePaths(false); However when I try to use GetDeletePaths I keep getting GenericList Exceptions - Method Not Found *** Error Report *** Version: 4.8.0.78 Command line: C:\Users\mike\AppData\Roaming\Emby-Server\system\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows 6.2.9200 Framework: .NET 6.0.26 OS/Process: x64/x64 Runtime: C:/Users/mike/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll Processor count: 4 Data path: C:\Users\mike\AppData\Roaming\Emby-Server\programdata Application path: C:\Users\mike\AppData\Roaming\Emby-Server\system System.MissingMethodException: System.MissingMethodException: Method not found: 'System.Collections.Generic.List`1<MediaBrowser.Model.IO.FileSystemMetadata> MediaBrowser.Controller.Entities.BaseItem.GetDeletePaths(Boolean)'. at LocalAlbumCoverImporter.LocalAlbumCoverImporter.GetMetadata(ItemInfo info, LibraryOptions libraryOptions, IDirectoryService directoryService, CancellationToken cancellationToken) at Emby.Providers.Manager.MetadataService`2.RefreshWithProviders(MetadataResult`1 metadata, TIdType id, MetadataRefreshMode metadataRefreshMode, Boolean replaceAllMetadata, MetadataRefreshOptions options, BaseItem[] collectionFolders, LibraryOptions libraryOptions, List`1 providers, ItemImageProvider imageService, CancellationToken cancellationToken) Source: LocalAlbumCoverImporter TargetSite: System.Threading.Tasks.Task`1[MediaBrowser.Controller.Providers.MetadataResult`1[MediaBrowser.Controller.Entities.Audio.MusicAlbum]] GetMetadata(MediaBrowser.Controller.Providers.ItemInfo, MediaBrowser.Model.Configuration.LibraryOptions, MediaBrowser.Controller.Providers.IDirectoryService, System.Threading.CancellationToken) Please tell me there is a simpler way to do this? i.e, to get the albums basepath from this Interface? -
How I can add a movie to a collection using C#? I'm developing a plugin and want to be able to add a movie to a newly created collection during, for example, Refresh Metadata/Identify action. I tried: QueryResult<BaseItem> collections = _libraryManager.QueryItems(new InternalItemsQuery() { IncludeItemTypes = new[] { "collections", "Boxset" }, Name = collectionName }); // one collection item found if (movieItem.AddCollection((BoxSet)collections.Items[0])) { // once with UpdateToRepository, once without movieItem.UpdateToRepository(ItemUpdateType.None); // movieItem.UpdateToRepository(ItemUpdateType.MetadataEdit); } and this: _collectionManager.AddToCollection(newCollection.InternalId, internalIdMovieItemsArray); During the action, I can add another movie to the newly created collection, but not the one I'm currently updating. How I can add a movie to a collection using C#?
- 10 replies
-
- c#
- collection
-
(and 1 more)
Tagged with:
-
I'm running a GetItemsAsync and pulling back movies. I'm then iterating the items and on some I'm setting the DateCreated and calling UpdateItem, but I'm getting "The method or operation is not implemented". Am I doing something wrong with how I'm updating them, or is setting the DateCreated not supported? I'm trying to update the DateAdded (which I was thinking is the same as DateCreated, but maybe not).
-
Hi I try to create a plugin for my home automation system to control emby. My home automation use c# plugins. So i install https://github.com/MediaBrowser/Emby.ApiClient with nugget and try the multi-server example. But i'm stuck at CredentialProvider. If i understand, i need to implement my own ICredentialProvider but i don't know how to do this. Is anyone having more informations about that point ? My code so far : using Constellation.Package; using MediaBrowser.ApiInteraction; using MediaBrowser.Model.Session; using MediaBrowser.Model.Logging; using MediaBrowser.ApiInteraction.Cryptography; using MediaBrowser.ApiInteraction.Net; using MediaBrowser.ApiInteraction.WebSocket; namespace Emby { public class Program : PackageBase { static void Main(string[] args) { PackageHost.Start<Program>(args); } public override void OnStart() { PackageHost.WriteInfo("Package starting - IsRunning: {0} - IsConnected: {1}", PackageHost.IsRunning, PackageHost.IsConnected); var logger = new NullLogger(); var capabilities = new ClientCapabilities(); var device = new Device { DeviceName = "My Device Name", DeviceId = "My Device Id" }; var credentialProvider = new CredentialProvider(); // If using the portable class library you'll need to supply your own INetworkConnection implementation. var networkConnection = new NetworkConnection(logger); // If using the portable class library you'll need to supply your own ICryptographyProvider implementation. var cryptoProvider = new CryptographyProvider(); // If using the portable class library you'll need to supply your own IServerLocator implementation. var serverLocator = new ServerLocator(logger); var connectionManager = new ConnectionManager(logger, credentialProvider, networkConnection, serverLocator, "My App Name", // Application version "1.0.0.0", device, capabilities, cryptoProvider, ClientWebSocketFactory.CreateWebSocket); } } } Thank for your help !