aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-04-27 14:24:55 -0400
committerGitHub <noreply@github.com>2017-04-27 14:24:55 -0400
commit25b25afbb837adcb0af723f63ad54f9be8fe7de7 (patch)
treebc8ec4c0170f1a8e34f88587e2335a63658cf830
parent859a8f95877725c2aeafda3eb95776ff25fcdd75 (diff)
parent0f07d97031f8680dc9df0ad8752141c46bbc9c2b (diff)
Merge pull request #2598 from MediaBrowser/dev
Dev
-rw-r--r--Emby.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs2
-rw-r--r--Emby.Server.Implementations/Library/MusicManager.cs79
-rw-r--r--Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs6
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs7
-rw-r--r--MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs7
-rw-r--r--MediaBrowser.Api/Playback/Progressive/AudioService.cs37
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicGenre.cs2
-rw-r--r--MediaBrowser.Controller/Entities/GameGenre.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Genre.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Movies/BoxSet.cs4
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs29
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs61
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs2
-rw-r--r--MediaBrowser.Controller/Playlists/Playlist.cs29
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs61
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs2
-rw-r--r--MediaBrowser.Providers/Music/AlbumImageFromSongProvider.cs3
-rw-r--r--MediaBrowser.Providers/TV/DummySeasonProvider.cs4
-rw-r--r--MediaBrowser.Providers/TV/MissingEpisodeProvider.cs19
-rw-r--r--MediaBrowser.Server.Mono/Program.cs7
-rw-r--r--MediaBrowser.Server.Mono/app.config2
-rw-r--r--SharedVersion.cs2
22 files changed, 157 insertions, 212 deletions
diff --git a/Emby.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/Emby.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
index 0a9c67285..7b64c582a 100644
--- a/Emby.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
+++ b/Emby.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
@@ -470,7 +470,7 @@ namespace Emby.Server.Implementations.FileOrganization
return new List<string>();
}
- var episodePaths = series.GetRecursiveChildren()
+ var episodePaths = series.GetRecursiveChildren(i => i is Episode)
.OfType<Episode>()
.Where(i =>
{
diff --git a/Emby.Server.Implementations/Library/MusicManager.cs b/Emby.Server.Implementations/Library/MusicManager.cs
index 9d07837c6..b15c01125 100644
--- a/Emby.Server.Implementations/Library/MusicManager.cs
+++ b/Emby.Server.Implementations/Library/MusicManager.cs
@@ -5,6 +5,7 @@ using MediaBrowser.Controller.Playlists;
using System;
using System.Collections.Generic;
using System.Linq;
+using MediaBrowser.Model.Querying;
namespace Emby.Server.Implementations.Library
{
@@ -27,35 +28,14 @@ namespace Emby.Server.Implementations.Library
return list.Concat(GetInstantMixFromGenres(item.Genres, user));
}
- public IEnumerable<Audio> GetInstantMixFromArtist(MusicArtist artist, User user)
+ public IEnumerable<Audio> GetInstantMixFromArtist(MusicArtist item, User user)
{
- var genres = user.RootFolder
- .GetRecursiveChildren(user, new InternalItemsQuery(user)
- {
- IncludeItemTypes = new[] { typeof(Audio).Name }
- })
- .Cast<Audio>()
- .Where(i => i.HasAnyArtist(artist.Name))
- .SelectMany(i => i.Genres)
- .Concat(artist.Genres)
- .Distinct(StringComparer.OrdinalIgnoreCase);
-
- return GetInstantMixFromGenres(genres, user);
+ return GetInstantMixFromGenres(item.Genres, user);
}
public IEnumerable<Audio> GetInstantMixFromAlbum(MusicAlbum item, User user)
{
- var genres = item
- .GetRecursiveChildren(user, new InternalItemsQuery(user)
- {
- IncludeItemTypes = new[] { typeof(Audio).Name }
- })
- .Cast<Audio>()
- .SelectMany(i => i.Genres)
- .Concat(item.Genres)
- .DistinctNames();
-
- return GetInstantMixFromGenres(genres, user);
+ return GetInstantMixFromGenres(item.Genres, user);
}
public IEnumerable<Audio> GetInstantMixFromFolder(Folder item, User user)
@@ -63,7 +43,7 @@ namespace Emby.Server.Implementations.Library
var genres = item
.GetRecursiveChildren(user, new InternalItemsQuery(user)
{
- IncludeItemTypes = new[] {typeof(Audio).Name}
+ IncludeItemTypes = new[] { typeof(Audio).Name }
})
.Cast<Audio>()
.SelectMany(i => i.Genres)
@@ -75,41 +55,40 @@ namespace Emby.Server.Implementations.Library
public IEnumerable<Audio> GetInstantMixFromPlaylist(Playlist item, User user)
{
- var genres = item
- .GetRecursiveChildren(user, new InternalItemsQuery(user)
- {
- IncludeItemTypes = new[] { typeof(Audio).Name }
- })
- .Cast<Audio>()
- .SelectMany(i => i.Genres)
- .Concat(item.Genres)
- .DistinctNames();
-
- return GetInstantMixFromGenres(genres, user);
+ return GetInstantMixFromGenres(item.Genres, user);
}
public IEnumerable<Audio> GetInstantMixFromGenres(IEnumerable<string> genres, User user)
{
- var genreList = genres.ToList();
+ var genreIds = genres.DistinctNames().Select(i =>
+ {
+ try
+ {
+ return _libraryManager.GetMusicGenre(i).Id.ToString("N");
+ }
+ catch
+ {
+ return null;
+ }
+
+ }).Where(i => i != null);
- var inputItems = _libraryManager.GetItemList(new InternalItemsQuery(user)
+ return GetInstantMixFromGenreIds(genreIds, user);
+ }
+
+ public IEnumerable<Audio> GetInstantMixFromGenreIds(IEnumerable<string> genreIds, User user)
+ {
+ return _libraryManager.GetItemList(new InternalItemsQuery(user)
{
IncludeItemTypes = new[] { typeof(Audio).Name },
- Genres = genreList.ToArray()
+ GenreIds = genreIds.ToArray(),
- });
+ Limit = 200,
- var genresDictionary = genreList.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+ SortBy = new[] { ItemSortBy.Random }
- return inputItems
- .Cast<Audio>()
- .Select(i => new Tuple<Audio, int>(i, i.Genres.Count(genresDictionary.ContainsKey)))
- .OrderByDescending(i => i.Item2)
- .ThenBy(i => Guid.NewGuid())
- .Select(i => i.Item1)
- .Take(200)
- .OrderBy(i => Guid.NewGuid());
+ }).Cast<Audio>();
}
public IEnumerable<Audio> GetInstantMixFromItem(BaseItem item, User user)
@@ -117,7 +96,7 @@ namespace Emby.Server.Implementations.Library
var genre = item as MusicGenre;
if (genre != null)
{
- return GetInstantMixFromGenres(new[] { item.Name }, user);
+ return GetInstantMixFromGenreIds(new[] { item.Id.ToString("N") }, user);
}
var playlist = item as Playlist;
diff --git a/Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs b/Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs
index 5183f3a0b..6e96d83fd 100644
--- a/Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs
+++ b/Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs
@@ -35,9 +35,11 @@ namespace Emby.Server.Implementations.Logging
// Write to console just in case file logging fails
_console.WriteLine("UnhandledException");
- _console.WriteLine(builder.ToString());
- _fileSystem.WriteAllText(path, builder.ToString());
+ var logMessage = builder.ToString();
+ _console.WriteLine(logMessage);
+
+ _fileSystem.WriteAllText(path, logMessage);
}
}
}
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 699c4bbb2..6935073a9 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -720,6 +720,13 @@ namespace MediaBrowser.Api.Playback
state.IsInputVideo = string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
+ var primaryImage = item.GetImageInfo(ImageType.Primary, 0) ??
+ item.Parents.Select(i => i.GetImageInfo(ImageType.Primary, 0)).FirstOrDefault(i => i != null);
+ if (primaryImage != null)
+ {
+ state.AlbumCoverPath = primaryImage.Path;
+ }
+
MediaSourceInfo mediaSource = null;
if (string.IsNullOrWhiteSpace(request.LiveStreamId))
{
diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
index 95109a07f..0ff52e63f 100644
--- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
+++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs
@@ -15,6 +15,8 @@ namespace MediaBrowser.Api.Playback.Hls
/// <summary>
/// Class GetHlsAudioSegment
/// </summary>
+ // Can't require authentication just yet due to seeing some requests come from Chrome without full query string
+ //[Authenticated]
[Route("/Audio/{Id}/hls/{SegmentId}/stream.mp3", "GET")]
[Route("/Audio/{Id}/hls/{SegmentId}/stream.aac", "GET")]
public class GetHlsAudioSegmentLegacy
@@ -38,6 +40,7 @@ namespace MediaBrowser.Api.Playback.Hls
/// Class GetHlsVideoSegment
/// </summary>
[Route("/Videos/{Id}/hls/{PlaylistId}/stream.m3u8", "GET")]
+ [Authenticated]
public class GetHlsPlaylistLegacy
{
// TODO: Deprecate with new iOS app
@@ -52,6 +55,7 @@ namespace MediaBrowser.Api.Playback.Hls
}
[Route("/Videos/ActiveEncodings", "DELETE")]
+ [Authenticated]
public class StopEncodingProcess
{
[ApiMember(Name = "DeviceId", Description = "The device id of the client requesting. Used to stop encoding processes when needed.", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "DELETE")]
@@ -64,6 +68,8 @@ namespace MediaBrowser.Api.Playback.Hls
/// <summary>
/// Class GetHlsVideoSegment
/// </summary>
+ // Can't require authentication just yet due to seeing some requests come from Chrome without full query string
+ //[Authenticated]
[Route("/Videos/{Id}/hls/{PlaylistId}/{SegmentId}.{SegmentContainer}", "GET")]
public class GetHlsVideoSegmentLegacy : VideoStreamRequest
{
@@ -76,7 +82,6 @@ namespace MediaBrowser.Api.Playback.Hls
public string SegmentId { get; set; }
}
- [Authenticated]
public class HlsSegmentService : BaseApiService
{
private readonly IServerApplicationPaths _appPaths;
diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs
index a64523e40..f0386d5ba 100644
--- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs
@@ -59,42 +59,7 @@ namespace MediaBrowser.Api.Playback.Progressive
{
var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
- var audioTranscodeParams = new List<string>();
-
- var bitrate = state.OutputAudioBitrate;
-
- if (bitrate.HasValue)
- {
- audioTranscodeParams.Add("-ab " + bitrate.Value.ToString(UsCulture));
- }
-
- if (state.OutputAudioChannels.HasValue)
- {
- audioTranscodeParams.Add("-ac " + state.OutputAudioChannels.Value.ToString(UsCulture));
- }
-
- // opus will fail on 44100
- if (!string.Equals(state.OutputAudioCodec, "opus", global::System.StringComparison.OrdinalIgnoreCase))
- {
- if (state.OutputAudioSampleRate.HasValue)
- {
- audioTranscodeParams.Add("-ar " + state.OutputAudioSampleRate.Value.ToString(UsCulture));
- }
- }
-
- const string vn = " -vn";
-
- var threads = EncodingHelper.GetNumberOfThreads(state, encodingOptions, false);
-
- var inputModifier = EncodingHelper.GetInputModifier(state, encodingOptions);
-
- return string.Format("{0} {1} -threads {2}{3} {4} -id3v2_version 3 -write_id3v1 1 -y \"{5}\"",
- inputModifier,
- EncodingHelper.GetInputArgument(state, encodingOptions),
- threads,
- vn,
- string.Join(" ", audioTranscodeParams.ToArray()),
- outputPath).Trim();
+ return EncodingHelper.GetProgressiveAudioFullCommandLine(state, encodingOptions, outputPath);
}
public AudioService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext, imageProcessor)
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
index e26e0dfce..2f99e530e 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs
@@ -112,7 +112,7 @@ namespace MediaBrowser.Controller.Entities.Audio
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
{
- query.Genres = new[] { Name };
+ query.GenreIds = new[] { Id.ToString("N") };
query.IncludeItemTypes = new[] { typeof(MusicVideo).Name, typeof(Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
return LibraryManager.GetItemList(query);
diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs
index 4187167b9..093b191b6 100644
--- a/MediaBrowser.Controller/Entities/GameGenre.cs
+++ b/MediaBrowser.Controller/Entities/GameGenre.cs
@@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entities
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
{
- query.Genres = new[] { Name };
+ query.GenreIds = new[] { Id.ToString("N") };
query.IncludeItemTypes = new[] { typeof(Game).Name };
return LibraryManager.GetItemList(query);
diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs
index 9769efdd0..6569a1e6c 100644
--- a/MediaBrowser.Controller/Entities/Genre.cs
+++ b/MediaBrowser.Controller/Entities/Genre.cs
@@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.Entities
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
{
- query.Genres = new[] { Name };
+ query.GenreIds = new[] { Id.ToString("N") };
query.ExcludeItemTypes = new[] { typeof(Game).Name, typeof(MusicVideo).Name, typeof(Audio.Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
return LibraryManager.GetItemList(query);
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index 8ddf36327..3f733ce03 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -152,9 +152,7 @@ namespace MediaBrowser.Controller.Entities.Movies
var currentOfficialRating = OfficialRating;
// Gather all possible ratings
- var ratings = GetRecursiveChildren()
- .Concat(GetLinkedChildren())
- .Where(i => i is Movie || i is Series || i is MusicAlbum || i is Game)
+ var ratings = GetRecursiveChildren(i => i is Movie || i is Series || i is MusicAlbum || i is Game)
.Select(i => i.OfficialRating)
.Where(i => !string.IsNullOrEmpty(i))
.Distinct(StringComparer.OrdinalIgnoreCase)
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index f879d0fd8..8da069f62 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -586,7 +586,7 @@ namespace MediaBrowser.Controller.Entities
{
query.Recursive = true;
query.ParentId = queryParent.Id;
- query.Genres = new[] { displayParent.Name };
+ query.GenreIds = new[] { displayParent.Id.ToString("N") };
query.SetUser(user);
query.IncludeItemTypes = new[] { typeof(Movie).Name };
@@ -729,7 +729,7 @@ namespace MediaBrowser.Controller.Entities
{
query.Recursive = true;
query.ParentId = queryParent.Id;
- query.Genres = new[] { displayParent.Name };
+ query.GenreIds = new[] { displayParent.Id.ToString("N") };
query.SetUser(user);
query.IncludeItemTypes = new[] { typeof(Series).Name };
@@ -905,6 +905,11 @@ namespace MediaBrowser.Controller.Entities
return false;
}
+ if (request.GenreIds.Length > 0)
+ {
+ return false;
+ }
+
if (request.HasImdbId.HasValue)
{
return false;
@@ -1768,26 +1773,6 @@ namespace MediaBrowser.Controller.Entities
return new List<Folder> { parent };
}
- private IEnumerable<BaseItem> GetRecursiveChildren(Folder parent, User user, IEnumerable<string> viewTypes)
- {
- if (parent == null || parent is UserView)
- {
- if (user == null)
- {
- return GetMediaFolders(null, viewTypes).SelectMany(i => i.GetRecursiveChildren());
- }
-
- return GetMediaFolders(user, viewTypes).SelectMany(i => i.GetRecursiveChildren(user));
- }
-
- if (user == null)
- {
- return parent.GetRecursiveChildren();
- }
-
- return parent.GetRecursiveChildren(user);
- }
-
private async Task<QueryResult<BaseItem>> GetLiveTvView(Folder queryParent, User user, InternalItemsQuery query)
{
if (query.Recursive)
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 2441ee0ec..3824813f1 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -1979,5 +1979,66 @@ namespace MediaBrowser.Controller.MediaEncoding
return args;
}
+
+ public string GetProgressiveAudioFullCommandLine(EncodingJobInfo state, EncodingOptions encodingOptions, string outputPath)
+ {
+ var audioTranscodeParams = new List<string>();
+
+ var bitrate = state.OutputAudioBitrate;
+
+ if (bitrate.HasValue)
+ {
+ audioTranscodeParams.Add("-ab " + bitrate.Value.ToString(_usCulture));
+ }
+
+ if (state.OutputAudioChannels.HasValue)
+ {
+ audioTranscodeParams.Add("-ac " + state.OutputAudioChannels.Value.ToString(_usCulture));
+ }
+
+ // opus will fail on 44100
+ if (!string.Equals(state.OutputAudioCodec, "opus", StringComparison.OrdinalIgnoreCase))
+ {
+ if (state.OutputAudioSampleRate.HasValue)
+ {
+ audioTranscodeParams.Add("-ar " + state.OutputAudioSampleRate.Value.ToString(_usCulture));
+ }
+ }
+
+ var albumCoverInput = string.Empty;
+ var mapArgs = string.Empty;
+ var metadata = string.Empty;
+ var vn = string.Empty;
+
+ var hasArt = !string.IsNullOrWhiteSpace(state.AlbumCoverPath);
+ hasArt = false;
+
+ if (hasArt)
+ {
+ albumCoverInput = " -i \"" + state.AlbumCoverPath + "\"";
+ mapArgs = " -map 0:a -map 1:v -c:v copy";
+ metadata = " -metadata:s:v title=\"Album cover\" -metadata:s:v comment=\"Cover(Front)\"";
+ }
+ else
+ {
+ vn = " -vn";
+ }
+
+ var threads = GetNumberOfThreads(state, encodingOptions, false);
+
+ var inputModifier = GetInputModifier(state, encodingOptions);
+
+ return string.Format("{0} {1}{7}{8} -threads {2}{3} {4} -id3v2_version 3 -write_id3v1 1{6} -y \"{5}\"",
+ inputModifier,
+ GetInputArgument(state, encodingOptions),
+ threads,
+ vn,
+ string.Join(" ", audioTranscodeParams.ToArray()),
+ outputPath,
+ metadata,
+ albumCoverInput,
+ mapArgs).Trim();
+ }
+
}
}
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
index f3e6280aa..658608906 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs
@@ -56,6 +56,8 @@ namespace MediaBrowser.Controller.MediaEncoding
}
}
+ public string AlbumCoverPath { get; set; }
+
public string InputAudioSync { get; set; }
public string InputVideoSync { get; set; }
public TransportStreamTimestamp InputTimestamp { get; set; }
diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs
index 0eb435375..fb1410f4a 100644
--- a/MediaBrowser.Controller/Playlists/Playlist.cs
+++ b/MediaBrowser.Controller/Playlists/Playlist.cs
@@ -134,34 +134,27 @@ namespace MediaBrowser.Controller.Playlists
var musicGenre = item as MusicGenre;
if (musicGenre != null)
{
- var items = LibraryManager.GetItemList(new InternalItemsQuery(user)
+ return LibraryManager.GetItemList(new InternalItemsQuery(user)
{
Recursive = true,
IncludeItemTypes = new[] { typeof(Audio).Name },
- Genres = new[] { musicGenre.Name }
+ GenreIds = new[] { musicGenre.Id.ToString("N") },
+ SortBy = new[] { ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName },
+ SortOrder = SortOrder.Ascending
});
-
- return LibraryManager.Sort(items, user, new[] { ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName }, SortOrder.Ascending);
}
var musicArtist = item as MusicArtist;
if (musicArtist != null)
{
- Func<BaseItem, bool> filter = i =>
+ return LibraryManager.GetItemList(new InternalItemsQuery(user)
{
- var audio = i as Audio;
- return audio != null && audio.HasAnyArtist(musicArtist.Name);
- };
-
- var items = user == null
- ? LibraryManager.RootFolder.GetRecursiveChildren(filter)
- : user.RootFolder.GetRecursiveChildren(user, new InternalItemsQuery(user)
- {
- IncludeItemTypes = new[] { typeof(Audio).Name },
- ArtistIds = new[] { musicArtist.Id.ToString("N") }
- });
-
- return LibraryManager.Sort(items, user, new[] { ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName }, SortOrder.Ascending);
+ Recursive = true,
+ IncludeItemTypes = new[] { typeof(Audio).Name },
+ ArtistIds = new[] { musicArtist.Id.ToString("N") },
+ SortBy = new[] { ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName },
+ SortOrder = SortOrder.Ascending
+ });
}
var folder = item as Folder;
diff --git a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs
index 05b3ca5fc..566e7946d 100644
--- a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs
@@ -5,8 +5,6 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
using MediaBrowser.Model.Diagnostics;
namespace MediaBrowser.MediaEncoding.Encoder
@@ -19,66 +17,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
protected override string GetCommandLineArguments(EncodingJob state)
{
- var audioTranscodeParams = new List<string>();
-
- var bitrate = state.OutputAudioBitrate;
-
- if (bitrate.HasValue)
- {
- audioTranscodeParams.Add("-ab " + bitrate.Value.ToString(UsCulture));
- }
-
- if (state.OutputAudioChannels.HasValue)
- {
- audioTranscodeParams.Add("-ac " + state.OutputAudioChannels.Value.ToString(UsCulture));
- }
-
- // opus will fail on 44100
- if (!string.Equals(state.OutputAudioCodec, "opus", StringComparison.OrdinalIgnoreCase))
- {
- if (state.OutputAudioSampleRate.HasValue)
- {
- audioTranscodeParams.Add("-ar " + state.OutputAudioSampleRate.Value.ToString(UsCulture));
- }
- }
-
var encodingOptions = GetEncodingOptions();
- var threads = EncodingHelper.GetNumberOfThreads(state, encodingOptions, false);
-
- var inputModifier = EncodingHelper.GetInputModifier(state, encodingOptions);
-
- var albumCoverInput = string.Empty;
- var mapArgs = string.Empty;
- var metadata = string.Empty;
- var vn = string.Empty;
-
- var hasArt = !string.IsNullOrWhiteSpace(state.AlbumCoverPath);
- hasArt = false;
-
- if (hasArt)
- {
- albumCoverInput = " -i \"" + state.AlbumCoverPath + "\"";
- mapArgs = " -map 0:a -map 1:v -c:v copy";
- metadata = " -metadata:s:v title=\"Album cover\" -metadata:s:v comment=\"Cover(Front)\"";
- }
- else
- {
- vn = " -vn";
- }
-
- var result = string.Format("{0} {1}{6}{7} -threads {2}{3} {4} -id3v2_version 3 -write_id3v1 1{8} -y \"{5}\"",
- inputModifier,
- EncodingHelper.GetInputArgument(state, GetEncodingOptions()),
- threads,
- vn,
- string.Join(" ", audioTranscodeParams.ToArray()),
- state.OutputFilePath,
- albumCoverInput,
- mapArgs,
- metadata).Trim();
-
- return result;
+ return EncodingHelper.GetProgressiveAudioFullCommandLine(state, encodingOptions, state.OutputFilePath);
}
protected override string GetOutputFileExtension(EncodingJob state)
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
index f74dbce98..9d518c431 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
@@ -41,8 +41,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
public string ItemType { get; set; }
- public string AlbumCoverPath { get; set; }
-
public string GetMimeType(string outputPath)
{
if (!string.IsNullOrEmpty(MimeType))
diff --git a/MediaBrowser.Providers/Music/AlbumImageFromSongProvider.cs b/MediaBrowser.Providers/Music/AlbumImageFromSongProvider.cs
index 7abe9cc07..0cb1a7ff1 100644
--- a/MediaBrowser.Providers/Music/AlbumImageFromSongProvider.cs
+++ b/MediaBrowser.Providers/Music/AlbumImageFromSongProvider.cs
@@ -20,8 +20,7 @@ namespace MediaBrowser.Providers.Music
{
var album = (MusicAlbum)item;
- var image = album.GetRecursiveChildren()
- .OfType<Audio>()
+ var image = album.GetRecursiveChildren(i => !i.IsFolder)
.Select(i => i.GetImageInfo(type, 0))
.FirstOrDefault(i => i != null && i.IsLocalFile);
diff --git a/MediaBrowser.Providers/TV/DummySeasonProvider.cs b/MediaBrowser.Providers/TV/DummySeasonProvider.cs
index fd4d041b2..36701a0bd 100644
--- a/MediaBrowser.Providers/TV/DummySeasonProvider.cs
+++ b/MediaBrowser.Providers/TV/DummySeasonProvider.cs
@@ -53,8 +53,8 @@ namespace MediaBrowser.Providers.TV
private async Task<bool> AddDummySeasonFolders(Series series, CancellationToken cancellationToken)
{
- var episodesInSeriesFolder = series.GetRecursiveChildren()
- .OfType<Episode>()
+ var episodesInSeriesFolder = series.GetRecursiveChildren(i => i is Episode)
+ .Cast<Episode>()
.Where(i => !i.IsInSeasonFolder)
.ToList();
diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs
index d5154b1d3..5b9e5d5eb 100644
--- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs
@@ -203,7 +203,7 @@ namespace MediaBrowser.Providers.TV
CancellationToken cancellationToken)
{
var existingEpisodes = (from s in series
- from c in s.GetRecursiveChildren().OfType<Episode>()
+ from c in s.GetRecursiveChildren(i => i is Episode).Cast<Episode>()
select new Tuple<int, Episode>((c.ParentIndexNumber ?? 0) , c))
.ToList();
@@ -275,13 +275,16 @@ namespace MediaBrowser.Providers.TV
return hasChanges;
}
- private Series DetermineAppropriateSeries(IEnumerable<Series> series, int seasonNumber)
+ private Series DetermineAppropriateSeries(List<Series> series, int seasonNumber)
{
- var seriesAndOffsets = series.ToList();
+ if (series.Count == 1)
+ {
+ return series[0];
+ }
- return seriesAndOffsets.FirstOrDefault(s => s.GetRecursiveChildren().OfType<Season>().Any(season => (season.IndexNumber) == seasonNumber)) ??
- seriesAndOffsets.FirstOrDefault(s => s.GetRecursiveChildren().OfType<Season>().Any(season => (season.IndexNumber) == 1)) ??
- seriesAndOffsets.OrderBy(s => s.GetRecursiveChildren().OfType<Season>().Select(season => season.IndexNumber).Min()).First();
+ return series.FirstOrDefault(s => s.GetRecursiveChildren(i => i is Season).Any(season => (season.IndexNumber) == seasonNumber)) ??
+ series.FirstOrDefault(s => s.GetRecursiveChildren(i => i is Season).Any(season => (season.IndexNumber) == 1)) ??
+ series.OrderBy(s => s.GetRecursiveChildren(i => i is Season).Select(season => season.IndexNumber).Min()).First();
}
/// <summary>
@@ -292,7 +295,7 @@ namespace MediaBrowser.Providers.TV
bool allowMissingEpisodes)
{
var existingEpisodes = (from s in series
- from c in s.GetRecursiveChildren().OfType<Episode>()
+ from c in s.GetRecursiveChildren(i => i is Episode).Cast<Episode>()
select new { Episode = c })
.ToList();
@@ -402,7 +405,7 @@ namespace MediaBrowser.Providers.TV
// Season does not have a number
// Remove if there are no episodes directly in series without a season number
- return i.Series.GetRecursiveChildren().OfType<Episode>().All(s => s.ParentIndexNumber.HasValue || s.IsInSeasonFolder);
+ return i.Series.GetRecursiveChildren(e => e is Episode).Cast<Episode>().All(s => s.ParentIndexNumber.HasValue || s.IsInSeasonFolder);
})
.ToList();
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs
index 66851f7e9..dcd2dcaa6 100644
--- a/MediaBrowser.Server.Mono/Program.cs
+++ b/MediaBrowser.Server.Mono/Program.cs
@@ -258,7 +258,12 @@ namespace MediaBrowser.Server.Mono
if (!Debugger.IsAttached)
{
- Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
+ var message = LogHelper.GetLogMessage(exception).ToString();
+
+ if (message.IndexOf("InotifyWatcher", StringComparison.OrdinalIgnoreCase) == -1)
+ {
+ Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
+ }
}
}
diff --git a/MediaBrowser.Server.Mono/app.config b/MediaBrowser.Server.Mono/app.config
index 07c113f3e..8f21d4a67 100644
--- a/MediaBrowser.Server.Mono/app.config
+++ b/MediaBrowser.Server.Mono/app.config
@@ -11,6 +11,8 @@
<add key="ReleaseProgramDataPath" value="ProgramData-Server" />
</appSettings>
<runtime>
+ <legacyUnhandledExceptionPolicy enabled="1" />
+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
diff --git a/SharedVersion.cs b/SharedVersion.cs
index 67aa785ec..11d039147 100644
--- a/SharedVersion.cs
+++ b/SharedVersion.cs
@@ -1,3 +1,3 @@
using System.Reflection;
-[assembly: AssemblyVersion("3.2.13.4")]
+[assembly: AssemblyVersion("3.2.13.5")]