protected override IDictionary <string, MediaCategory> GetAllAvailableCategories() { IResourceInformationService ris = GetResourceInformationService(); return(new Dictionary <string, MediaCategory>( ris.GetMediaCategoriesFromMetadataExtractors().ToDictionary(mediaCategory => mediaCategory.CategoryName))); }
protected static IResourceInformationService GetResourceInformationService() { IResourceInformationService ris = ServiceRegistration.Get <IServerConnectionManager>().ResourceInformationService; if (ris != null) { return(ris); } throw new NotConnectedException(); }
protected IResourceInformationService GetResourceInformationService(string systemId) { IResourceInformationService result = FindResourceInformationService(systemId); if (result == null) { throw new NotConnectedException("The system '{0}' is not connected", systemId); } return(result); }
public static string GetServerResourcePathDisplayName(ResourcePath path) { try { IResourceInformationService ris = GetResourceInformationService(); return(ris.GetResourcePathDisplayName(path)); } catch (Exception e) { ServiceRegistration.Get <ILogger>().Warn("Problem updating display name of choosen path '{0}'", e, path); return(string.Empty); } }
public bool GetFileHttpUrl(string nativeSystemId, ResourcePath nativeResourcePath, out string fileHttpUrl, out IPAddress localIpAddress) { fileHttpUrl = null; localIpAddress = null; IResourceInformationService ris = FindResourceInformationService(nativeSystemId); if (ris == null) { return(false); } fileHttpUrl = ResourceHttpAccessUrlUtils.GetResourceURL(ris.GetResourceServerBaseURL(out localIpAddress), nativeResourcePath); return(true); }
/// <summary> /// Checks if there is a resource information UPnP service available on the system with the /// given <paramref name="systemId"/>. /// </summary> /// <param name="systemId">Id of the system to check.</param> /// <returns>Proxy object to access the resource information service at the system with the given /// <paramref name="systemId"/> or <c>null</c>, if the system neither provides an MP2 client nor an MP2 server.</returns> protected IResourceInformationService FindResourceInformationService(string systemId) { lock (_networkTracker.SharedControlPointData.SyncObj) foreach (RootDescriptor rootDeviceDescriptor in _networkTracker.KnownRootDevices.Values) { if (rootDeviceDescriptor.State == RootDescriptorState.Ready && rootDeviceDescriptor.SSDPRootEntry.RootDeviceUUID == systemId) { IResourceInformationService ris = TryGetResourceInformationService(rootDeviceDescriptor); if (ris != null) { return(ris); } } } return(null); }
public static ResourceProviderMetadata GetServerResourceProviderMetadata(Guid resourceProviderId) { IResourceInformationService ris = GetResourceInformationService(); return(ris.GetResourceProviderMetadata(resourceProviderId)); }
protected override IEnumerable <ResourceProviderMetadata> GetAvailableBaseResourceProviders() { IResourceInformationService ris = GetResourceInformationService(); return(new List <ResourceProviderMetadata>(ris.GetAllBaseResourceProviderMetadata())); }
protected override IEnumerable <ResourcePathMetadata> GetChildDirectoriesData(ResourcePath path) { IResourceInformationService ris = GetResourceInformationService(); return(ris.GetChildDirectoriesData(path)); }
protected override bool GetIsPathValid(ResourcePath path) { IResourceInformationService ris = GetResourceInformationService(); return(ris.DoesResourceExist(path)); }
protected override ResourcePath ExpandResourcePathFromString(string path) { IResourceInformationService ris = GetResourceInformationService(); return(ris.ExpandResourcePathFromString(BaseResourceProvider.ResourceProviderId, path)); }
protected override string SuggestShareName() { IResourceInformationService ris = GetResourceInformationService(); return(ris.GetResourceDisplayName(ChoosenResourcePath)); }