From fa8d79a191701170f5443ede7d15b62374f717a7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 3 Mar 2016 21:52:41 -0500 Subject: add path to table creation --- MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index cd439d1f2..18a41d82a 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -128,7 +128,7 @@ namespace MediaBrowser.Server.Implementations.Persistence string[] queries = { - "create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB, ParentId GUID)", + "create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB, ParentId GUID, Path TEXT)", "create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)", "create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)", "create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)", -- cgit v1.2.3 From 22377f2516b78d9eb6a2e5bf4e99958590bd5788 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 4 Mar 2016 12:07:14 -0500 Subject: auto-organize fixes --- .../TV/TvdbSeasonIdentityProvider.cs | 5 ++++ MediaBrowser.Providers/TV/TvdbSeriesProvider.cs | 34 +++++++++++----------- .../FileOrganization/TvFolderOrganizer.cs | 8 ++--- 3 files changed, 26 insertions(+), 21 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Providers/TV/TvdbSeasonIdentityProvider.cs b/MediaBrowser.Providers/TV/TvdbSeasonIdentityProvider.cs index edeea36e4..4198430c9 100644 --- a/MediaBrowser.Providers/TV/TvdbSeasonIdentityProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbSeasonIdentityProvider.cs @@ -27,6 +27,11 @@ namespace MediaBrowser.Providers.TV public static TvdbSeasonIdentity? ParseIdentity(string id) { + if (id == null) + { + return null; + } + try { var parts = id.Split(':'); diff --git a/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs index 4a7ae57fb..593507fb2 100644 --- a/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbSeriesProvider.cs @@ -160,19 +160,19 @@ namespace MediaBrowser.Providers.TV var series = result.Item; string id; - if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id) && !string.IsNullOrEmpty(id)) { series.SetProviderId(MetadataProviders.Tvdb, id); } - if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id) && !string.IsNullOrEmpty(id)) { series.SetProviderId(MetadataProviders.Imdb, id); } var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); - var seriesXmlPath = GetSeriesXmlPath (seriesProviderIds, metadataLanguage); + var seriesXmlPath = GetSeriesXmlPath(seriesProviderIds, metadataLanguage); var actorsXmlPath = Path.Combine(seriesDataPath, "actors.xml"); FetchSeriesInfo(series, seriesXmlPath, cancellationToken); @@ -320,7 +320,7 @@ namespace MediaBrowser.Providers.TV internal static bool IsValidSeries(Dictionary seriesProviderIds) { string id; - if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id) && !string.IsNullOrEmpty(id)) { // This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet. if (!string.IsNullOrWhiteSpace(id)) @@ -329,7 +329,7 @@ namespace MediaBrowser.Providers.TV } } - if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id) && !string.IsNullOrEmpty(id)) { // This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet. if (!string.IsNullOrWhiteSpace(id)) @@ -340,7 +340,7 @@ namespace MediaBrowser.Providers.TV return false; } - private SemaphoreSlim _ensureSemaphore = new SemaphoreSlim(1,1); + private SemaphoreSlim _ensureSemaphore = new SemaphoreSlim(1, 1); internal async Task EnsureSeriesInfo(Dictionary seriesProviderIds, string preferredMetadataLanguage, CancellationToken cancellationToken) { await _ensureSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); @@ -348,7 +348,7 @@ namespace MediaBrowser.Providers.TV try { string seriesId; - if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId)) { var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); @@ -362,7 +362,7 @@ namespace MediaBrowser.Providers.TV return seriesDataPath; } - if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId)) { var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); @@ -1300,14 +1300,14 @@ namespace MediaBrowser.Providers.TV internal static string GetSeriesDataPath(IApplicationPaths appPaths, Dictionary seriesProviderIds) { string seriesId; - if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId)) { var seriesDataPath = Path.Combine(GetSeriesDataPath(appPaths), seriesId); return seriesDataPath; } - if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId)) + if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId)) { var seriesDataPath = Path.Combine(GetSeriesDataPath(appPaths), seriesId); @@ -1317,14 +1317,14 @@ namespace MediaBrowser.Providers.TV return null; } - public string GetSeriesXmlPath(Dictionary seriesProviderIds, string language) - { - var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); + public string GetSeriesXmlPath(Dictionary seriesProviderIds, string language) + { + var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); - var seriesXmlFilename = language.ToLower() + ".xml"; + var seriesXmlFilename = language.ToLower() + ".xml"; - return Path.Combine (seriesDataPath, seriesXmlFilename); - } + return Path.Combine(seriesDataPath, seriesXmlFilename); + } /// /// Gets the series data path. @@ -1466,4 +1466,4 @@ namespace MediaBrowser.Providers.TV }; } } -} +} \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs index 845fcdff2..43bd2f29c 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/TvFolderOrganizer.cs @@ -84,7 +84,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization } catch (Exception ex) { - _logger.ErrorException("Error organizing episode {0}", ex, file); + _logger.ErrorException("Error organizing episode {0}", ex, file.FullName); } numComplete++; @@ -132,7 +132,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization { try { - return _fileSystem.GetFiles(path, true) + return _fileSystem.GetFiles(path, true) .ToList(); } catch (IOException ex) @@ -150,7 +150,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization /// The extensions. private void DeleteLeftOverFiles(string path, IEnumerable extensions) { - var eligibleFiles = _fileSystem.GetFiles(path, true) + var eligibleFiles = _fileSystem.GetFiles(path, true) .Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase)) .ToList(); @@ -206,4 +206,4 @@ namespace MediaBrowser.Server.Implementations.FileOrganization return watchLocations.Contains(path, StringComparer.OrdinalIgnoreCase); } } -} +} \ No newline at end of file -- cgit v1.2.3 From ca83644e1cf936d3f95572cad8a35fba0148e1b7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 4 Mar 2016 23:16:55 -0500 Subject: handle no subs setting --- MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs index e4a085f42..dfc6fc125 100644 --- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs +++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs @@ -17,6 +17,7 @@ using System.Threading; using System.Threading.Tasks; using CommonIO; using MediaBrowser.Common.IO; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Server.Implementations.Library { @@ -276,7 +277,7 @@ namespace MediaBrowser.Server.Implementations.Library private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user) { - if (userData.SubtitleStreamIndex.HasValue && user.Configuration.RememberSubtitleSelections) + if (userData.SubtitleStreamIndex.HasValue && user.Configuration.RememberSubtitleSelections && user.Configuration.SubtitleMode != SubtitlePlaybackMode.None) { var index = userData.SubtitleStreamIndex.Value; // Make sure the saved index is still valid -- cgit v1.2.3 From 62023e986aeba762caf9c9f2a2dbe5f5d3177a09 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 5 Mar 2016 13:29:14 -0500 Subject: re-enable sat/ip --- .../LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs | 438 ++++++++++----------- .../LiveTv/TunerHosts/SatIp/SatIpHost.cs | 298 +++++++------- 2 files changed, 368 insertions(+), 368 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs index f6db2f5a8..6781e498a 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs @@ -21,225 +21,225 @@ using MediaBrowser.Model.Serialization; namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp { - //public class SatIpDiscovery : IServerEntryPoint - //{ - // private readonly IDeviceDiscovery _deviceDiscovery; - // private readonly IServerConfigurationManager _config; - // private readonly ILogger _logger; - // private readonly ILiveTvManager _liveTvManager; - // private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); - // private readonly IHttpClient _httpClient; - // private readonly IJsonSerializer _json; - - // public static SatIpDiscovery Current; - - // private readonly List _discoveredHosts = new List(); - - // public List DiscoveredHosts - // { - // get { return _discoveredHosts.ToList(); } - // } - - // public SatIpDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json) - // { - // _deviceDiscovery = deviceDiscovery; - // _config = config; - // _logger = logger; - // _liveTvManager = liveTvManager; - // _httpClient = httpClient; - // _json = json; - // Current = this; - // } - - // public void Run() - // { - // _deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered; - // } - - // void _deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e) - // { - // string st = null; - // string nt = null; - // e.Headers.TryGetValue("ST", out st); - // e.Headers.TryGetValue("NT", out nt); - - // if (string.Equals(st, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase) || - // string.Equals(nt, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase)) - // { - // string location; - // if (e.Headers.TryGetValue("Location", out location) && !string.IsNullOrWhiteSpace(location)) - // { - // _logger.Debug("SAT IP found at {0}", location); - - // // Just get the beginning of the url - // AddDevice(location); - // } - // } - // } - - // private async void AddDevice(string location) - // { - // await _semaphore.WaitAsync().ConfigureAwait(false); - - // try - // { - // if (_discoveredHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(location, i.Url, StringComparison.OrdinalIgnoreCase))) - // { - // return; - // } - - // _logger.Debug("Will attempt to add SAT device {0}", location); - // var info = await GetInfo(location, CancellationToken.None).ConfigureAwait(false); - - // _discoveredHosts.Add(info); - // } - // catch (OperationCanceledException) - // { - - // } - // catch (NotImplementedException) - // { - - // } - // catch (Exception ex) - // { - // _logger.ErrorException("Error saving device", ex); - // } - // finally - // { - // _semaphore.Release(); - // } - // } - - // public void Dispose() - // { - // } - - // public async Task GetInfo(string url, CancellationToken cancellationToken) - // { - // var result = new SatIpTunerHostInfo - // { - // Url = url, - // IsEnabled = true, - // Type = SatIpHost.DeviceType, - // Tuners = 1, - // TunersAvailable = 1 - // }; - - // using (var stream = await _httpClient.Get(url, cancellationToken).ConfigureAwait(false)) - // { - // using (var streamReader = new StreamReader(stream)) - // { - // // Use XmlReader for best performance - // using (var reader = XmlReader.Create(streamReader)) - // { - // reader.MoveToContent(); - - // // Loop through each element - // while (reader.Read()) - // { - // if (reader.NodeType == XmlNodeType.Element) - // { - // switch (reader.Name) - // { - // case "device": - // using (var subtree = reader.ReadSubtree()) - // { - // FillFromDeviceNode(result, subtree); - // } - // break; - // default: - // reader.Skip(); - // break; - // } - // } - // } - // } - // } - // } - - // if (string.IsNullOrWhiteSpace(result.Id)) - // { - // throw new NotImplementedException(); - // } - - // // Device hasn't implemented an m3u list - // if (string.IsNullOrWhiteSpace(result.M3UUrl)) - // { - // result.IsEnabled = false; - // } - - // else if (!result.M3UUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - // { - // var fullM3uUrl = url.Substring(0, url.LastIndexOf('/')); - // result.M3UUrl = fullM3uUrl + "/" + result.M3UUrl.TrimStart('/'); - // } - - // _logger.Debug("SAT device result: {0}", _json.SerializeToString(result)); - - // return result; - // } - - // private void FillFromDeviceNode(SatIpTunerHostInfo info, XmlReader reader) - // { - // reader.MoveToContent(); - - // while (reader.Read()) - // { - // if (reader.NodeType == XmlNodeType.Element) - // { - // switch (reader.LocalName) - // { - // case "UDN": - // { - // info.Id = reader.ReadElementContentAsString(); - // break; - // } - - // case "friendlyName": - // { - // info.FriendlyName = reader.ReadElementContentAsString(); - // break; - // } - - // case "satip:X_SATIPCAP": - // case "X_SATIPCAP": - // { - // // DVBS2-2 - // var value = reader.ReadElementContentAsString() ?? string.Empty; - // var parts = value.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries); - // if (parts.Length == 2) - // { - // int intValue; - // if (int.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out intValue)) - // { - // info.TunersAvailable = intValue; - // } - - // if (int.TryParse(parts[0].Substring(parts[0].Length - 1), NumberStyles.Any, CultureInfo.InvariantCulture, out intValue)) - // { - // info.Tuners = intValue; - // } - // } - // break; - // } - - // case "satip:X_SATIPM3U": - // case "X_SATIPM3U": - // { - // // /channellist.lua?select=m3u - // info.M3UUrl = reader.ReadElementContentAsString(); - // break; - // } - - // default: - // reader.Skip(); - // break; - // } - // } - // } - // } - //} + public class SatIpDiscovery : IServerEntryPoint + { + private readonly IDeviceDiscovery _deviceDiscovery; + private readonly IServerConfigurationManager _config; + private readonly ILogger _logger; + private readonly ILiveTvManager _liveTvManager; + private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); + private readonly IHttpClient _httpClient; + private readonly IJsonSerializer _json; + + public static SatIpDiscovery Current; + + private readonly List _discoveredHosts = new List(); + + public List DiscoveredHosts + { + get { return _discoveredHosts.ToList(); } + } + + public SatIpDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json) + { + _deviceDiscovery = deviceDiscovery; + _config = config; + _logger = logger; + _liveTvManager = liveTvManager; + _httpClient = httpClient; + _json = json; + Current = this; + } + + public void Run() + { + _deviceDiscovery.DeviceDiscovered += _deviceDiscovery_DeviceDiscovered; + } + + void _deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e) + { + string st = null; + string nt = null; + e.Headers.TryGetValue("ST", out st); + e.Headers.TryGetValue("NT", out nt); + + if (string.Equals(st, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase) || + string.Equals(nt, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase)) + { + string location; + if (e.Headers.TryGetValue("Location", out location) && !string.IsNullOrWhiteSpace(location)) + { + _logger.Debug("SAT IP found at {0}", location); + + // Just get the beginning of the url + AddDevice(location); + } + } + } + + private async void AddDevice(string location) + { + await _semaphore.WaitAsync().ConfigureAwait(false); + + try + { + if (_discoveredHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(location, i.Url, StringComparison.OrdinalIgnoreCase))) + { + return; + } + + _logger.Debug("Will attempt to add SAT device {0}", location); + var info = await GetInfo(location, CancellationToken.None).ConfigureAwait(false); + + _discoveredHosts.Add(info); + } + catch (OperationCanceledException) + { + + } + catch (NotImplementedException) + { + + } + catch (Exception ex) + { + _logger.ErrorException("Error saving device", ex); + } + finally + { + _semaphore.Release(); + } + } + + public void Dispose() + { + } + + public async Task GetInfo(string url, CancellationToken cancellationToken) + { + var result = new SatIpTunerHostInfo + { + Url = url, + IsEnabled = true, + Type = SatIpHost.DeviceType, + Tuners = 1, + TunersAvailable = 1 + }; + + using (var stream = await _httpClient.Get(url, cancellationToken).ConfigureAwait(false)) + { + using (var streamReader = new StreamReader(stream)) + { + // Use XmlReader for best performance + using (var reader = XmlReader.Create(streamReader)) + { + reader.MoveToContent(); + + // Loop through each element + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "device": + using (var subtree = reader.ReadSubtree()) + { + FillFromDeviceNode(result, subtree); + } + break; + default: + reader.Skip(); + break; + } + } + } + } + } + } + + if (string.IsNullOrWhiteSpace(result.Id)) + { + throw new NotImplementedException(); + } + + // Device hasn't implemented an m3u list + if (string.IsNullOrWhiteSpace(result.M3UUrl)) + { + result.IsEnabled = false; + } + + else if (!result.M3UUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + { + var fullM3uUrl = url.Substring(0, url.LastIndexOf('/')); + result.M3UUrl = fullM3uUrl + "/" + result.M3UUrl.TrimStart('/'); + } + + _logger.Debug("SAT device result: {0}", _json.SerializeToString(result)); + + return result; + } + + private void FillFromDeviceNode(SatIpTunerHostInfo info, XmlReader reader) + { + reader.MoveToContent(); + + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.LocalName) + { + case "UDN": + { + info.Id = reader.ReadElementContentAsString(); + break; + } + + case "friendlyName": + { + info.FriendlyName = reader.ReadElementContentAsString(); + break; + } + + case "satip:X_SATIPCAP": + case "X_SATIPCAP": + { + // DVBS2-2 + var value = reader.ReadElementContentAsString() ?? string.Empty; + var parts = value.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries); + if (parts.Length == 2) + { + int intValue; + if (int.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out intValue)) + { + info.TunersAvailable = intValue; + } + + if (int.TryParse(parts[0].Substring(parts[0].Length - 1), NumberStyles.Any, CultureInfo.InvariantCulture, out intValue)) + { + info.Tuners = intValue; + } + } + break; + } + + case "satip:X_SATIPM3U": + case "X_SATIPM3U": + { + // /channellist.lua?select=m3u + info.M3UUrl = reader.ReadElementContentAsString(); + break; + } + + default: + reader.Skip(); + break; + } + } + } + } + } public class SatIpTunerHostInfo : TunerHostInfo { diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs index 11213be23..d305a886a 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs @@ -19,153 +19,153 @@ using MediaBrowser.Model.Serialization; namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp { - //public class SatIpHost : BaseTunerHost, ITunerHost - //{ - // private readonly IFileSystem _fileSystem; - // private readonly IHttpClient _httpClient; - - // public SatIpHost(IConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient) - // : base(config, logger, jsonSerializer, mediaEncoder) - // { - // _fileSystem = fileSystem; - // _httpClient = httpClient; - // } - - // private const string ChannelIdPrefix = "sat_"; - - // protected override async Task> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken) - // { - // var satInfo = (SatIpTunerHostInfo) tuner; - - // return await new M3uParser(Logger, _fileSystem, _httpClient).Parse(satInfo.M3UUrl, ChannelIdPrefix, tuner.Id, cancellationToken).ConfigureAwait(false); - // } - - // public static string DeviceType - // { - // get { return "satip"; } - // } - - // public override string Type - // { - // get { return DeviceType; } - // } - - // protected override async Task> GetChannelStreamMediaSources(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken) - // { - // var urlHash = tuner.Url.GetMD5().ToString("N"); - // var prefix = ChannelIdPrefix + urlHash; - // if (!channelId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) - // { - // return null; - // } - - // var channels = await GetChannels(tuner, true, cancellationToken).ConfigureAwait(false); - // var m3uchannels = channels.Cast(); - // var channel = m3uchannels.FirstOrDefault(c => string.Equals(c.Id, channelId, StringComparison.OrdinalIgnoreCase)); - // if (channel != null) - // { - // var path = channel.Path; - // MediaProtocol protocol = MediaProtocol.File; - // if (path.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - // { - // protocol = MediaProtocol.Http; - // } - // else if (path.StartsWith("rtmp", StringComparison.OrdinalIgnoreCase)) - // { - // protocol = MediaProtocol.Rtmp; - // } - // else if (path.StartsWith("rtsp", StringComparison.OrdinalIgnoreCase)) - // { - // protocol = MediaProtocol.Rtsp; - // } - - // var mediaSource = new MediaSourceInfo - // { - // Path = channel.Path, - // Protocol = protocol, - // MediaStreams = new List - // { - // new MediaStream - // { - // Type = MediaStreamType.Video, - // // Set the index to -1 because we don't know the exact index of the video stream within the container - // Index = -1, - // IsInterlaced = true - // }, - // new MediaStream - // { - // Type = MediaStreamType.Audio, - // // Set the index to -1 because we don't know the exact index of the audio stream within the container - // Index = -1 - - // } - // }, - // RequiresOpening = false, - // RequiresClosing = false - // }; - - // return new List { mediaSource }; - // } - // return new List { }; - // } - - // protected override async Task GetChannelStream(TunerHostInfo tuner, string channelId, string streamId, CancellationToken cancellationToken) - // { - // var sources = await GetChannelStreamMediaSources(tuner, channelId, cancellationToken).ConfigureAwait(false); - - // return sources.First(); - // } - - // protected override async Task IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken) - // { - // var updatedInfo = await SatIpDiscovery.Current.GetInfo(tuner.Url, cancellationToken).ConfigureAwait(false); - - // return updatedInfo.TunersAvailable > 0; - // } - - // protected override bool IsValidChannelId(string channelId) - // { - // return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); - // } - - // protected override List GetTunerHosts() - // { - // return SatIpDiscovery.Current.DiscoveredHosts; - // } - - // public string Name - // { - // get { return "Sat IP"; } - // } - - // public Task> GetTunerInfos(CancellationToken cancellationToken) - // { - // var list = GetTunerHosts() - // .SelectMany(i => GetTunerInfos(i, cancellationToken)) - // .ToList(); - - // return Task.FromResult(list); - // } - - // public List GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken) - // { - // var satInfo = (SatIpTunerHostInfo) info; - - // var list = new List(); - - // for (var i = 0; i < satInfo.Tuners; i++) - // { - // list.Add(new LiveTvTunerInfo - // { - // Name = satInfo.FriendlyName ?? Name, - // SourceType = Type, - // Status = LiveTvTunerStatus.Available, - // Id = info.Url.GetMD5().ToString("N") + i.ToString(CultureInfo.InvariantCulture), - // Url = info.Url - // }); - // } - - // return list; - // } - //} + public class SatIpHost : BaseTunerHost, ITunerHost + { + private readonly IFileSystem _fileSystem; + private readonly IHttpClient _httpClient; + + public SatIpHost(IConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient) + : base(config, logger, jsonSerializer, mediaEncoder) + { + _fileSystem = fileSystem; + _httpClient = httpClient; + } + + private const string ChannelIdPrefix = "sat_"; + + protected override async Task> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken) + { + var satInfo = (SatIpTunerHostInfo)tuner; + + return await new M3uParser(Logger, _fileSystem, _httpClient).Parse(satInfo.M3UUrl, ChannelIdPrefix, tuner.Id, cancellationToken).ConfigureAwait(false); + } + + public static string DeviceType + { + get { return "satip"; } + } + + public override string Type + { + get { return DeviceType; } + } + + protected override async Task> GetChannelStreamMediaSources(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken) + { + var urlHash = tuner.Url.GetMD5().ToString("N"); + var prefix = ChannelIdPrefix + urlHash; + if (!channelId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) + { + return null; + } + + var channels = await GetChannels(tuner, true, cancellationToken).ConfigureAwait(false); + var m3uchannels = channels.Cast(); + var channel = m3uchannels.FirstOrDefault(c => string.Equals(c.Id, channelId, StringComparison.OrdinalIgnoreCase)); + if (channel != null) + { + var path = channel.Path; + MediaProtocol protocol = MediaProtocol.File; + if (path.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + { + protocol = MediaProtocol.Http; + } + else if (path.StartsWith("rtmp", StringComparison.OrdinalIgnoreCase)) + { + protocol = MediaProtocol.Rtmp; + } + else if (path.StartsWith("rtsp", StringComparison.OrdinalIgnoreCase)) + { + protocol = MediaProtocol.Rtsp; + } + + var mediaSource = new MediaSourceInfo + { + Path = channel.Path, + Protocol = protocol, + MediaStreams = new List + { + new MediaStream + { + Type = MediaStreamType.Video, + // Set the index to -1 because we don't know the exact index of the video stream within the container + Index = -1, + IsInterlaced = true + }, + new MediaStream + { + Type = MediaStreamType.Audio, + // Set the index to -1 because we don't know the exact index of the audio stream within the container + Index = -1 + + } + }, + RequiresOpening = false, + RequiresClosing = false + }; + + return new List { mediaSource }; + } + return new List { }; + } + + protected override async Task GetChannelStream(TunerHostInfo tuner, string channelId, string streamId, CancellationToken cancellationToken) + { + var sources = await GetChannelStreamMediaSources(tuner, channelId, cancellationToken).ConfigureAwait(false); + + return sources.First(); + } + + protected override async Task IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken) + { + var updatedInfo = await SatIpDiscovery.Current.GetInfo(tuner.Url, cancellationToken).ConfigureAwait(false); + + return updatedInfo.TunersAvailable > 0; + } + + protected override bool IsValidChannelId(string channelId) + { + return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); + } + + protected override List GetTunerHosts() + { + return SatIpDiscovery.Current.DiscoveredHosts; + } + + public string Name + { + get { return "Sat IP"; } + } + + public Task> GetTunerInfos(CancellationToken cancellationToken) + { + var list = GetTunerHosts() + .SelectMany(i => GetTunerInfos(i, cancellationToken)) + .ToList(); + + return Task.FromResult(list); + } + + public List GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken) + { + var satInfo = (SatIpTunerHostInfo)info; + + var list = new List(); + + for (var i = 0; i < satInfo.Tuners; i++) + { + list.Add(new LiveTvTunerInfo + { + Name = satInfo.FriendlyName ?? Name, + SourceType = Type, + Status = LiveTvTunerStatus.Available, + Id = info.Url.GetMD5().ToString("N") + i.ToString(CultureInfo.InvariantCulture), + Url = info.Url + }); + } + + return list; + } + } } -- cgit v1.2.3 From 44723dd076e057a0862c0df373ab3a6d0107dfd7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 5 Mar 2016 16:02:43 -0500 Subject: ipv6 fix --- .../MediaBrowser.Server.Implementations.csproj | 4 ++-- MediaBrowser.Server.Implementations/packages.config | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index f1fbafc76..0ad345a2a 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -65,9 +65,9 @@ ..\ThirdParty\ServiceStack\ServiceStack.Api.Swagger.dll - + False - ..\packages\SocketHttpListener.1.0.0.28\lib\net45\SocketHttpListener.dll + ..\packages\SocketHttpListener.1.0.0.29\lib\net45\SocketHttpListener.dll diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index bbabeda6d..456f1a4c5 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -7,5 +7,5 @@ - + \ No newline at end of file -- cgit v1.2.3 From a8296cba37357a476b279bccd8d085ce123c600a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 6 Mar 2016 23:56:45 -0500 Subject: update recording stop --- MediaBrowser.Api/Playback/BaseStreamingService.cs | 11 +++++++ MediaBrowser.Model/Dlna/StreamBuilder.cs | 19 +++++++++++- MediaBrowser.Model/Dlna/StreamInfo.cs | 3 +- MediaBrowser.Model/Session/PlaybackStopInfo.cs | 9 +++--- .../LiveTv/EmbyTV/EncodedRecorder.cs | 28 +++++++++++------ .../LiveTv/LiveTvManager.cs | 9 ++++-- .../Session/SessionManager.cs | 36 ++++++++++++---------- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Model.Signed.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +-- 11 files changed, 86 insertions(+), 41 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index f66363da6..4db70df9c 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1482,6 +1482,17 @@ namespace MediaBrowser.Api.Playback videoRequest.CopyTimestamps = string.Equals("true", val, StringComparison.OrdinalIgnoreCase); } } + else if (i == 25) + { + if (!string.IsNullOrWhiteSpace(val) && videoRequest != null) + { + SubtitleDeliveryMethod method; + if (Enum.TryParse(val, out method)) + { + videoRequest.SubtitleMethod = method; + } + } + } } } diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 7d7360759..665da030d 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -423,7 +423,24 @@ namespace MediaBrowser.Model.Dlna playlistItem.Container = transcodingProfile.Container; playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength; playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo; - playlistItem.AudioCodec = transcodingProfile.AudioCodec.Split(',')[0]; + + // TODO: We should probably preserve the full list and sent it tp the server that way + string[] supportedAudioCodecs = transcodingProfile.AudioCodec.Split(','); + string inputAudioCodec = audioStream == null ? null : audioStream.Codec; + foreach (string supportedAudioCodec in supportedAudioCodecs) + { + if (StringHelper.EqualsIgnoreCase(supportedAudioCodec, inputAudioCodec)) + { + playlistItem.AudioCodec = supportedAudioCodec; + break; + } + } + + if (string.IsNullOrEmpty(playlistItem.AudioCodec)) + { + playlistItem.AudioCodec = supportedAudioCodecs[0]; + } + playlistItem.VideoCodec = transcodingProfile.VideoCodec; playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps; playlistItem.SubProtocol = transcodingProfile.Protocol; diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 79ee1b5c5..69733cefb 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -234,7 +234,8 @@ namespace MediaBrowser.Model.Dlna } list.Add(new NameValuePair("CopyTimestamps", (item.CopyTimestamps).ToString().ToLower())); - + list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty)); + return list; } diff --git a/MediaBrowser.Model/Session/PlaybackStopInfo.cs b/MediaBrowser.Model/Session/PlaybackStopInfo.cs index 80d719f03..3b4ac36a7 100644 --- a/MediaBrowser.Model/Session/PlaybackStopInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackStopInfo.cs @@ -12,25 +12,21 @@ namespace MediaBrowser.Model.Session /// /// The item. public BaseItemInfo Item { get; set; } - /// /// Gets or sets the item identifier. /// /// The item identifier. public string ItemId { get; set; } - /// /// Gets or sets the session id. /// /// The session id. public string SessionId { get; set; } - /// /// Gets or sets the media version identifier. /// /// The media version identifier. public string MediaSourceId { get; set; } - /// /// Gets or sets the position ticks. /// @@ -46,5 +42,10 @@ namespace MediaBrowser.Model.Session /// /// The play session identifier. public string PlaySessionId { get; set; } + /// + /// Gets or sets a value indicating whether this is failed. + /// + /// true if failed; otherwise, false. + public bool Failed { get; set; } } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 62c9cd171..69cc8ebf7 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -28,6 +28,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV private string _targetPath; private Process _process; private readonly IJsonSerializer _json; + private readonly TaskCompletionSource _taskCompletionSource = new TaskCompletionSource(); public EncodedRecorder(ILogger logger, IFileSystem fileSystem, IMediaEncoder mediaEncoder, IApplicationPaths appPaths, IJsonSerializer json) { @@ -93,11 +94,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback StartStreamingLog(process.StandardError.BaseStream, _logFileStream); - // Wait for the file to exist before proceeeding - while (!_hasExited) - { - await Task.Delay(100, cancellationToken).ConfigureAwait(false); - } + await _taskCompletionSource.Task.ConfigureAwait(false); } private string GetCommandLineArgs(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration) @@ -197,16 +194,27 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { _hasExited = true; - _logger.Debug("Disposing stream resources"); DisposeLogStream(); try { - _logger.Info("FFMpeg exited with code {0}", process.ExitCode); + var exitCode = process.ExitCode; + + _logger.Info("FFMpeg recording exited with code {0} for {1}", exitCode, _targetPath); + + if (exitCode == 0) + { + _taskCompletionSource.TrySetResult(true); + } + else + { + _taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed. Exit code {1}", _targetPath, exitCode))); + } } catch { - _logger.Error("FFMpeg exited with an error."); + _logger.Error("FFMpeg recording exited with an error for {0}.", _targetPath); + _taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed", _targetPath))); } } @@ -220,7 +228,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } catch (Exception ex) { - _logger.ErrorException("Error disposing log stream", ex); + _logger.ErrorException("Error disposing recording log stream", ex); } _logFileStream = null; @@ -250,7 +258,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } catch (Exception ex) { - _logger.ErrorException("Error reading ffmpeg log", ex); + _logger.ErrorException("Error reading ffmpeg recording log", ex); } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index abb2710e7..bb522082a 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -865,10 +865,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); } - _providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem) + if (info.Status != RecordingStatus.InProgress) { - MetadataRefreshMode = metadataRefreshMode - }); + _providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem) + { + MetadataRefreshMode = metadataRefreshMode + }); + } return item.Id; } diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 08953b0be..824e5e0e8 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -813,7 +813,7 @@ namespace MediaBrowser.Server.Implementations.Session foreach (var user in users) { - playedToCompletion = await OnPlaybackStopped(user.Id, key, libraryItem, info.PositionTicks).ConfigureAwait(false); + playedToCompletion = await OnPlaybackStopped(user.Id, key, libraryItem, info.PositionTicks, info.Failed).ConfigureAwait(false); } } @@ -846,25 +846,29 @@ namespace MediaBrowser.Server.Implementations.Session await SendPlaybackStoppedNotification(session, CancellationToken.None).ConfigureAwait(false); } - private async Task OnPlaybackStopped(Guid userId, string userDataKey, BaseItem item, long? positionTicks) + private async Task OnPlaybackStopped(Guid userId, string userDataKey, BaseItem item, long? positionTicks, bool playbackFailed) { - var data = _userDataRepository.GetUserData(userId, userDataKey); - bool playedToCompletion; + bool playedToCompletion = false; - if (positionTicks.HasValue) + if (!playbackFailed) { - playedToCompletion = _userDataRepository.UpdatePlayState(item, data, positionTicks.Value); - } - else - { - // If the client isn't able to report this, then we'll just have to make an assumption - data.PlayCount++; - data.Played = true; - data.PlaybackPositionTicks = 0; - playedToCompletion = true; - } + var data = _userDataRepository.GetUserData(userId, userDataKey); + + if (positionTicks.HasValue) + { + playedToCompletion = _userDataRepository.UpdatePlayState(item, data, positionTicks.Value); + } + else + { + // If the client isn't able to report this, then we'll just have to make an assumption + data.PlayCount++; + data.Played = true; + data.PlaybackPositionTicks = 0; + playedToCompletion = true; + } - await _userDataRepository.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None).ConfigureAwait(false); + await _userDataRepository.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackFinished, CancellationToken.None).ConfigureAwait(false); + } return playedToCompletion; } diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 0bb8c830f..259eb6f89 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.642 + 3.0.643 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption. Copyright © Emby 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index a290a424a..d1cb66cbb 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.642 + 3.0.643 MediaBrowser.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index 2017cc1ae..056359ae4 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Model.Signed - 3.0.642 + 3.0.643 MediaBrowser.Model - Signed Edition Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 36c9ff415..6737a432f 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.642 + 3.0.643 Media Browser.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + -- cgit v1.2.3 From 3c4b64f6533721f3cb177a77967f154b90ee33cc Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 7 Mar 2016 21:59:21 -0500 Subject: update handling of deleted recording files --- MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs | 12 +++---- MediaBrowser.Controller/Entities/BaseItem.cs | 13 +++++-- MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 7 ++++ .../LiveTv/LiveTvAudioRecording.cs | 5 +++ .../LiveTv/LiveTvVideoRecording.cs | 5 +++ .../LiveTv/LiveTvManager.cs | 41 ++++++++++------------ .../Persistence/CleanDatabaseScheduledTask.cs | 12 ++----- 7 files changed, 55 insertions(+), 40 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs index 4693a54aa..000c02256 100644 --- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs @@ -529,6 +529,11 @@ namespace MediaBrowser.Api.Playback.Hls "subs" : null; + if (!string.IsNullOrWhiteSpace(subtitleGroup)) + { + AddSubtitles(state, subtitleStreams, builder); + } + AppendPlaylist(builder, state, playlistUrl, totalBitrate, subtitleGroup); if (EnableAdaptiveBitrateStreaming(state, isLiveStream)) @@ -548,11 +553,6 @@ namespace MediaBrowser.Api.Playback.Hls AppendPlaylist(builder, state, variantUrl, newBitrate, subtitleGroup); } - if (!string.IsNullOrWhiteSpace(subtitleGroup)) - { - AddSubtitles(state, subtitleStreams, builder); - } - return builder.ToString(); } @@ -570,7 +570,7 @@ namespace MediaBrowser.Api.Playback.Hls foreach (var stream in subtitles) { - const string format = "#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"{0}\",DEFAULT={1},FORCED={2},URI=\"{3}\",LANGUAGE=\"{4}\""; + const string format = "#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID=\"subs\",NAME=\"{0}\",DEFAULT={1},FORCED={2},AUTOSELECT=YES,URI=\"{3}\",LANGUAGE=\"{4}\""; var name = stream.Language; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 3dfbdec56..bd4ede466 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1835,8 +1835,8 @@ namespace MediaBrowser.Controller.Entities ProviderIds = ProviderIds, IndexNumber = IndexNumber, ParentIndexNumber = ParentIndexNumber, - Year = ProductionYear, - PremiereDate = PremiereDate + Year = ProductionYear, + PremiereDate = PremiereDate }; } @@ -1985,5 +1985,14 @@ namespace MediaBrowser.Controller.Entities { return LibraryManager.DeleteItem(this, options); } + + public virtual Task OnFileDeleted() + { + // Remove from database + return Delete(new DeleteOptions + { + DeleteFileLocation = false + }); + } } } \ No newline at end of file diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 501e48a74..5dffb5e9b 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -390,5 +390,12 @@ namespace MediaBrowser.Controller.LiveTv /// The options. /// The user. void AddChannelInfo(BaseItemDto dto, LiveTvChannel channel, DtoOptions options, User user); + + /// + /// Called when [recording file deleted]. + /// + /// The recording. + /// Task. + Task OnRecordingFileDeleted(ILiveTvRecording recording); } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs index c3d843f85..6f72ae1fb 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs @@ -151,5 +151,10 @@ namespace MediaBrowser.Controller.LiveTv { return LiveTvManager.DeleteRecording(this); } + + public override Task OnFileDeleted() + { + return LiveTvManager.OnRecordingFileDeleted(this); + } } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs index 5492a29f3..ce0c69dee 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs @@ -166,5 +166,10 @@ namespace MediaBrowser.Controller.LiveTv { return LiveTvManager.DeleteRecording(this); } + + public override Task OnFileDeleted() + { + return LiveTvManager.OnRecordingFileDeleted(this); + } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index bb522082a..6b848d0f6 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -926,16 +926,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv var queryResult = _libraryManager.QueryItems(internalQuery); - var returnArray = queryResult.Items - .Cast() - .Select(i => new Tuple(_dtoService.GetBaseItemDto(i, options, user), i.ServiceName, i.ExternalId)) - .ToArray(); - - await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false); + var returnArray = _dtoService.GetBaseItemDtos(queryResult.Items, options, user).ToArray(); var result = new QueryResult { - Items = returnArray.Select(i => i.Item1).ToArray(), + Items = returnArray, TotalRecordCount = queryResult.TotalRecordCount }; @@ -1006,15 +1001,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv var user = _userManager.GetUserById(query.UserId); - var returnArray = internalResult.Items - .Select(i => new Tuple(_dtoService.GetBaseItemDto(i, options, user), i.ServiceName, i.ExternalId)) - .ToArray(); - - await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false); + var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ToArray(); var result = new QueryResult { - Items = returnArray.Select(i => i.Item1).ToArray(), + Items = returnArray, TotalRecordCount = internalResult.TotalRecordCount }; @@ -1635,18 +1626,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv var internalResult = await GetInternalRecordings(query, cancellationToken).ConfigureAwait(false); - var tuples = internalResult.Items - .Select(i => new Tuple(i, _dtoService.GetBaseItemDto(i, options, user))) - .ToArray(); - - if (user != null) - { - _dtoService.FillSyncInfo(tuples, new DtoOptions(), user); - } + var returnArray = _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ToArray(); return new QueryResult { - Items = tuples.Select(i => i.Item2).ToArray(), + Items = returnArray, TotalRecordCount = internalResult.TotalRecordCount }; } @@ -1707,6 +1691,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv }; } + public Task OnRecordingFileDeleted(ILiveTvRecording recording) + { + var service = GetService(recording); + + if (service is EmbyTV.EmbyTV) + { + // We can't trust that we'll be able to direct stream it through emby server, no matter what the provider says + return service.DeleteRecordingAsync(recording.ExternalId, CancellationToken.None); + } + + return Task.FromResult(true); + } + public async Task DeleteRecording(string recordingId) { var recording = await GetInternalRecording(recordingId, CancellationToken.None).ConfigureAwait(false); diff --git a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs index 5f1bf0216..7ff81e5c1 100644 --- a/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Persistence/CleanDatabaseScheduledTask.cs @@ -239,11 +239,7 @@ namespace MediaBrowser.Server.Implementations.Persistence typeof(Year).Name, typeof(Channel).Name, typeof(AggregateFolder).Name, - typeof(CollectionFolder).Name, - - // LiveTVManager handles recordings - typeof(LiveTvAudioRecording).Name, - typeof(LiveTvVideoRecording).Name + typeof(CollectionFolder).Name } }); @@ -279,11 +275,7 @@ namespace MediaBrowser.Server.Implementations.Persistence _logger.Info("Deleting item from database {0} because path no longer exists. type: {1} path: {2}", libraryItem.Name, libraryItem.GetType().Name, libraryItem.Path ?? string.Empty); - await libraryItem.Delete(new DeleteOptions - { - DeleteFileLocation = false - - }).ConfigureAwait(false); + await libraryItem.OnFileDeleted().ConfigureAwait(false); } catch (OperationCanceledException) { -- cgit v1.2.3 From c3ad2c47db05b232bdcd43694645d4cd8c600a99 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 8 Mar 2016 00:00:03 -0500 Subject: adjust to hdhr address changing --- MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 1 + .../TunerHosts/HdHomerun/HdHomerunDiscovery.cs | 38 ++++++++++++++++------ .../LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs | 16 +++++++-- 3 files changed, 43 insertions(+), 12 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index e705102db..c6b8385b0 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -29,6 +29,7 @@ namespace MediaBrowser.Model.LiveTv public string Id { get; set; } public string Url { get; set; } public string Type { get; set; } + public string DeviceId { get; set; } public bool ImportFavoritesOnly { get; set; } public bool IsEnabled { get; set; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs index 0a03e60fa..aa4030b81 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs @@ -10,6 +10,7 @@ using System; using System.Linq; using System.Threading; using MediaBrowser.Common.Net; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun { @@ -21,6 +22,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun private readonly ILiveTvManager _liveTvManager; private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); private readonly IHttpClient _httpClient; + private IJsonSerializer _json; public HdHomerunDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient) { @@ -79,21 +81,37 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun url = new Uri(url).GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped).TrimEnd('/'); // Test it by pulling down the lineup - using (await _httpClient.Get(new HttpRequestOptions + using (var stream = await _httpClient.Get(new HttpRequestOptions { - Url = string.Format("{0}/lineup.json", url), + Url = string.Format("{0}/discover.json", url), CancellationToken = CancellationToken.None })) { - } - - await _liveTvManager.SaveTunerHost(new TunerHostInfo - { - Type = HdHomerunHost.DeviceType, - Url = url, - DataVersion = 1 + var response = _json.DeserializeFromStream(stream); - }).ConfigureAwait(false); + var existing = GetConfiguration().TunerHosts + .FirstOrDefault(i => string.Equals(i.Type, HdHomerunHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(i.DeviceId, response.DeviceID, StringComparison.OrdinalIgnoreCase)); + + if (existing == null) + { + await _liveTvManager.SaveTunerHost(new TunerHostInfo + { + Type = HdHomerunHost.DeviceType, + Url = url, + DataVersion = 1, + DeviceId = response.DeviceID + + }).ConfigureAwait(false); + } + else + { + if (!string.Equals(existing.Url, url, StringComparison.OrdinalIgnoreCase)) + { + existing.Url = url; + await _liveTvManager.SaveTunerHost(existing).ConfigureAwait(false); + } + } + } } catch (Exception ex) { diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index bdfbee521..1995fc311 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -415,9 +415,21 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun public async Task Validate(TunerHostInfo info) { - if (info.IsEnabled) + if (!info.IsEnabled) { - await GetChannels(info, false, CancellationToken.None).ConfigureAwait(false); + return; + } + + // Test it by pulling down the lineup + using (var stream = await _httpClient.Get(new HttpRequestOptions + { + Url = string.Format("{0}/discover.json", GetApiUrl(info, false)), + CancellationToken = CancellationToken.None + })) + { + var response = JsonSerializer.DeserializeFromStream(stream); + + info.DeviceId = response.DeviceID; } } -- cgit v1.2.3 From aa23da0dc44afbfe47a83d2dda0644472ad4e0e4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 9 Mar 2016 12:40:29 -0500 Subject: ipv6 fixes --- MediaBrowser.Controller/IServerApplicationHost.cs | 7 +++++++ MediaBrowser.Dlna/Main/DlnaEntryPoint.cs | 2 +- MediaBrowser.Dlna/PlayTo/PlayToManager.cs | 2 +- .../Connect/ConnectManager.cs | 16 +++++++++++----- MediaBrowser.Server.Startup.Common/ApplicationHost.cs | 17 ++++++++++++++--- 5 files changed, 34 insertions(+), 10 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index fb843d191..e4eecec18 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -79,5 +79,12 @@ namespace MediaBrowser.Controller /// The host. /// System.String. string GetLocalApiUrl(string host); + + /// + /// Gets the local API URL. + /// + /// The ip address. + /// System.String. + string GetLocalApiUrl(IPAddress ipAddress); } } diff --git a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs index 2133888b6..8a30fbf40 100644 --- a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs +++ b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs @@ -161,7 +161,7 @@ namespace MediaBrowser.Dlna.Main var descriptorURI = "/dlna/" + udn + "/description.xml"; - var uri = new Uri(_appHost.GetLocalApiUrl(addressString) + descriptorURI); + var uri = new Uri(_appHost.GetLocalApiUrl(address) + descriptorURI); var services = new List { diff --git a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs index 0328111c5..d2b48474c 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToManager.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToManager.cs @@ -171,7 +171,7 @@ namespace MediaBrowser.Dlna.PlayTo private string GetServerAddress(IPAddress localIp) { - return _appHost.GetLocalApiUrl(localIp.ToString()); + return _appHost.GetLocalApiUrl(localIp); } public void Dispose() diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index d7477225c..618b7ffc5 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -81,6 +81,12 @@ namespace MediaBrowser.Server.Implementations.Connect if (!ip.StartsWith("http://", StringComparison.OrdinalIgnoreCase) && !ip.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { + // Handle ipv6 + if (ip.IndexOf(':') != -1) + { + ip = "[" + ip + "]"; + } + ip = (_appHost.EnableHttps ? "https://" : "http://") + ip; } @@ -316,7 +322,7 @@ namespace MediaBrowser.Server.Implementations.Connect try { - _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); + _fileSystem.CreateDirectory(Path.GetDirectoryName(path)); var json = _json.SerializeToString(_data); @@ -324,7 +330,7 @@ namespace MediaBrowser.Server.Implementations.Connect lock (_dataFileLock) { - _fileSystem.WriteAllText(path, encrypted, Encoding.UTF8); + _fileSystem.WriteAllText(path, encrypted, Encoding.UTF8); } } catch (Exception ex) @@ -341,7 +347,7 @@ namespace MediaBrowser.Server.Implementations.Connect { lock (_dataFileLock) { - var encrypted = _fileSystem.ReadAllText(path, Encoding.UTF8); + var encrypted = _fileSystem.ReadAllText(path, Encoding.UTF8); var json = _encryption.DecryptString(encrypted); @@ -381,7 +387,7 @@ namespace MediaBrowser.Server.Implementations.Connect { await UpdateConnectInfo().ConfigureAwait(false); } - + await _operationLock.WaitAsync().ConfigureAwait(false); try @@ -480,7 +486,7 @@ namespace MediaBrowser.Server.Implementations.Connect { await UpdateConnectInfo().ConfigureAwait(false); } - + await _operationLock.WaitAsync().ConfigureAwait(false); try diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index b71fe365d..269c30669 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -97,6 +97,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Net; +using System.Net.Sockets; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -322,7 +323,7 @@ namespace MediaBrowser.Server.Startup.Common { TaskManager.SuspendTriggers = true; } - + await base.RunStartupTasks().ConfigureAwait(false); Logger.Info("ServerId: {0}", SystemId); @@ -1134,7 +1135,7 @@ namespace MediaBrowser.Server.Startup.Common if (address != null) { - return GetLocalApiUrl(address.ToString()); + return GetLocalApiUrl(address); } return null; @@ -1148,6 +1149,16 @@ namespace MediaBrowser.Server.Startup.Common } } + public string GetLocalApiUrl(IPAddress ipAddress) + { + if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6) + { + return GetLocalApiUrl("[" + ipAddress + "]"); + } + + return GetLocalApiUrl(ipAddress.ToString()); + } + public string GetLocalApiUrl(string host) { return string.Format("http://{0}:{1}", @@ -1180,7 +1191,7 @@ namespace MediaBrowser.Server.Startup.Common return true; } - var apiUrl = GetLocalApiUrl(address.ToString()); + var apiUrl = GetLocalApiUrl(address); apiUrl += "/system/ping"; if ((DateTime.UtcNow - _lastAddressCacheClear).TotalMinutes >= 5) -- cgit v1.2.3 From 3d97d50541bc070e4c035a8324d2fcd40badedd9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 10 Mar 2016 15:06:47 -0500 Subject: auto-organize updates --- .../FileOrganization/EpisodeFileOrganizer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs index f9e167a8f..349e31907 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs @@ -547,7 +547,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization if (series == null) { - SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(e => e.MatchStrings.Contains(seriesName, StringComparer.OrdinalIgnoreCase)); + SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(e => e.MatchStrings.Contains(nameWithoutYear, StringComparer.OrdinalIgnoreCase)); if (info != null) { -- cgit v1.2.3 From 146547b02e80b9224fa414238cd0e737c2a482d6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 12 Mar 2016 22:30:23 -0500 Subject: add error handling to recording parsing --- MediaBrowser.Api/TvShowsService.cs | 2 +- .../LiveTv/EmbyTV/ItemDataProvider.cs | 17 ++++++++++++++++- .../MediaBrowser.WebDashboard.csproj | 3 --- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs index 2dad9533f..2873dd8b4 100644 --- a/MediaBrowser.Api/TvShowsService.cs +++ b/MediaBrowser.Api/TvShowsService.cs @@ -273,7 +273,7 @@ namespace MediaBrowser.Api { var user = _userManager.GetUserById(request.UserId); - var minPremiereDate = DateTime.Now.Date.AddDays(-1).ToUniversalTime(); + var minPremiereDate = DateTime.Now.Date.ToUniversalTime(); var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId }; diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs index 68b3f1f71..a4eb23d99 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs @@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV try { - return _jsonSerializer.DeserializeFromFile>(jsonFile); + return _jsonSerializer.DeserializeFromFile>(jsonFile) ?? new List(); } catch (FileNotFoundException) { @@ -69,6 +69,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV private void UpdateList(List newList) { + if (newList == null) + { + throw new ArgumentNullException("newList"); + } + var file = _dataPath + ".json"; _fileSystem.CreateDirectory(Path.GetDirectoryName(file)); @@ -81,6 +86,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV public virtual void Update(T item) { + if (item == null) + { + throw new ArgumentNullException("item"); + } + var list = GetAll().ToList(); var index = list.FindIndex(i => EqualityComparer(i, item)); @@ -97,6 +107,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV public virtual void Add(T item) { + if (item == null) + { + throw new ArgumentNullException("item"); + } + var list = GetAll().ToList(); if (list.Any(i => EqualityComparer(i, item))) diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 5b8e2932a..74bc05fe8 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -341,9 +341,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest -- cgit v1.2.3 From 749037eb4a73c9ae4b66c787a381737427dd6eca Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 13 Mar 2016 03:34:17 -0400 Subject: update sat/ip discovery --- MediaBrowser.Model/ApiClient/ServerCredentials.cs | 5 -- MediaBrowser.Model/ApiClient/ServerInfo.cs | 1 - MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 3 + .../LiveTv/EmbyTV/EmbyTV.cs | 13 ++++ .../LiveTv/EmbyTV/ItemDataProvider.cs | 5 +- .../TunerHosts/HdHomerun/HdHomerunDiscovery.cs | 5 +- .../LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs | 72 +++++++++++++++++----- .../LiveTv/TunerHosts/SatIp/SatIpHost.cs | 15 +---- .../MediaBrowser.WebDashboard.csproj | 6 ++ 9 files changed, 86 insertions(+), 39 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Model/ApiClient/ServerCredentials.cs b/MediaBrowser.Model/ApiClient/ServerCredentials.cs index f9af0fa4e..0f0ab65d4 100644 --- a/MediaBrowser.Model/ApiClient/ServerCredentials.cs +++ b/MediaBrowser.Model/ApiClient/ServerCredentials.cs @@ -41,11 +41,6 @@ namespace MediaBrowser.Model.ApiClient { existing.DateLastAccessed = server.DateLastAccessed; } - - if (server.DateLastLocalConnection > existing.DateLastLocalConnection) - { - existing.DateLastLocalConnection = server.DateLastLocalConnection; - } existing.UserLinkType = server.UserLinkType; diff --git a/MediaBrowser.Model/ApiClient/ServerInfo.cs b/MediaBrowser.Model/ApiClient/ServerInfo.cs index 53ae5be52..e1fa581d7 100644 --- a/MediaBrowser.Model/ApiClient/ServerInfo.cs +++ b/MediaBrowser.Model/ApiClient/ServerInfo.cs @@ -19,7 +19,6 @@ namespace MediaBrowser.Model.ApiClient public String AccessToken { get; set; } public List WakeOnLanInfos { get; set; } public DateTime DateLastAccessed { get; set; } - public DateTime DateLastLocalConnection { get; set; } public String ExchangeToken { get; set; } public UserLinkType? UserLinkType { get; set; } public ConnectionMode? LastConnectionMode { get; set; } diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index c6b8385b0..78c683064 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -32,6 +32,9 @@ namespace MediaBrowser.Model.LiveTv public string DeviceId { get; set; } public bool ImportFavoritesOnly { get; set; } public bool IsEnabled { get; set; } + public string M3UUrl { get; set; } + public string FriendlyName { get; set; } + public int Tuners { get; set; } public int DataVersion { get; set; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index aa4583ef8..e00a68e32 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1008,6 +1008,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV private IEnumerable GetTimersForSeries(SeriesTimerInfo seriesTimer, IEnumerable allPrograms, IReadOnlyList currentRecordings) { + if (seriesTimer == null) + { + throw new ArgumentNullException("seriesTimer"); + } + if (allPrograms == null) + { + throw new ArgumentNullException("allPrograms"); + } + if (currentRecordings == null) + { + throw new ArgumentNullException("currentRecordings"); + } + // Exclude programs that have already ended allPrograms = allPrograms.Where(i => i.EndDate > DateTime.UtcNow && i.StartDate > DateTime.UtcNow); diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs index a4eb23d99..79b26468e 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CommonIO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { @@ -35,9 +34,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { if (_items == null) { + Logger.Info("Loading live tv data from {0}", _dataPath); _items = GetItemsFromFile(_dataPath); } - return _items; + return _items.ToList(); } } @@ -58,7 +58,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV catch (IOException ex) { Logger.ErrorException("Error deserializing {0}", ex, jsonFile); - throw; } catch (Exception ex) { diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs index aa4030b81..9ba1c60cc 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunDiscovery.cs @@ -22,15 +22,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun private readonly ILiveTvManager _liveTvManager; private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); private readonly IHttpClient _httpClient; - private IJsonSerializer _json; + private readonly IJsonSerializer _json; - public HdHomerunDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient) + public HdHomerunDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json) { _deviceDiscovery = deviceDiscovery; _config = config; _logger = logger; _liveTvManager = liveTvManager; _httpClient = httpClient; + _json = json; } public void Run() diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs index 6781e498a..9a02413cd 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs @@ -14,7 +14,6 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.Plugins; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; @@ -33,13 +32,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp public static SatIpDiscovery Current; - private readonly List _discoveredHosts = new List(); - - public List DiscoveredHosts - { - get { return _discoveredHosts.ToList(); } - } - public SatIpDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json) { _deviceDiscovery = deviceDiscovery; @@ -83,15 +75,43 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp try { - if (_discoveredHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(location, i.Url, StringComparison.OrdinalIgnoreCase))) + var options = GetConfiguration(); + + if (options.TunerHosts.Any(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && UriEquals(i.Url, location))) { return; } - + _logger.Debug("Will attempt to add SAT device {0}", location); var info = await GetInfo(location, CancellationToken.None).ConfigureAwait(false); - _discoveredHosts.Add(info); + var existing = GetConfiguration().TunerHosts + .FirstOrDefault(i => string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && string.Equals(i.DeviceId, info.DeviceId, StringComparison.OrdinalIgnoreCase)); + + if (existing == null) + { + await _liveTvManager.SaveTunerHost(new TunerHostInfo + { + Type = SatIpHost.DeviceType, + Url = location, + DataVersion = 1, + DeviceId = info.DeviceId, + FriendlyName = info.FriendlyName, + Tuners = info.Tuners + + }).ConfigureAwait(false); + } + else + { + if (!string.Equals(existing.Url, location, StringComparison.OrdinalIgnoreCase)) + { + existing.Url = location; + existing.M3UUrl = info.M3UUrl; + existing.FriendlyName = info.FriendlyName; + existing.Tuners = info.Tuners; + await _liveTvManager.SaveTunerHost(existing).ConfigureAwait(false); + } + } } catch (OperationCanceledException) { @@ -111,6 +131,29 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp } } + private bool UriEquals(string savedUri, string location) + { + return string.Equals(NormalizeUrl(location), NormalizeUrl(savedUri), StringComparison.OrdinalIgnoreCase); + } + + private string NormalizeUrl(string url) + { + if (!url.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + { + url = "http://" + url; + } + + url = url.TrimEnd('/'); + + // Strip off the port + return new Uri(url).GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped); + } + + private LiveTvOptions GetConfiguration() + { + return _config.GetConfiguration("livetv"); + } + public void Dispose() { } @@ -158,7 +201,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp } } - if (string.IsNullOrWhiteSpace(result.Id)) + if (string.IsNullOrWhiteSpace(result.DeviceId)) { throw new NotImplementedException(); } @@ -192,7 +235,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp { case "UDN": { - info.Id = reader.ReadElementContentAsString(); + info.DeviceId = reader.ReadElementContentAsString(); break; } @@ -243,9 +286,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp public class SatIpTunerHostInfo : TunerHostInfo { - public int Tuners { get; set; } public int TunersAvailable { get; set; } - public string M3UUrl { get; set; } - public string FriendlyName { get; set; } } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs index d305a886a..4bbb7e85c 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpHost.cs @@ -35,9 +35,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp protected override async Task> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken) { - var satInfo = (SatIpTunerHostInfo)tuner; - - return await new M3uParser(Logger, _fileSystem, _httpClient).Parse(satInfo.M3UUrl, ChannelIdPrefix, tuner.Id, cancellationToken).ConfigureAwait(false); + return await new M3uParser(Logger, _fileSystem, _httpClient).Parse(tuner.M3UUrl, ChannelIdPrefix, tuner.Id, cancellationToken).ConfigureAwait(false); } public static string DeviceType @@ -128,11 +126,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase); } - protected override List GetTunerHosts() - { - return SatIpDiscovery.Current.DiscoveredHosts; - } - public string Name { get { return "Sat IP"; } @@ -149,15 +142,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp public List GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken) { - var satInfo = (SatIpTunerHostInfo)info; - var list = new List(); - for (var i = 0; i < satInfo.Tuners; i++) + for (var i = 0; i < info.Tuners; i++) { list.Add(new LiveTvTunerInfo { - Name = satInfo.FriendlyName ?? Name, + Name = info.FriendlyName ?? Name, SourceType = Type, Status = LiveTvTunerStatus.Available, Id = info.Url.GetMD5().ToString("N") + i.ToString(CultureInfo.InvariantCulture), diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 74bc05fe8..fb52b58b7 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -272,6 +272,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -302,6 +305,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest -- cgit v1.2.3 From d683f3061979d786efc574f1073af4e77da11772 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 13 Mar 2016 21:34:24 -0400 Subject: update music user data key --- MediaBrowser.Api/StartupWizardService.cs | 1 + MediaBrowser.Controller/Entities/Audio/Audio.cs | 25 ++++++++++++++++++++++ .../Entities/Audio/MusicAlbum.cs | 23 ++++++++++++++++++-- MediaBrowser.Controller/Entities/Movies/Movie.cs | 8 +++++++ .../Parsers/MovieXmlParser.cs | 2 +- .../Configuration/ServerConfiguration.cs | 3 ++- MediaBrowser.Model/Dto/BaseItemDto.cs | 6 ------ MediaBrowser.Model/Querying/ItemFields.cs | 5 ----- MediaBrowser.Providers/Manager/ProviderManager.cs | 4 ++-- .../MediaInfo/AudioImageProvider.cs | 16 +++++++++++--- .../Movies/GenericMovieDbInfo.cs | 2 +- .../Movies/MovieMetadataService.cs | 4 ++-- .../Dto/DtoService.cs | 10 --------- .../Library/LibraryManager.cs | 5 ----- MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs | 5 +++-- .../Parsers/MovieNfoParser.cs | 13 ++++++++--- MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs | 4 ++-- 17 files changed, 91 insertions(+), 45 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 06db1de74..10f9ec022 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -68,6 +68,7 @@ namespace MediaBrowser.Api _config.Configuration.EnableLocalizedGuids = true; _config.Configuration.EnableCustomPathSubFolders = true; _config.Configuration.EnableDateLastRefresh = true; + _config.Configuration.EnableStandaloneMusicKeys = true; _config.SaveConfiguration(); } diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 766f1e5ed..dc37dccea 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -153,6 +153,31 @@ namespace MediaBrowser.Controller.Entities.Audio /// System.String. protected override string CreateUserDataKey() { + if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys) + { + var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty; + + + if (ParentIndexNumber.HasValue) + { + songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey; + } + songKey+= Name; + + if (!string.IsNullOrWhiteSpace(Album)) + { + songKey = Album + "-" + songKey; + } + + var albumArtist = AlbumArtists.FirstOrDefault(); + if (!string.IsNullOrWhiteSpace(albumArtist)) + { + songKey = albumArtist + "-" + songKey; + } + + return songKey; + } + var parent = AlbumEntity; if (parent != null) diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index c5ce6a2f7..e6178c183 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -34,7 +34,17 @@ namespace MediaBrowser.Controller.Entities.Audio { get { - return GetParents().OfType().FirstOrDefault(); + var artist = GetParents().OfType().FirstOrDefault(); + + if (artist == null) + { + var name = AlbumArtist; + if (!string.IsNullOrWhiteSpace(name)) + { + artist = LibraryManager.GetArtist(name); + } + } + return artist; } } @@ -106,6 +116,15 @@ namespace MediaBrowser.Controller.Entities.Audio return "MusicAlbum-Musicbrainz-" + id; } + if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys) + { + var albumArtist = AlbumArtist; + if (!string.IsNullOrWhiteSpace(albumArtist)) + { + return albumArtist + "-" + Name; + } + } + return base.CreateUserDataKey(); } @@ -125,7 +144,7 @@ namespace MediaBrowser.Controller.Entities.Audio id.AlbumArtists = AlbumArtists; - var artist = GetParents().OfType().FirstOrDefault(); + var artist = MusicArtist; if (artist != null) { diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 749d562ac..6f99e77ec 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using CommonIO; @@ -85,6 +86,13 @@ namespace MediaBrowser.Controller.Entities.Movies /// The name of the TMDB collection. public string TmdbCollectionName { get; set; } + [IgnoreDataMember] + public string CollectionName + { + get { return TmdbCollectionName; } + set { TmdbCollectionName = value; } + } + /// /// Gets the trailer ids. /// diff --git a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs index 0b434231f..1c1bbe71e 100644 --- a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs @@ -35,7 +35,7 @@ namespace MediaBrowser.LocalMetadata.Parsers if (!string.IsNullOrWhiteSpace(val) && movie != null) { - movie.TmdbCollectionName = val; + movie.CollectionName = val; } break; diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 64edbdea9..009068dea 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -207,7 +207,8 @@ namespace MediaBrowser.Model.Configuration public bool DownloadImagesInAdvance { get; set; } public bool EnableAnonymousUsageReporting { get; set; } - + public bool EnableStandaloneMusicKeys { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index ef2de5d78..8e3284152 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -206,12 +206,6 @@ namespace MediaBrowser.Model.Dto /// The short overview. public string ShortOverview { get; set; } - /// - /// Gets or sets the name of the TMDB collection. - /// - /// The name of the TMDB collection. - public string TmdbCollectionName { get; set; } - /// /// Gets or sets the taglines. /// diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 97fec8fdd..1540f178a 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -235,11 +235,6 @@ /// VoteCount, - /// - /// The TMDB collection name - /// - TmdbCollectionName, - /// /// The trailer url of the item /// diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index b0d3f6381..a83a40bc3 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -1022,8 +1022,8 @@ namespace MediaBrowser.Providers.Manager .ToList(); var musicArtists = albums - .Select(i => i.GetParent()) - .OfType() + .Select(i => i.MusicArtist) + .Where(i => i != null) .ToList(); var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new Progress(), cancellationToken, options, true)); diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index c98a67bbd..f9108b9fd 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -107,11 +107,21 @@ namespace MediaBrowser.Providers.MediaInfo private string GetAudioImagePath(Audio item) { - var album = item.AlbumEntity; - var filename = item.Album ?? string.Empty; filename += string.Join(",", item.Artists.ToArray()); - filename += album == null ? item.Id.ToString("N") + "_primary" + item.DateModified.Ticks : album.Id.ToString("N") + album.DateModified.Ticks + "_primary"; + + if (!string.IsNullOrWhiteSpace(item.Album)) + { + filename += "_" + item.Album; + } + else if (!string.IsNullOrWhiteSpace(item.Name)) + { + filename += "_" + item.Name; + } + else + { + filename += "_" + item.Id.ToString("N"); + } filename = filename.GetMD5() + ".jpg"; diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index abd4a6202..157704240 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -179,7 +179,7 @@ namespace MediaBrowser.Providers.Movies if (movieItem != null) { - movieItem.TmdbCollectionName = movieData.belongs_to_collection.name; + movieItem.CollectionName = movieData.belongs_to_collection.name; } } diff --git a/MediaBrowser.Providers/Movies/MovieMetadataService.cs b/MediaBrowser.Providers/Movies/MovieMetadataService.cs index 8757bdd0d..f4cad837a 100644 --- a/MediaBrowser.Providers/Movies/MovieMetadataService.cs +++ b/MediaBrowser.Providers/Movies/MovieMetadataService.cs @@ -37,9 +37,9 @@ namespace MediaBrowser.Providers.Movies var sourceItem = source.Item; var targetItem = target.Item; - if (replaceData || string.IsNullOrEmpty(targetItem.TmdbCollectionName)) + if (replaceData || string.IsNullOrEmpty(targetItem.CollectionName)) { - targetItem.TmdbCollectionName = sourceItem.TmdbCollectionName; + targetItem.CollectionName = sourceItem.CollectionName; } } } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index a19a122c3..fb202b798 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1378,16 +1378,6 @@ namespace MediaBrowser.Server.Implementations.Dto } } - // Add MovieInfo - var movie = item as Movie; - if (movie != null) - { - if (fields.Contains(ItemFields.TmdbCollectionName)) - { - dto.TmdbCollectionName = movie.TmdbCollectionName; - } - } - var hasSpecialFeatures = item as IHasSpecialFeatures; if (hasSpecialFeatures != null) { diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 721603efe..3c56af9e6 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1044,11 +1044,6 @@ namespace MediaBrowser.Server.Implementations.Library return names; } - private void SetPropertiesFromSongs(MusicArtist artist, IEnumerable items) - { - - } - /// /// Validate and refresh the People sub-set of the IBN. /// The items are stored in the db but not loaded into memory until actually requested by an operation. diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 7362ee58f..cb74d4dd7 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -180,7 +180,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers } catch (XmlException) { - + } } } @@ -661,7 +661,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers if (!string.IsNullOrWhiteSpace(val)) { val = val.Replace("plugin://plugin.video.youtube/?action=play_video&videoid=", "http://www.youtube.com/watch?v=", StringComparison.OrdinalIgnoreCase); - + hasTrailer.AddTrailerUrl(val, false); } } @@ -860,6 +860,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers break; case "collectionnumber": + case "tmdbcolid": var tmdbCollection = reader.ReadElementContentAsString(); if (!string.IsNullOrWhiteSpace(tmdbCollection)) { diff --git a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs index 8d5c2bf20..14c214f04 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs @@ -11,7 +11,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers { class MovieNfoParser : BaseNfoParser