mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-08 02:34:19 -04:00
commit
25b25afbb8
@ -470,7 +470,7 @@ namespace Emby.Server.Implementations.FileOrganization
|
|||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var episodePaths = series.GetRecursiveChildren()
|
var episodePaths = series.GetRecursiveChildren(i => i is Episode)
|
||||||
.OfType<Episode>()
|
.OfType<Episode>()
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using MediaBrowser.Controller.Playlists;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library
|
namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
@ -27,35 +28,14 @@ namespace Emby.Server.Implementations.Library
|
|||||||
return list.Concat(GetInstantMixFromGenres(item.Genres, user));
|
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
|
return GetInstantMixFromGenres(item.Genres, user);
|
||||||
.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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Audio> GetInstantMixFromAlbum(MusicAlbum item, User user)
|
public IEnumerable<Audio> GetInstantMixFromAlbum(MusicAlbum item, User user)
|
||||||
{
|
{
|
||||||
var genres = item
|
return GetInstantMixFromGenres(item.Genres, user);
|
||||||
.GetRecursiveChildren(user, new InternalItemsQuery(user)
|
|
||||||
{
|
|
||||||
IncludeItemTypes = new[] { typeof(Audio).Name }
|
|
||||||
})
|
|
||||||
.Cast<Audio>()
|
|
||||||
.SelectMany(i => i.Genres)
|
|
||||||
.Concat(item.Genres)
|
|
||||||
.DistinctNames();
|
|
||||||
|
|
||||||
return GetInstantMixFromGenres(genres, user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Audio> GetInstantMixFromFolder(Folder item, User user)
|
public IEnumerable<Audio> GetInstantMixFromFolder(Folder item, User user)
|
||||||
@ -75,41 +55,40 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
public IEnumerable<Audio> GetInstantMixFromPlaylist(Playlist item, User user)
|
public IEnumerable<Audio> GetInstantMixFromPlaylist(Playlist item, User user)
|
||||||
{
|
{
|
||||||
var genres = item
|
return GetInstantMixFromGenres(item.Genres, user);
|
||||||
.GetRecursiveChildren(user, new InternalItemsQuery(user)
|
|
||||||
{
|
|
||||||
IncludeItemTypes = new[] { typeof(Audio).Name }
|
|
||||||
})
|
|
||||||
.Cast<Audio>()
|
|
||||||
.SelectMany(i => i.Genres)
|
|
||||||
.Concat(item.Genres)
|
|
||||||
.DistinctNames();
|
|
||||||
|
|
||||||
return GetInstantMixFromGenres(genres, user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Audio> GetInstantMixFromGenres(IEnumerable<string> genres, User 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;
|
||||||
|
}
|
||||||
|
|
||||||
var inputItems = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
}).Where(i => i != null);
|
||||||
|
|
||||||
|
return GetInstantMixFromGenreIds(genreIds, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Audio> GetInstantMixFromGenreIds(IEnumerable<string> genreIds, User user)
|
||||||
|
{
|
||||||
|
return _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
IncludeItemTypes = new[] { typeof(Audio).Name },
|
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>();
|
||||||
.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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Audio> GetInstantMixFromItem(BaseItem item, User user)
|
public IEnumerable<Audio> GetInstantMixFromItem(BaseItem item, User user)
|
||||||
@ -117,7 +96,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
var genre = item as MusicGenre;
|
var genre = item as MusicGenre;
|
||||||
if (genre != null)
|
if (genre != null)
|
||||||
{
|
{
|
||||||
return GetInstantMixFromGenres(new[] { item.Name }, user);
|
return GetInstantMixFromGenreIds(new[] { item.Id.ToString("N") }, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
var playlist = item as Playlist;
|
var playlist = item as Playlist;
|
||||||
|
@ -35,9 +35,11 @@ namespace Emby.Server.Implementations.Logging
|
|||||||
|
|
||||||
// Write to console just in case file logging fails
|
// Write to console just in case file logging fails
|
||||||
_console.WriteLine("UnhandledException");
|
_console.WriteLine("UnhandledException");
|
||||||
_console.WriteLine(builder.ToString());
|
|
||||||
|
|
||||||
_fileSystem.WriteAllText(path, builder.ToString());
|
var logMessage = builder.ToString();
|
||||||
|
_console.WriteLine(logMessage);
|
||||||
|
|
||||||
|
_fileSystem.WriteAllText(path, logMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -720,6 +720,13 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
state.IsInputVideo = string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
|
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;
|
MediaSourceInfo mediaSource = null;
|
||||||
if (string.IsNullOrWhiteSpace(request.LiveStreamId))
|
if (string.IsNullOrWhiteSpace(request.LiveStreamId))
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class GetHlsAudioSegment
|
/// Class GetHlsAudioSegment
|
||||||
/// </summary>
|
/// </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.mp3", "GET")]
|
||||||
[Route("/Audio/{Id}/hls/{SegmentId}/stream.aac", "GET")]
|
[Route("/Audio/{Id}/hls/{SegmentId}/stream.aac", "GET")]
|
||||||
public class GetHlsAudioSegmentLegacy
|
public class GetHlsAudioSegmentLegacy
|
||||||
@ -38,6 +40,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
/// Class GetHlsVideoSegment
|
/// Class GetHlsVideoSegment
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Route("/Videos/{Id}/hls/{PlaylistId}/stream.m3u8", "GET")]
|
[Route("/Videos/{Id}/hls/{PlaylistId}/stream.m3u8", "GET")]
|
||||||
|
[Authenticated]
|
||||||
public class GetHlsPlaylistLegacy
|
public class GetHlsPlaylistLegacy
|
||||||
{
|
{
|
||||||
// TODO: Deprecate with new iOS app
|
// TODO: Deprecate with new iOS app
|
||||||
@ -52,6 +55,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Videos/ActiveEncodings", "DELETE")]
|
[Route("/Videos/ActiveEncodings", "DELETE")]
|
||||||
|
[Authenticated]
|
||||||
public class StopEncodingProcess
|
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")]
|
[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>
|
/// <summary>
|
||||||
/// Class GetHlsVideoSegment
|
/// Class GetHlsVideoSegment
|
||||||
/// </summary>
|
/// </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")]
|
[Route("/Videos/{Id}/hls/{PlaylistId}/{SegmentId}.{SegmentContainer}", "GET")]
|
||||||
public class GetHlsVideoSegmentLegacy : VideoStreamRequest
|
public class GetHlsVideoSegmentLegacy : VideoStreamRequest
|
||||||
{
|
{
|
||||||
@ -76,7 +82,6 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||||||
public string SegmentId { get; set; }
|
public string SegmentId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authenticated]
|
|
||||||
public class HlsSegmentService : BaseApiService
|
public class HlsSegmentService : BaseApiService
|
||||||
{
|
{
|
||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
|
@ -59,42 +59,7 @@ namespace MediaBrowser.Api.Playback.Progressive
|
|||||||
{
|
{
|
||||||
var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
|
var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
|
||||||
|
|
||||||
var audioTranscodeParams = new List<string>();
|
return EncodingHelper.GetProgressiveAudioFullCommandLine(state, encodingOptions, outputPath);
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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)
|
||||||
|
@ -112,7 +112,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||||||
|
|
||||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
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 };
|
query.IncludeItemTypes = new[] { typeof(MusicVideo).Name, typeof(Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
|
||||||
|
|
||||||
return LibraryManager.GetItemList(query);
|
return LibraryManager.GetItemList(query);
|
||||||
|
@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
query.Genres = new[] { Name };
|
query.GenreIds = new[] { Id.ToString("N") };
|
||||||
query.IncludeItemTypes = new[] { typeof(Game).Name };
|
query.IncludeItemTypes = new[] { typeof(Game).Name };
|
||||||
|
|
||||||
return LibraryManager.GetItemList(query);
|
return LibraryManager.GetItemList(query);
|
||||||
|
@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
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 };
|
query.ExcludeItemTypes = new[] { typeof(Game).Name, typeof(MusicVideo).Name, typeof(Audio.Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
|
||||||
|
|
||||||
return LibraryManager.GetItemList(query);
|
return LibraryManager.GetItemList(query);
|
||||||
|
@ -152,9 +152,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
var currentOfficialRating = OfficialRating;
|
var currentOfficialRating = OfficialRating;
|
||||||
|
|
||||||
// Gather all possible ratings
|
// Gather all possible ratings
|
||||||
var ratings = GetRecursiveChildren()
|
var ratings = GetRecursiveChildren(i => i is Movie || i is Series || i is MusicAlbum || i is Game)
|
||||||
.Concat(GetLinkedChildren())
|
|
||||||
.Where(i => i is Movie || i is Series || i is MusicAlbum || i is Game)
|
|
||||||
.Select(i => i.OfficialRating)
|
.Select(i => i.OfficialRating)
|
||||||
.Where(i => !string.IsNullOrEmpty(i))
|
.Where(i => !string.IsNullOrEmpty(i))
|
||||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
|
@ -586,7 +586,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = queryParent.Id;
|
query.ParentId = queryParent.Id;
|
||||||
query.Genres = new[] { displayParent.Name };
|
query.GenreIds = new[] { displayParent.Id.ToString("N") };
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
query.IncludeItemTypes = new[] { typeof(Movie).Name };
|
||||||
@ -729,7 +729,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
query.Recursive = true;
|
query.Recursive = true;
|
||||||
query.ParentId = queryParent.Id;
|
query.ParentId = queryParent.Id;
|
||||||
query.Genres = new[] { displayParent.Name };
|
query.GenreIds = new[] { displayParent.Id.ToString("N") };
|
||||||
query.SetUser(user);
|
query.SetUser(user);
|
||||||
|
|
||||||
query.IncludeItemTypes = new[] { typeof(Series).Name };
|
query.IncludeItemTypes = new[] { typeof(Series).Name };
|
||||||
@ -905,6 +905,11 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.GenreIds.Length > 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (request.HasImdbId.HasValue)
|
if (request.HasImdbId.HasValue)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -1768,26 +1773,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return new List<Folder> { parent };
|
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)
|
private async Task<QueryResult<BaseItem>> GetLiveTvView(Folder queryParent, User user, InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (query.Recursive)
|
if (query.Recursive)
|
||||||
|
@ -1979,5 +1979,66 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
|
|
||||||
return args;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string AlbumCoverPath { get; set; }
|
||||||
|
|
||||||
public string InputAudioSync { get; set; }
|
public string InputAudioSync { get; set; }
|
||||||
public string InputVideoSync { get; set; }
|
public string InputVideoSync { get; set; }
|
||||||
public TransportStreamTimestamp InputTimestamp { get; set; }
|
public TransportStreamTimestamp InputTimestamp { get; set; }
|
||||||
|
@ -134,34 +134,27 @@ namespace MediaBrowser.Controller.Playlists
|
|||||||
var musicGenre = item as MusicGenre;
|
var musicGenre = item as MusicGenre;
|
||||||
if (musicGenre != null)
|
if (musicGenre != null)
|
||||||
{
|
{
|
||||||
var items = LibraryManager.GetItemList(new InternalItemsQuery(user)
|
return LibraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
Recursive = true,
|
Recursive = true,
|
||||||
IncludeItemTypes = new[] { typeof(Audio).Name },
|
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;
|
var musicArtist = item as MusicArtist;
|
||||||
if (musicArtist != null)
|
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)
|
|
||||||
{
|
{
|
||||||
|
Recursive = true,
|
||||||
IncludeItemTypes = new[] { typeof(Audio).Name },
|
IncludeItemTypes = new[] { typeof(Audio).Name },
|
||||||
ArtistIds = new[] { musicArtist.Id.ToString("N") }
|
ArtistIds = new[] { musicArtist.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 folder = item as Folder;
|
var folder = item as Folder;
|
||||||
|
@ -5,8 +5,6 @@ using MediaBrowser.Controller.Session;
|
|||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using MediaBrowser.Model.Diagnostics;
|
using MediaBrowser.Model.Diagnostics;
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Encoder
|
namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
@ -19,66 +17,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
protected override string GetCommandLineArguments(EncodingJob state)
|
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 encodingOptions = GetEncodingOptions();
|
||||||
|
|
||||||
var threads = EncodingHelper.GetNumberOfThreads(state, encodingOptions, false);
|
return EncodingHelper.GetProgressiveAudioFullCommandLine(state, encodingOptions, state.OutputFilePath);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetOutputFileExtension(EncodingJob state)
|
protected override string GetOutputFileExtension(EncodingJob state)
|
||||||
|
@ -41,8 +41,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
|
|
||||||
public string ItemType { get; set; }
|
public string ItemType { get; set; }
|
||||||
|
|
||||||
public string AlbumCoverPath { get; set; }
|
|
||||||
|
|
||||||
public string GetMimeType(string outputPath)
|
public string GetMimeType(string outputPath)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(MimeType))
|
if (!string.IsNullOrEmpty(MimeType))
|
||||||
|
@ -20,8 +20,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
{
|
{
|
||||||
var album = (MusicAlbum)item;
|
var album = (MusicAlbum)item;
|
||||||
|
|
||||||
var image = album.GetRecursiveChildren()
|
var image = album.GetRecursiveChildren(i => !i.IsFolder)
|
||||||
.OfType<Audio>()
|
|
||||||
.Select(i => i.GetImageInfo(type, 0))
|
.Select(i => i.GetImageInfo(type, 0))
|
||||||
.FirstOrDefault(i => i != null && i.IsLocalFile);
|
.FirstOrDefault(i => i != null && i.IsLocalFile);
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
private async Task<bool> AddDummySeasonFolders(Series series, CancellationToken cancellationToken)
|
private async Task<bool> AddDummySeasonFolders(Series series, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var episodesInSeriesFolder = series.GetRecursiveChildren()
|
var episodesInSeriesFolder = series.GetRecursiveChildren(i => i is Episode)
|
||||||
.OfType<Episode>()
|
.Cast<Episode>()
|
||||||
.Where(i => !i.IsInSeasonFolder)
|
.Where(i => !i.IsInSeasonFolder)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var existingEpisodes = (from s in series
|
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))
|
select new Tuple<int, Episode>((c.ParentIndexNumber ?? 0) , c))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
@ -275,13 +275,16 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return hasChanges;
|
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)) ??
|
return series.FirstOrDefault(s => s.GetRecursiveChildren(i => i is Season).Any(season => (season.IndexNumber) == seasonNumber)) ??
|
||||||
seriesAndOffsets.FirstOrDefault(s => s.GetRecursiveChildren().OfType<Season>().Any(season => (season.IndexNumber) == 1)) ??
|
series.FirstOrDefault(s => s.GetRecursiveChildren(i => i is Season).Any(season => (season.IndexNumber) == 1)) ??
|
||||||
seriesAndOffsets.OrderBy(s => s.GetRecursiveChildren().OfType<Season>().Select(season => season.IndexNumber).Min()).First();
|
series.OrderBy(s => s.GetRecursiveChildren(i => i is Season).Select(season => season.IndexNumber).Min()).First();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -292,7 +295,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
bool allowMissingEpisodes)
|
bool allowMissingEpisodes)
|
||||||
{
|
{
|
||||||
var existingEpisodes = (from s in series
|
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 })
|
select new { Episode = c })
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
@ -402,7 +405,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
// Season does not have a number
|
// Season does not have a number
|
||||||
// Remove if there are no episodes directly in series without a season 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();
|
.ToList();
|
||||||
|
|
||||||
|
@ -257,10 +257,15 @@ namespace MediaBrowser.Server.Mono
|
|||||||
new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager, FileSystem, new ConsoleLogger()).Log(exception);
|
new UnhandledExceptionWriter(_appHost.ServerConfigurationManager.ApplicationPaths, _logger, _appHost.LogManager, FileSystem, new ConsoleLogger()).Log(exception);
|
||||||
|
|
||||||
if (!Debugger.IsAttached)
|
if (!Debugger.IsAttached)
|
||||||
|
{
|
||||||
|
var message = LogHelper.GetLogMessage(exception).ToString();
|
||||||
|
|
||||||
|
if (message.IndexOf("InotifyWatcher", StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
{
|
{
|
||||||
Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
|
Environment.Exit(System.Runtime.InteropServices.Marshal.GetHRForException(exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void Shutdown()
|
public static void Shutdown()
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
<add key="ReleaseProgramDataPath" value="ProgramData-Server" />
|
<add key="ReleaseProgramDataPath" value="ProgramData-Server" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<runtime>
|
<runtime>
|
||||||
|
<legacyUnhandledExceptionPolicy enabled="1" />
|
||||||
|
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
|
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.2.13.4")]
|
[assembly: AssemblyVersion("3.2.13.5")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user