diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index 8e8f8c4dc3..019b8162af 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -122,7 +122,7 @@ namespace Emby.Server.Implementations.Library /// The user. private void OnUserDeleted(User user) { - EventHelper.QueueEventIfNotNull(UserDeleted, this, new GenericEventArgs { Argument = user }, _logger); + EventHelper.FireEventIfNotNull(UserDeleted, this, new GenericEventArgs { Argument = user }, _logger); } #endregion diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index bf11b7d3ab..1f9817e201 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2154,7 +2154,7 @@ namespace Emby.Server.Implementations.LiveTv await service.CancelTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); _lastRecordingRefreshTime = DateTime.MinValue; - EventHelper.QueueEventIfNotNull(TimerCancelled, this, new GenericEventArgs + EventHelper.FireEventIfNotNull(TimerCancelled, this, new GenericEventArgs { Argument = new TimerEventInfo { @@ -2177,7 +2177,7 @@ namespace Emby.Server.Implementations.LiveTv await service.CancelSeriesTimerAsync(timer.ExternalId, CancellationToken.None).ConfigureAwait(false); _lastRecordingRefreshTime = DateTime.MinValue; - EventHelper.QueueEventIfNotNull(SeriesTimerCancelled, this, new GenericEventArgs + EventHelper.FireEventIfNotNull(SeriesTimerCancelled, this, new GenericEventArgs { Argument = new TimerEventInfo { @@ -2516,7 +2516,7 @@ namespace Emby.Server.Implementations.LiveTv _lastRecordingRefreshTime = DateTime.MinValue; _logger.Info("New recording scheduled"); - EventHelper.QueueEventIfNotNull(TimerCreated, this, new GenericEventArgs + EventHelper.FireEventIfNotNull(TimerCreated, this, new GenericEventArgs { Argument = new TimerEventInfo { @@ -2558,7 +2558,7 @@ namespace Emby.Server.Implementations.LiveTv _lastRecordingRefreshTime = DateTime.MinValue; - EventHelper.QueueEventIfNotNull(SeriesTimerCreated, this, new GenericEventArgs + EventHelper.FireEventIfNotNull(SeriesTimerCreated, this, new GenericEventArgs { Argument = new TimerEventInfo { diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs index 113cb33f42..2c12f4ca15 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; @@ -11,12 +10,10 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; - using MediaBrowser.Model.IO; using MediaBrowser.Common.Net; using MediaBrowser.Controller; using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.IO; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.System; @@ -46,9 +43,16 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts get { return "M3U Tuner"; } } + private string GetFullChannelIdPrefix(TunerHostInfo info) + { + return ChannelIdPrefix + info.Url.GetMD5().ToString("N"); + } + protected override async Task> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken) { - var result = await new M3uParser(Logger, FileSystem, _httpClient, _appHost).Parse(info.Url, ChannelIdPrefix, info.Id, !info.EnableTvgId, cancellationToken).ConfigureAwait(false); + var channelIdPrefix = GetFullChannelIdPrefix(info); + + var result = await new M3uParser(Logger, FileSystem, _httpClient, _appHost).Parse(info.Url, channelIdPrefix, info.Id, cancellationToken).ConfigureAwait(false); return result.Cast().ToList(); } @@ -87,9 +91,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts protected override async Task> GetChannelStreamMediaSources(TunerHostInfo info, string channelId, CancellationToken cancellationToken) { - var urlHash = info.Url.GetMD5().ToString("N"); - var prefix = ChannelIdPrefix + urlHash; - if (!channelId.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) + var channelIdPrefix = GetFullChannelIdPrefix(info); + + if (!channelId.StartsWith(channelIdPrefix, StringComparison.OrdinalIgnoreCase)) { return null; } diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs index 8d73c7e2bb..113e691b6f 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs @@ -32,25 +32,21 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts _appHost = appHost; } - public async Task> Parse(string url, string channelIdPrefix, string tunerHostId, bool enableStreamUrlAsIdentifier, CancellationToken cancellationToken) + public async Task> Parse(string url, string channelIdPrefix, string tunerHostId, CancellationToken cancellationToken) { - var urlHash = url.GetMD5().ToString("N"); - // Read the file and display it line by line. using (var reader = new StreamReader(await GetListingsStream(url, cancellationToken).ConfigureAwait(false))) { - return GetChannels(reader, urlHash, channelIdPrefix, tunerHostId, enableStreamUrlAsIdentifier); + return GetChannels(reader, channelIdPrefix, tunerHostId); } } public List ParseString(string text, string channelIdPrefix, string tunerHostId) { - var urlHash = "text".GetMD5().ToString("N"); - // Read the file and display it line by line. using (var reader = new StringReader(text)) { - return GetChannels(reader, urlHash, channelIdPrefix, tunerHostId, false); + return GetChannels(reader, channelIdPrefix, tunerHostId); } } @@ -70,7 +66,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts } const string ExtInfPrefix = "#EXTINF:"; - private List GetChannels(TextReader reader, string urlHash, string channelIdPrefix, string tunerHostId, bool enableStreamUrlAsIdentifier) + private List GetChannels(TextReader reader, string channelIdPrefix, string tunerHostId) { var channels = new List(); string line; @@ -97,13 +93,13 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts else if (!string.IsNullOrWhiteSpace(extInf) && !line.StartsWith("#", StringComparison.OrdinalIgnoreCase)) { var channel = GetChannelnfo(extInf, tunerHostId, line); - if (string.IsNullOrWhiteSpace(channel.Id) || enableStreamUrlAsIdentifier) + if (string.IsNullOrWhiteSpace(channel.Id)) { - channel.Id = channelIdPrefix + urlHash + line.GetMD5().ToString("N"); + channel.Id = channelIdPrefix + line.GetMD5().ToString("N"); } else { - channel.Id = channelIdPrefix + urlHash + channel.Id.GetMD5().ToString("N"); + channel.Id = channelIdPrefix + channel.Id.GetMD5().ToString("N"); } channel.Path = line; diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs index 5a6004760f..95366c79e6 100644 --- a/MediaBrowser.Api/TvShowsService.cs +++ b/MediaBrowser.Api/TvShowsService.cs @@ -199,6 +199,12 @@ namespace MediaBrowser.Api [ApiMember(Name = "EnableUserData", Description = "Optional, include user data", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")] public bool? EnableUserData { get; set; } + + [ApiMember(Name = "SortBy", Description = "Optional. Specify one or more sort orders, comma delimeted. Options: Album, AlbumArtist, Artist, Budget, CommunityRating, CriticRating, DateCreated, DatePlayed, PlayCount, PremiereDate, ProductionYear, SortName, Random, Revenue, Runtime", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] + public string SortBy { get; set; } + + [ApiMember(Name = "SortOrder", Description = "Sort Order - Ascending,Descending", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public SortOrder? SortOrder { get; set; } } [Route("/Shows/{Id}/Seasons", "GET", Summary = "Gets seasons for a tv series")] @@ -541,6 +547,11 @@ namespace MediaBrowser.Api returnItems = UserViewBuilder.FilterForAdjacency(returnItems, request.AdjacentTo); } + if (string.Equals(request.SortBy, ItemSortBy.Random, StringComparison.OrdinalIgnoreCase)) + { + returnItems = returnItems.OrderBy(i => Guid.NewGuid()); + } + var returnList = returnItems.ToList(); var pagedItems = ApplyPaging(returnList, request.StartIndex, request.Limit); diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 48f9a4212a..b483d527c3 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -1089,7 +1089,7 @@ namespace MediaBrowser.Model.Dlna { if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) { - LogConditionFailure(profile, "VideoAudioCodecProfile", applyCondition, mediaSource); + LogConditionFailure(profile, "VideoAudioCodecProfile.ApplyConditions", applyCondition, mediaSource); applyConditions = false; break; } diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index 8555f9c380..25185b4dd1 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -46,13 +46,11 @@ namespace MediaBrowser.Model.LiveTv public string FriendlyName { get; set; } public bool ImportFavoritesOnly { get; set; } public bool AllowHWTranscoding { get; set; } - public bool EnableTvgId { get; set; } public bool EnableStreamLooping { get; set; } public TunerHostInfo() { AllowHWTranscoding = true; - EnableTvgId = true; } } diff --git a/SharedVersion.cs b/SharedVersion.cs index 4926fb5745..286e625b00 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.26.6")] +[assembly: AssemblyVersion("3.2.26.7")]