Merge branch 'dev'
This commit is contained in:
commit
f6ef727321
|
@ -10,6 +10,7 @@ namespace MediaBrowser.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Branding/Css", "GET", Summary = "Gets custom css")]
|
[Route("/Branding/Css", "GET", Summary = "Gets custom css")]
|
||||||
|
[Route("/Branding/Css.css", "GET", Summary = "Gets custom css")]
|
||||||
public class GetBrandingCss
|
public class GetBrandingCss
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,12 @@ namespace MediaBrowser.Api
|
||||||
hasBudget.Revenue = request.Revenue;
|
hasBudget.Revenue = request.Revenue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasOriginalTitle = item as IHasOriginalTitle;
|
||||||
|
if (hasOriginalTitle != null)
|
||||||
|
{
|
||||||
|
hasOriginalTitle.OriginalTitle = hasOriginalTitle.OriginalTitle;
|
||||||
|
}
|
||||||
|
|
||||||
var hasCriticRating = item as IHasCriticRating;
|
var hasCriticRating = item as IHasCriticRating;
|
||||||
if (hasCriticRating != null)
|
if (hasCriticRating != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,12 +197,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
|
|
||||||
var parentIds = new string[] { };
|
var parentIds = new string[] { };
|
||||||
var list = _libraryManager.GetItemList(query, parentIds)
|
var list = _libraryManager.GetItemList(query, parentIds)
|
||||||
.Where(i =>
|
.DistinctBy(i => i.PresentationUniqueKey, StringComparer.OrdinalIgnoreCase)
|
||||||
{
|
|
||||||
// Strip out secondary versions
|
|
||||||
var v = i as Video;
|
|
||||||
return v != null && !v.PrimaryVersionId.HasValue;
|
|
||||||
})
|
|
||||||
.DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
|
.DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -247,7 +242,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
var recentlyPlayedMovies = allMoviesForCategories
|
var recentlyPlayedMovies = allMoviesForCategories
|
||||||
.Select(i =>
|
.Select(i =>
|
||||||
{
|
{
|
||||||
var userdata = _userDataRepository.GetUserData(user.Id, i.GetUserDataKey());
|
var userdata = _userDataRepository.GetUserData(user, i);
|
||||||
return new Tuple<BaseItem, bool, DateTime>(i, userdata.Played, userdata.LastPlayedDate ?? DateTime.MinValue);
|
return new Tuple<BaseItem, bool, DateTime>(i, userdata.Played, userdata.LastPlayedDate ?? DateTime.MinValue);
|
||||||
})
|
})
|
||||||
.Where(i => i.Item2)
|
.Where(i => i.Item2)
|
||||||
|
@ -260,7 +255,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
.Select(i =>
|
.Select(i =>
|
||||||
{
|
{
|
||||||
var score = 0;
|
var score = 0;
|
||||||
var userData = _userDataRepository.GetUserData(user.Id, i.GetUserDataKey());
|
var userData = _userDataRepository.GetUserData(user, i);
|
||||||
|
|
||||||
if (userData.IsFavorite)
|
if (userData.IsFavorite)
|
||||||
{
|
{
|
||||||
|
|
|
@ -821,9 +821,14 @@ namespace MediaBrowser.Api.Playback
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
protected string GetVideoDecoder(StreamState state)
|
protected string GetVideoDecoder(StreamState state)
|
||||||
{
|
{
|
||||||
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
|
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
|
||||||
|
{
|
||||||
|
if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
switch (state.MediaSource.VideoStream.Codec.ToLower())
|
switch (state.MediaSource.VideoStream.Codec.ToLower())
|
||||||
{
|
{
|
||||||
|
@ -831,7 +836,8 @@ namespace MediaBrowser.Api.Playback
|
||||||
case "h264":
|
case "h264":
|
||||||
if (MediaEncoder.SupportsDecoder("h264_qsv"))
|
if (MediaEncoder.SupportsDecoder("h264_qsv"))
|
||||||
{
|
{
|
||||||
return "-c:v h264_qsv ";
|
// Seeing stalls and failures with decoding. Not worth it compared to encoding.
|
||||||
|
//return "-c:v h264_qsv ";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "mpeg2video":
|
case "mpeg2video":
|
||||||
|
@ -1033,7 +1039,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
process.BeginOutputReadLine();
|
process.BeginOutputReadLine();
|
||||||
|
|
||||||
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
|
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
|
||||||
StartStreamingLog(transcodingJob, state, process.StandardError.BaseStream, state.LogFileStream);
|
Task.Run(() => StartStreamingLog(transcodingJob, state, process.StandardError.BaseStream, state.LogFileStream));
|
||||||
|
|
||||||
// Wait for the file to exist before proceeeding
|
// Wait for the file to exist before proceeeding
|
||||||
while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
|
while (!FileSystem.FileExists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
|
||||||
|
@ -1076,7 +1082,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void StartStreamingLog(TranscodingJob transcodingJob, StreamState state, Stream source, Stream target)
|
private async Task StartStreamingLog(TranscodingJob transcodingJob, StreamState state, Stream source, Stream target)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1804,6 +1810,15 @@ namespace MediaBrowser.Api.Playback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.Equals("h264", videoStream.Codec, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (videoStream.IsAVC.HasValue && !videoStream.IsAVC.Value)
|
||||||
|
{
|
||||||
|
Logger.Debug("Cannot stream copy video. Stream is marked as not AVC");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Source and target codecs must match
|
// Source and target codecs must match
|
||||||
if (!string.Equals(request.VideoCodec, videoStream.Codec, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(request.VideoCodec, videoStream.Codec, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -2222,9 +2237,10 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
if (state.VideoRequest != null)
|
if (state.VideoRequest != null)
|
||||||
{
|
{
|
||||||
|
// Important: If this is ever re-enabled, make sure not to use it with wtv because it breaks seeking
|
||||||
if (string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase) && state.VideoRequest.CopyTimestamps)
|
if (string.Equals(state.OutputContainer, "mkv", StringComparison.OrdinalIgnoreCase) && state.VideoRequest.CopyTimestamps)
|
||||||
{
|
{
|
||||||
inputModifier += " -noaccurate_seek";
|
//inputModifier += " -noaccurate_seek";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,17 +289,5 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
|
|
||||||
return isLiveStream;
|
return isLiveStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CanStreamCopyAudio(StreamState state, List<string> supportedAudioCodecs)
|
|
||||||
{
|
|
||||||
var isLiveStream = IsLiveStream(state);
|
|
||||||
|
|
||||||
if (!isLiveStream)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.CanStreamCopyAudio(state, supportedAudioCodecs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -500,18 +500,6 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary<string, string>());
|
return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary<string, string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsLiveStream(StreamState state)
|
|
||||||
{
|
|
||||||
var isLiveStream = (state.RunTimeTicks ?? 0) == 0;
|
|
||||||
|
|
||||||
if (state.VideoRequest.ForceLiveStream)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return isLiveStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetMasterPlaylistFileText(StreamState state, int totalBitrate)
|
private string GetMasterPlaylistFileText(StreamState state, int totalBitrate)
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
@ -830,11 +818,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
{
|
{
|
||||||
if (state.VideoStream != null && IsH264(state.VideoStream) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
if (state.VideoStream != null && IsH264(state.VideoStream) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
|
|
||||||
args += " -bsf:v h264_mp4toannexb";
|
args += " -bsf:v h264_mp4toannexb";
|
||||||
}
|
}
|
||||||
|
|
||||||
args += " -flags -global_header -sc_threshold 0";
|
args += " -flags -global_header";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -859,7 +846,12 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
args += GetGraphicalSubtitleParam(state, codec);
|
args += GetGraphicalSubtitleParam(state, codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
args += " -flags -global_header -sc_threshold 0";
|
args += " -flags -global_header";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EnableCopyTs(state) && args.IndexOf("-copyts", StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
|
{
|
||||||
|
args += " -copyts";
|
||||||
}
|
}
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
|
@ -867,7 +859,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
|
|
||||||
private bool EnableCopyTs(StreamState state)
|
private bool EnableCopyTs(StreamState state)
|
||||||
{
|
{
|
||||||
return state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.VideoRequest.SubtitleMethod == SubtitleDeliveryMethod.Encode;
|
//return state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.VideoRequest.SubtitleMethod == SubtitleDeliveryMethod.Encode;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding)
|
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding)
|
||||||
|
@ -889,24 +882,28 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
|
|
||||||
var mapArgs = state.IsOutputVideo ? GetMapArgs(state) : string.Empty;
|
var mapArgs = state.IsOutputVideo ? GetMapArgs(state) : string.Empty;
|
||||||
|
|
||||||
//var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state);
|
var enableGenericSegmenter = false;
|
||||||
|
|
||||||
//return string.Format("{0} {11} {1}{10} -map_metadata -1 -threads {2} {3} {4} {5} -f segment -segment_time {6} -segment_format mpegts -segment_list_type m3u8 -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
|
if (enableGenericSegmenter)
|
||||||
// inputModifier,
|
{
|
||||||
// GetInputArgument(state),
|
var outputTsArg = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state);
|
||||||
// threads,
|
|
||||||
// mapArgs,
|
|
||||||
// GetVideoArguments(state),
|
|
||||||
// GetAudioArguments(state),
|
|
||||||
// state.SegmentLength.ToString(UsCulture),
|
|
||||||
// startNumberParam,
|
|
||||||
// outputPath,
|
|
||||||
// outputTsArg,
|
|
||||||
// slowSeekParam,
|
|
||||||
// toTimeParam
|
|
||||||
// ).Trim();
|
|
||||||
|
|
||||||
return string.Format("{0}{11} {1} -map_metadata -1 -threads {2} {3} {4}{5} {6} -hls_time {7} -start_number {8} -hls_list_size {9} -y \"{10}\"",
|
return string.Format("{0} {10} {1} -map_metadata -1 -threads {2} {3} {4} {5} -f segment -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -segment_time {6} -segment_format mpegts -segment_list_type m3u8 -segment_start_number {7} -segment_list \"{8}\" -y \"{9}\"",
|
||||||
|
inputModifier,
|
||||||
|
GetInputArgument(state),
|
||||||
|
threads,
|
||||||
|
mapArgs,
|
||||||
|
GetVideoArguments(state),
|
||||||
|
GetAudioArguments(state),
|
||||||
|
state.SegmentLength.ToString(UsCulture),
|
||||||
|
startNumberParam,
|
||||||
|
outputPath,
|
||||||
|
outputTsArg,
|
||||||
|
toTimeParam
|
||||||
|
).Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Format("{0}{11} {1} -map_metadata -1 -threads {2} {3} {4}{5} {6} -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero -hls_time {7} -start_number {8} -hls_list_size {9} -y \"{10}\"",
|
||||||
inputModifier,
|
inputModifier,
|
||||||
GetInputArgument(state),
|
GetInputArgument(state),
|
||||||
threads,
|
threads,
|
||||||
|
@ -946,10 +943,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
{
|
{
|
||||||
var isLiveStream = IsLiveStream(state);
|
var isLiveStream = IsLiveStream(state);
|
||||||
|
|
||||||
if (!isLiveStream)
|
//if (!isLiveStream && Request.QueryString["AllowCustomSegmenting"] != "true")
|
||||||
{
|
//{
|
||||||
return false;
|
// return false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
return base.CanStreamCopyVideo(state);
|
return base.CanStreamCopyVideo(state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,6 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
// if h264_mp4toannexb is ever added, do not use it for live tv
|
// if h264_mp4toannexb is ever added, do not use it for live tv
|
||||||
if (state.VideoStream != null && IsH264(state.VideoStream) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
if (state.VideoStream != null && IsH264(state.VideoStream) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
|
|
||||||
args += " -bsf:v h264_mp4toannexb";
|
args += " -bsf:v h264_mp4toannexb";
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
|
|
|
@ -15,6 +15,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Playback
|
namespace MediaBrowser.Api.Playback
|
||||||
{
|
{
|
||||||
|
@ -66,14 +67,16 @@ namespace MediaBrowser.Api.Playback
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
private readonly INetworkManager _networkManager;
|
private readonly INetworkManager _networkManager;
|
||||||
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
|
|
||||||
public MediaInfoService(IMediaSourceManager mediaSourceManager, IDeviceManager deviceManager, ILibraryManager libraryManager, IServerConfigurationManager config, INetworkManager networkManager)
|
public MediaInfoService(IMediaSourceManager mediaSourceManager, IDeviceManager deviceManager, ILibraryManager libraryManager, IServerConfigurationManager config, INetworkManager networkManager, IMediaEncoder mediaEncoder)
|
||||||
{
|
{
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_deviceManager = deviceManager;
|
_deviceManager = deviceManager;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_config = config;
|
_config = config;
|
||||||
_networkManager = networkManager;
|
_networkManager = networkManager;
|
||||||
|
_mediaEncoder = mediaEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Get(GetBitrateTestBytes request)
|
public object Get(GetBitrateTestBytes request)
|
||||||
|
@ -241,7 +244,7 @@ namespace MediaBrowser.Api.Playback
|
||||||
int? subtitleStreamIndex,
|
int? subtitleStreamIndex,
|
||||||
string playSessionId)
|
string playSessionId)
|
||||||
{
|
{
|
||||||
var streamBuilder = new StreamBuilder(Logger);
|
var streamBuilder = new StreamBuilder(_mediaEncoder, Logger);
|
||||||
|
|
||||||
var options = new VideoOptions
|
var options = new VideoOptions
|
||||||
{
|
{
|
||||||
|
|
|
@ -141,7 +141,6 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||||
{
|
{
|
||||||
if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
|
|
||||||
args += " -bsf:v h264_mp4toannexb";
|
args += " -bsf:v h264_mp4toannexb";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,19 @@ namespace MediaBrowser.Api.Playback
|
||||||
|
|
||||||
public List<string> PlayableStreamFileNames { get; set; }
|
public List<string> PlayableStreamFileNames { get; set; }
|
||||||
|
|
||||||
public int SegmentLength = 3;
|
public int SegmentLength
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int HlsListSize
|
public int HlsListSize
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -274,7 +274,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
items = items.Where(i =>
|
items = items.Where(i =>
|
||||||
{
|
{
|
||||||
var userdata = UserDataRepository.GetUserData(user.Id, i.GetUserDataKey());
|
var userdata = UserDataRepository.GetUserData(user, i);
|
||||||
|
|
||||||
return userdata != null && userdata.Likes.HasValue && !userdata.Likes.Value;
|
return userdata != null && userdata.Likes.HasValue && !userdata.Likes.Value;
|
||||||
});
|
});
|
||||||
|
@ -284,7 +284,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
items = items.Where(i =>
|
items = items.Where(i =>
|
||||||
{
|
{
|
||||||
var userdata = UserDataRepository.GetUserData(user.Id, i.GetUserDataKey());
|
var userdata = UserDataRepository.GetUserData(user, i);
|
||||||
|
|
||||||
return userdata != null && userdata.Likes.HasValue && userdata.Likes.Value;
|
return userdata != null && userdata.Likes.HasValue && userdata.Likes.Value;
|
||||||
});
|
});
|
||||||
|
@ -294,7 +294,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
items = items.Where(i =>
|
items = items.Where(i =>
|
||||||
{
|
{
|
||||||
var userdata = UserDataRepository.GetUserData(user.Id, i.GetUserDataKey());
|
var userdata = UserDataRepository.GetUserData(user, i);
|
||||||
|
|
||||||
var likes = userdata.Likes ?? false;
|
var likes = userdata.Likes ?? false;
|
||||||
var favorite = userdata.IsFavorite;
|
var favorite = userdata.IsFavorite;
|
||||||
|
@ -307,7 +307,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
{
|
{
|
||||||
items = items.Where(i =>
|
items = items.Where(i =>
|
||||||
{
|
{
|
||||||
var userdata = UserDataRepository.GetUserData(user.Id, i.GetUserDataKey());
|
var userdata = UserDataRepository.GetUserData(user, i);
|
||||||
|
|
||||||
return userdata != null && userdata.IsFavorite;
|
return userdata != null && userdata.IsFavorite;
|
||||||
});
|
});
|
||||||
|
|
|
@ -519,10 +519,8 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(itemId) ? user.RootFolder : _libraryManager.GetItemById(itemId);
|
var item = string.IsNullOrEmpty(itemId) ? user.RootFolder : _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
var key = item.GetUserDataKey();
|
|
||||||
|
|
||||||
// Get the user data for this item
|
// Get the user data for this item
|
||||||
var data = _userDataRepository.GetUserData(user.Id, key);
|
var data = _userDataRepository.GetUserData(user, item);
|
||||||
|
|
||||||
// Set favorite status
|
// Set favorite status
|
||||||
data.IsFavorite = isFavorite;
|
data.IsFavorite = isFavorite;
|
||||||
|
@ -567,10 +565,8 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
var item = string.IsNullOrEmpty(itemId) ? user.RootFolder : _libraryManager.GetItemById(itemId);
|
var item = string.IsNullOrEmpty(itemId) ? user.RootFolder : _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
var key = item.GetUserDataKey();
|
|
||||||
|
|
||||||
// Get the user data for this item
|
// Get the user data for this item
|
||||||
var data = _userDataRepository.GetUserData(user.Id, key);
|
var data = _userDataRepository.GetUserData(user, item);
|
||||||
|
|
||||||
data.Likes = likes;
|
data.Likes = likes;
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ namespace MediaBrowser.Api
|
||||||
var items = request.Ids.Split(',')
|
var items = request.Ids.Split(',')
|
||||||
.Select(i => new Guid(i))
|
.Select(i => new Guid(i))
|
||||||
.Select(i => _libraryManager.GetItemById(i))
|
.Select(i => _libraryManager.GetItemById(i))
|
||||||
|
.OfType<Video>()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (items.Count < 2)
|
if (items.Count < 2)
|
||||||
|
@ -137,14 +138,7 @@ namespace MediaBrowser.Api
|
||||||
throw new ArgumentException("Please supply at least two videos to merge.");
|
throw new ArgumentException("Please supply at least two videos to merge.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items.Any(i => !(i is Video)))
|
var videosWithVersions = items.Where(i => i.MediaSourceCount > 1)
|
||||||
{
|
|
||||||
throw new ArgumentException("Only videos can be grouped together.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var videos = items.Cast<Video>().ToList();
|
|
||||||
|
|
||||||
var videosWithVersions = videos.Where(i => i.MediaSourceCount > 1)
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (videosWithVersions.Count > 1)
|
if (videosWithVersions.Count > 1)
|
||||||
|
@ -156,7 +150,7 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
if (primaryVersion == null)
|
if (primaryVersion == null)
|
||||||
{
|
{
|
||||||
primaryVersion = videos.OrderBy(i =>
|
primaryVersion = items.OrderBy(i =>
|
||||||
{
|
{
|
||||||
if (i.Video3DFormat.HasValue)
|
if (i.Video3DFormat.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +173,7 @@ namespace MediaBrowser.Api
|
||||||
}).First();
|
}).First();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var item in videos.Where(i => i.Id != primaryVersion.Id))
|
foreach (var item in items.Where(i => i.Id != primaryVersion.Id))
|
||||||
{
|
{
|
||||||
item.PrimaryVersionId = primaryVersion.Id;
|
item.PrimaryVersionId = primaryVersion.Id;
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,9 @@
|
||||||
<Reference Include="MoreLinq">
|
<Reference Include="MoreLinq">
|
||||||
<HintPath>..\packages\morelinq.1.4.0\lib\net35\MoreLinq.dll</HintPath>
|
<HintPath>..\packages\morelinq.1.4.0\lib\net35\MoreLinq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="NLog">
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NLog.4.2.3\lib\net45\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.4.3.1\lib\net45\NLog.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Patterns.Logging">
|
<Reference Include="Patterns.Logging">
|
||||||
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
|
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
|
||||||
|
@ -64,8 +65,9 @@
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>
|
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimpleInjector">
|
<Reference Include="SimpleInjector, Version=3.1.3.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SimpleInjector.3.1.2\lib\net45\SimpleInjector.dll</HintPath>
|
<HintPath>..\packages\SimpleInjector.3.1.3\lib\net45\SimpleInjector.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<packages>
|
<packages>
|
||||||
<package id="CommonIO" version="1.0.0.9" targetFramework="net45" />
|
<package id="CommonIO" version="1.0.0.9" targetFramework="net45" />
|
||||||
<package id="morelinq" version="1.4.0" targetFramework="net45" />
|
<package id="morelinq" version="1.4.0" targetFramework="net45" />
|
||||||
<package id="NLog" version="4.2.3" targetFramework="net45" />
|
<package id="NLog" version="4.3.1" targetFramework="net45" />
|
||||||
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
||||||
<package id="SimpleInjector" version="3.1.2" targetFramework="net45" />
|
<package id="SimpleInjector" version="3.1.3" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
|
@ -150,12 +150,10 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
|
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
|
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
|
||||||
{
|
{
|
||||||
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
|
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
|
||||||
|
@ -178,25 +176,25 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
songKey = albumArtist + "-" + songKey;
|
songKey = albumArtist + "-" + songKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
return songKey;
|
list.Insert(0, songKey);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
var parent = AlbumEntity;
|
var parent = AlbumEntity;
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null && IndexNumber.HasValue)
|
||||||
{
|
{
|
||||||
var parentKey = parent.GetUserDataKey();
|
list.InsertRange(0, parent.GetUserDataKeys().Select(i =>
|
||||||
|
|
||||||
if (IndexNumber.HasValue)
|
|
||||||
{
|
{
|
||||||
var songKey = (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
|
var songKey = (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
|
||||||
+ IndexNumber.Value.ToString("0000 - ");
|
+ IndexNumber.Value.ToString("0000 - ");
|
||||||
|
|
||||||
return parentKey + songKey;
|
return i + songKey;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UnratedItem GetBlockUnratedType()
|
public override UnratedItem GetBlockUnratedType()
|
||||||
|
|
|
@ -96,36 +96,34 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
|
|
||||||
public List<string> Artists { get; set; }
|
public List<string> Artists { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
var id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(id))
|
|
||||||
{
|
|
||||||
return "MusicAlbum-MusicBrainzReleaseGroup-" + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(id))
|
|
||||||
{
|
|
||||||
return "MusicAlbum-Musicbrainz-" + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
|
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
|
||||||
{
|
{
|
||||||
var albumArtist = AlbumArtist;
|
var albumArtist = AlbumArtist;
|
||||||
if (!string.IsNullOrWhiteSpace(albumArtist))
|
if (!string.IsNullOrWhiteSpace(albumArtist))
|
||||||
{
|
{
|
||||||
return albumArtist + "-" + Name;
|
list.Insert(0, albumArtist + "-" + Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
var id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(id))
|
||||||
|
{
|
||||||
|
list.Insert(0, "MusicAlbum-Musicbrainz-" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(id))
|
||||||
|
{
|
||||||
|
list.Insert(0, "MusicAlbum-MusicBrainzReleaseGroup-" + id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||||
|
|
|
@ -80,13 +80,12 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
ProductionLocations = new List<string>();
|
ProductionLocations = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return GetUserDataKey(this);
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.InsertRange(0, GetUserDataKeys(this));
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -121,16 +120,18 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
private static string GetUserDataKey(MusicArtist item)
|
private static List<string> GetUserDataKeys(MusicArtist item)
|
||||||
{
|
{
|
||||||
|
var list = new List<string>();
|
||||||
var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
|
var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(id))
|
if (!string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
return "Artist-Musicbrainz-" + id;
|
list.Add("Artist-Musicbrainz-" + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Artist-" + item.Name;
|
list.Add("Artist-" + item.Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||||
|
|
|
@ -10,13 +10,12 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MusicGenre : BaseItem, IItemByName
|
public class MusicGenre : BaseItem, IItemByName
|
||||||
{
|
{
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return "MusicGenre-" + Name;
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.Insert(0, "MusicGenre-" + Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
|
|
@ -125,6 +125,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string OriginalTitle { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1147,6 +1149,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
get { return null; }
|
get { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public virtual string PresentationUniqueKey
|
||||||
|
{
|
||||||
|
get { return Id.ToString("N"); }
|
||||||
|
}
|
||||||
|
|
||||||
private string _userDataKey;
|
private string _userDataKey;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user data key.
|
/// Gets the user data key.
|
||||||
|
@ -1156,7 +1164,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(_userDataKey))
|
if (string.IsNullOrWhiteSpace(_userDataKey))
|
||||||
{
|
{
|
||||||
var key = CreateUserDataKey();
|
var key = GetUserDataKeys().First();
|
||||||
_userDataKey = key;
|
_userDataKey = key;
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -1164,16 +1172,20 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return _userDataKey;
|
return _userDataKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string CreateUserDataKey()
|
public virtual List<string> GetUserDataKeys()
|
||||||
{
|
{
|
||||||
|
var list = new List<string>();
|
||||||
|
|
||||||
if (SourceType == SourceType.Channel)
|
if (SourceType == SourceType.Channel)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(ExternalId))
|
if (!string.IsNullOrWhiteSpace(ExternalId))
|
||||||
{
|
{
|
||||||
return ExternalId;
|
list.Add(ExternalId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Id.ToString();
|
|
||||||
|
list.Add(Id.ToString());
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal virtual bool IsValidFromResolver(BaseItem newItem)
|
internal virtual bool IsValidFromResolver(BaseItem newItem)
|
||||||
|
@ -1540,11 +1552,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(info.Path))
|
if (!string.IsNullOrEmpty(info.Path))
|
||||||
{
|
{
|
||||||
var itemByPath = LibraryManager.FindByPath(info.Path);
|
var itemByPath = LibraryManager.FindByPath(info.Path, null);
|
||||||
|
|
||||||
if (itemByPath == null)
|
if (itemByPath == null)
|
||||||
{
|
{
|
||||||
Logger.Warn("Unable to find linked item at path {0}", info.Path);
|
//Logger.Warn("Unable to find linked item at path {0}", info.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemByPath;
|
return itemByPath;
|
||||||
|
@ -1553,6 +1565,15 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public virtual bool EnableRememberingTrackSelections
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a studio to the item
|
/// Adds a studio to the item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1606,9 +1627,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = GetUserDataKey();
|
var data = UserDataManager.GetUserData(user, this);
|
||||||
|
|
||||||
var data = UserDataManager.GetUserData(user.Id, key);
|
|
||||||
|
|
||||||
if (datePlayed.HasValue)
|
if (datePlayed.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -1643,9 +1662,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = GetUserDataKey();
|
var data = UserDataManager.GetUserData(user, this);
|
||||||
|
|
||||||
var data = UserDataManager.GetUserData(user.Id, key);
|
|
||||||
|
|
||||||
//I think it is okay to do this here.
|
//I think it is okay to do this here.
|
||||||
// if this is only called when a user is manually forcing something to un-played
|
// if this is only called when a user is manually forcing something to un-played
|
||||||
|
@ -1976,14 +1993,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
public virtual bool IsPlayed(User user)
|
public virtual bool IsPlayed(User user)
|
||||||
{
|
{
|
||||||
var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
|
var userdata = UserDataManager.GetUserData(user, this);
|
||||||
|
|
||||||
return userdata != null && userdata.Played;
|
return userdata != null && userdata.Played;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsFavoriteOrLiked(User user)
|
public bool IsFavoriteOrLiked(User user)
|
||||||
{
|
{
|
||||||
var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
|
var userdata = UserDataManager.GetUserData(user, this);
|
||||||
|
|
||||||
return userdata != null && (userdata.IsFavorite || (userdata.Likes ?? false));
|
return userdata != null && (userdata.IsFavorite || (userdata.Likes ?? false));
|
||||||
}
|
}
|
||||||
|
@ -1995,7 +2012,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
throw new ArgumentNullException("user");
|
throw new ArgumentNullException("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
|
var userdata = UserDataManager.GetUserData(user, this);
|
||||||
|
|
||||||
return userdata == null || !userdata.Played;
|
return userdata == null || !userdata.Played;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ using System.Runtime.Serialization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
using MoreLinq;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
|
@ -97,7 +98,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return base.IsValidFromResolver(newItem);
|
return base.IsValidFromResolver(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,9 +200,30 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
public IEnumerable<Folder> GetPhysicalParents()
|
public IEnumerable<Folder> GetPhysicalParents()
|
||||||
{
|
{
|
||||||
return LibraryManager.RootFolder.Children
|
var rootChildren = LibraryManager.RootFolder.Children
|
||||||
.OfType<Folder>()
|
.OfType<Folder>()
|
||||||
.Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase));
|
.ToList();
|
||||||
|
|
||||||
|
return PhysicalLocations.Where(i => !string.Equals(i, Path, StringComparison.OrdinalIgnoreCase)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<Folder> GetPhysicalParents(string path, List<Folder> rootChildren)
|
||||||
|
{
|
||||||
|
var result = rootChildren
|
||||||
|
.Where(i => string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (result.Count == 0)
|
||||||
|
{
|
||||||
|
var folder = LibraryManager.FindByPath(path, true) as Folder;
|
||||||
|
|
||||||
|
if (folder != null)
|
||||||
|
{
|
||||||
|
result.Add(folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
|
|
@ -839,11 +839,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.SeriesSortName");
|
Logger.Debug("Query requires post-filtering due to ItemSortBy.SeriesSortName");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (query.SortBy.Contains(ItemSortBy.StartDate, StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.StartDate");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (query.SortBy.Contains(ItemSortBy.Studio, StringComparer.OrdinalIgnoreCase))
|
if (query.SortBy.Contains(ItemSortBy.Studio, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Debug("Query requires post-filtering due to ItemSortBy.Studio");
|
Logger.Debug("Query requires post-filtering due to ItemSortBy.Studio");
|
||||||
|
@ -1059,30 +1054,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameContains))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameContains");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameLessThan))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameLessThan");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameStartsWith))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameStartsWith");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.NameStartsWithOrGreater))
|
|
||||||
{
|
|
||||||
Logger.Debug("Query requires post-filtering due to NameStartsWithOrGreater");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.AirDays.Length > 0)
|
if (query.AirDays.Length > 0)
|
||||||
{
|
{
|
||||||
Logger.Debug("Query requires post-filtering due to AirDays");
|
Logger.Debug("Query requires post-filtering due to AirDays");
|
||||||
|
@ -1635,7 +1606,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
var isUnplayed = true;
|
var isUnplayed = true;
|
||||||
|
|
||||||
var itemUserData = UserDataManager.GetUserData(user.Id, child.GetUserDataKey());
|
var itemUserData = UserDataManager.GetUserData(user, child);
|
||||||
|
|
||||||
// Incrememt totalPercentPlayed
|
// Incrememt totalPercentPlayed
|
||||||
if (itemUserData != null)
|
if (itemUserData != null)
|
||||||
|
|
|
@ -76,15 +76,16 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> MultiPartGameFiles { get; set; }
|
public List<string> MultiPartGameFiles { get; set; }
|
||||||
|
|
||||||
protected override string CreateUserDataKey()
|
public override List<string> GetUserDataKeys()
|
||||||
{
|
{
|
||||||
|
var list = base.GetUserDataKeys();
|
||||||
var id = this.GetProviderId(MetadataProviders.Gamesdb);
|
var id = this.GetProviderId(MetadataProviders.Gamesdb);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(id))
|
if (!string.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
return "Game-Gamesdb-" + id;
|
list.Insert(0, "Game-Gamesdb-" + id);
|
||||||
}
|
}
|
||||||
return base.CreateUserDataKey();
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<string> GetDeletePaths()
|
public override IEnumerable<string> GetDeletePaths()
|
||||||
|
|
|
@ -7,13 +7,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
public class GameGenre : BaseItem, IItemByName
|
public class GameGenre : BaseItem, IItemByName
|
||||||
{
|
{
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return "GameGenre-" + Name;
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.Insert(0, "GameGenre-" + Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using MediaBrowser.Model.Users;
|
using MediaBrowser.Model.Users;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
|
@ -31,17 +32,15 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <value>The game system.</value>
|
/// <value>The game system.</value>
|
||||||
public string GameSystemName { get; set; }
|
public string GameSystemName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(GameSystemName))
|
if (!string.IsNullOrEmpty(GameSystemName))
|
||||||
{
|
{
|
||||||
return "GameSystem-" + GameSystemName;
|
list.Insert(0, "GameSystem-" + GameSystemName);
|
||||||
}
|
}
|
||||||
return base.CreateUserDataKey();
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||||
|
|
|
@ -11,13 +11,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Genre : BaseItem, IItemByName
|
public class Genre : BaseItem, IItemByName
|
||||||
{
|
{
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return "Genre-" + Name;
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.Insert(0, "Genre-" + Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Model.Dto;
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
|
@ -13,6 +14,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
string GetUserDataKey();
|
string GetUserDataKey();
|
||||||
|
|
||||||
|
List<string> GetUserDataKeys();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fills the user data dto values.
|
/// Fills the user data dto values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -20,5 +23,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <param name="userData">The user data.</param>
|
/// <param name="userData">The user data.</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, User user);
|
void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, User user);
|
||||||
|
|
||||||
|
bool EnableRememberingTrackSelections { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
public string NameLessThan { get; set; }
|
public string NameLessThan { get; set; }
|
||||||
public string NameContains { get; set; }
|
public string NameContains { get; set; }
|
||||||
|
|
||||||
|
public string PresentationUniqueKey { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
public string Person { get; set; }
|
public string Person { get; set; }
|
||||||
|
|
|
@ -18,8 +18,6 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
{
|
{
|
||||||
public List<Guid> SpecialFeatureIds { get; set; }
|
public List<Guid> SpecialFeatureIds { get; set; }
|
||||||
|
|
||||||
public string OriginalTitle { get; set; }
|
|
||||||
|
|
||||||
public List<Guid> ThemeSongIds { get; set; }
|
public List<Guid> ThemeSongIds { get; set; }
|
||||||
public List<Guid> ThemeVideoIds { get; set; }
|
public List<Guid> ThemeVideoIds { get; set; }
|
||||||
public List<string> ProductionLocations { get; set; }
|
public List<string> ProductionLocations { get; set; }
|
||||||
|
@ -78,34 +76,6 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
set { TmdbCollectionName = value; }
|
set { TmdbCollectionName = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
|
||||||
var key = GetMovieUserDataKey(this);
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(key))
|
|
||||||
{
|
|
||||||
key = base.CreateUserDataKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetMovieUserDataKey(BaseItem movie)
|
|
||||||
{
|
|
||||||
var key = movie.GetProviderId(MetadataProviders.Tmdb);
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(key))
|
|
||||||
{
|
|
||||||
key = movie.GetProviderId(MetadataProviders.Imdb);
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var hasChanges = await base.RefreshedOwnedItems(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
var hasChanges = await base.RefreshedOwnedItems(options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
|
@ -44,15 +44,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
|
||||||
return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.CreateUserDataKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override UnratedItem GetBlockUnratedType()
|
public override UnratedItem GetBlockUnratedType()
|
||||||
{
|
{
|
||||||
return UnratedItem.Music;
|
return UnratedItem.Music;
|
||||||
|
|
|
@ -18,13 +18,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <value>The place of birth.</value>
|
/// <value>The place of birth.</value>
|
||||||
public string PlaceOfBirth { get; set; }
|
public string PlaceOfBirth { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return "Person-" + Name;
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.Insert(0, "Person-" + Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersonLookupInfo GetLookupInfo()
|
public PersonLookupInfo GetLookupInfo()
|
||||||
|
|
|
@ -10,13 +10,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Studio : BaseItem, IItemByName, IHasTags
|
public class Studio : BaseItem, IItemByName, IHasTags
|
||||||
{
|
{
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return "Studio-" + Name;
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.Insert(0, "Studio-" + Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -58,25 +58,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? PhysicalSeasonNumber;
|
return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[IgnoreDataMember]
|
|
||||||
public int? PhysicalSeasonNumber
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var value = ParentIndexNumber;
|
|
||||||
|
|
||||||
if (value.HasValue)
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
var season = Season;
|
|
||||||
|
|
||||||
return season != null ? season.IndexNumber : null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,20 +80,26 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[IgnoreDataMember]
|
||||||
/// Gets the user data key.
|
protected override bool EnableDefaultVideoUserDataKeys
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
var series = Series;
|
get
|
||||||
|
|
||||||
if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
|
|
||||||
{
|
{
|
||||||
return series.GetUserDataKey() + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000");
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
public override List<string> GetUserDataKeys()
|
||||||
|
{
|
||||||
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
var series = Series;
|
||||||
|
if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
|
||||||
|
{
|
||||||
|
list.InsertRange(0, series.GetUserDataKeys().Select(i => i + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -310,6 +298,19 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString());
|
Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ParentIndexNumber.HasValue)
|
||||||
|
{
|
||||||
|
var season = Season;
|
||||||
|
if (season != null)
|
||||||
|
{
|
||||||
|
if (season.ParentIndexNumber.HasValue)
|
||||||
|
{
|
||||||
|
ParentIndexNumber = season.ParentIndexNumber;
|
||||||
|
hasChanges = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hasChanges;
|
return hasChanges;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,19 +53,17 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
if (Series != null)
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
var series = Series;
|
||||||
|
if (series != null)
|
||||||
{
|
{
|
||||||
var seasonNo = IndexNumber ?? 0;
|
list.InsertRange(0, series.GetUserDataKeys().Select(i => i + (IndexNumber ?? 0).ToString("000")));
|
||||||
return Series.GetUserDataKey() + seasonNo.ToString("000");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -94,6 +92,24 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override string PresentationUniqueKey
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IndexNumber.HasValue)
|
||||||
|
{
|
||||||
|
var series = Series;
|
||||||
|
if (series != null)
|
||||||
|
{
|
||||||
|
return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.PresentationUniqueKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the name of the sort.
|
/// Creates the name of the sort.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -171,16 +187,16 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
|
|
||||||
public IEnumerable<Episode> GetEpisodes(User user, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes)
|
public IEnumerable<Episode> GetEpisodes(User user, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes)
|
||||||
{
|
{
|
||||||
var episodes = GetRecursiveChildren(user)
|
|
||||||
.OfType<Episode>();
|
|
||||||
|
|
||||||
var series = Series;
|
var series = Series;
|
||||||
|
|
||||||
if (IndexNumber.HasValue && series != null)
|
if (IndexNumber.HasValue && series != null)
|
||||||
{
|
{
|
||||||
return series.GetEpisodes(user, IndexNumber.Value, includeMissingEpisodes, includeVirtualUnairedEpisodes, episodes);
|
return series.GetEpisodes(user, IndexNumber.Value, includeMissingEpisodes, includeVirtualUnairedEpisodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var episodes = GetRecursiveChildren(user)
|
||||||
|
.OfType<Episode>();
|
||||||
|
|
||||||
if (series != null && series.ContainsEpisodesWithoutSeasonFolders)
|
if (series != null && series.ContainsEpisodesWithoutSeasonFolders)
|
||||||
{
|
{
|
||||||
var seasonNumber = IndexNumber;
|
var seasonNumber = IndexNumber;
|
||||||
|
|
|
@ -19,8 +19,6 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
{
|
{
|
||||||
public List<Guid> SpecialFeatureIds { get; set; }
|
public List<Guid> SpecialFeatureIds { get; set; }
|
||||||
|
|
||||||
public string OriginalTitle { get; set; }
|
|
||||||
|
|
||||||
public int? AnimeSeriesIndex { get; set; }
|
public int? AnimeSeriesIndex { get; set; }
|
||||||
|
|
||||||
public Series()
|
public Series()
|
||||||
|
@ -93,25 +91,33 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override string PresentationUniqueKey
|
||||||
|
{
|
||||||
|
get { return GetUserDataKeys().First(); }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user data key.
|
/// Gets the user data key.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
protected override string CreateUserDataKey()
|
public override List<string> GetUserDataKeys()
|
||||||
{
|
{
|
||||||
var key = this.GetProviderId(MetadataProviders.Tvdb);
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(key))
|
var key = this.GetProviderId(MetadataProviders.Imdb);
|
||||||
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
{
|
{
|
||||||
key = this.GetProviderId(MetadataProviders.Imdb);
|
list.Insert(0, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(key))
|
key = this.GetProviderId(MetadataProviders.Tvdb);
|
||||||
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
{
|
{
|
||||||
key = base.CreateUserDataKey();
|
list.Insert(0, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return key;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -185,8 +191,28 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
|
|
||||||
public IEnumerable<Season> GetSeasons(User user, bool includeMissingSeasons, bool includeVirtualUnaired)
|
public IEnumerable<Season> GetSeasons(User user, bool includeMissingSeasons, bool includeVirtualUnaired)
|
||||||
{
|
{
|
||||||
var seasons = base.GetChildren(user, true)
|
var seriesIds = LibraryManager.GetItemIds(new InternalItemsQuery(user)
|
||||||
.OfType<Season>();
|
{
|
||||||
|
PresentationUniqueKey = PresentationUniqueKey,
|
||||||
|
IncludeItemTypes = new[] { typeof(Series).Name }
|
||||||
|
});
|
||||||
|
|
||||||
|
IEnumerable<Season> seasons;
|
||||||
|
|
||||||
|
if (seriesIds.Count > 1)
|
||||||
|
{
|
||||||
|
seasons = LibraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
|
{
|
||||||
|
AncestorIds = seriesIds.Select(i => i.ToString("N")).ToArray(),
|
||||||
|
IncludeItemTypes = new[] { typeof(Season).Name },
|
||||||
|
SortBy = new[] { ItemSortBy.SortName }
|
||||||
|
|
||||||
|
}).OfType<Season>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
seasons = base.GetChildren(user, true).OfType<Season>();
|
||||||
|
}
|
||||||
|
|
||||||
if (!includeMissingSeasons && !includeVirtualUnaired)
|
if (!includeMissingSeasons && !includeVirtualUnaired)
|
||||||
{
|
{
|
||||||
|
@ -204,9 +230,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return LibraryManager
|
return seasons;
|
||||||
.Sort(seasons, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending)
|
|
||||||
.Cast<Season>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Episode> GetEpisodes(User user)
|
public IEnumerable<Episode> GetEpisodes(User user)
|
||||||
|
@ -257,7 +281,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
// Refresh current item
|
// Refresh current item
|
||||||
await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
// Refresh TV
|
// Refresh seasons
|
||||||
foreach (var item in seasons)
|
foreach (var item in seasons)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
@ -270,12 +294,30 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
progress.Report(percent * 100);
|
progress.Report(percent * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh all non-songs
|
// Refresh episodes and other children
|
||||||
foreach (var item in otherItems)
|
foreach (var item in otherItems)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var skipItem = false;
|
||||||
|
|
||||||
|
var episode = item as Episode;
|
||||||
|
|
||||||
|
if (episode != null
|
||||||
|
&& refreshOptions.MetadataRefreshMode != MetadataRefreshMode.FullRefresh
|
||||||
|
&& !refreshOptions.ReplaceAllMetadata
|
||||||
|
&& episode.IsMissingEpisode
|
||||||
|
&& episode.LocationType == Model.Entities.LocationType.Virtual
|
||||||
|
&& episode.PremiereDate.HasValue
|
||||||
|
&& (DateTime.UtcNow - episode.PremiereDate.Value).TotalDays > 30)
|
||||||
|
{
|
||||||
|
skipItem = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skipItem)
|
||||||
|
{
|
||||||
await item.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
await item.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
numComplete++;
|
numComplete++;
|
||||||
double percent = numComplete;
|
double percent = numComplete;
|
||||||
|
@ -297,19 +339,32 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
|
|
||||||
public IEnumerable<Episode> GetEpisodes(User user, int seasonNumber, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes)
|
public IEnumerable<Episode> GetEpisodes(User user, int seasonNumber, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes)
|
||||||
{
|
{
|
||||||
return GetEpisodes(user, seasonNumber, includeMissingEpisodes, includeVirtualUnairedEpisodes,
|
var seriesIds = LibraryManager.GetItemIds(new InternalItemsQuery(user)
|
||||||
new List<Episode>());
|
{
|
||||||
|
PresentationUniqueKey = PresentationUniqueKey,
|
||||||
|
IncludeItemTypes = new[] { typeof(Series).Name }
|
||||||
|
});
|
||||||
|
|
||||||
|
IEnumerable<Episode> episodes;
|
||||||
|
|
||||||
|
if (seriesIds.Count > 1)
|
||||||
|
{
|
||||||
|
episodes = LibraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
|
{
|
||||||
|
AncestorIds = seriesIds.Select(i => i.ToString("N")).ToArray(),
|
||||||
|
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||||
|
SortBy = new[] { ItemSortBy.SortName }
|
||||||
|
|
||||||
|
}).OfType<Episode>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
episodes = GetRecursiveChildren(user, i => i is Episode)
|
||||||
|
.Cast<Episode>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<Episode> GetEpisodes(User user, int seasonNumber, bool includeMissingEpisodes, bool includeVirtualUnairedEpisodes, IEnumerable<Episode> additionalEpisodes)
|
|
||||||
{
|
|
||||||
var episodes = GetRecursiveChildren(user, i => i is Episode)
|
|
||||||
.Cast<Episode>();
|
|
||||||
|
|
||||||
episodes = FilterEpisodesBySeason(episodes, seasonNumber, DisplaySpecialsWithSeasons);
|
episodes = FilterEpisodesBySeason(episodes, seasonNumber, DisplaySpecialsWithSeasons);
|
||||||
|
|
||||||
episodes = episodes.Concat(additionalEpisodes).Distinct();
|
|
||||||
|
|
||||||
if (!includeMissingEpisodes)
|
if (!includeMissingEpisodes)
|
||||||
{
|
{
|
||||||
episodes = episodes.Where(i => !i.IsMissingEpisode);
|
episodes = episodes.Where(i => !i.IsMissingEpisode);
|
||||||
|
@ -336,7 +391,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
{
|
{
|
||||||
if (!includeSpecials || seasonNumber < 1)
|
if (!includeSpecials || seasonNumber < 1)
|
||||||
{
|
{
|
||||||
return episodes.Where(i => (i.PhysicalSeasonNumber ?? -1) == seasonNumber);
|
return episodes.Where(i => (i.ParentIndexNumber ?? -1) == seasonNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
return episodes.Where(i =>
|
return episodes.Where(i =>
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Trailer
|
/// Class Trailer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Trailer : Video, IHasCriticRating, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTaglines, IHasMetascore, IHasLookupInfo<TrailerInfo>
|
public class Trailer : Video, IHasCriticRating, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTaglines, IHasMetascore, IHasOriginalTitle, IHasLookupInfo<TrailerInfo>
|
||||||
{
|
{
|
||||||
public List<string> ProductionLocations { get; set; }
|
public List<string> ProductionLocations { get; set; }
|
||||||
|
|
||||||
|
@ -56,26 +56,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <value>The revenue.</value>
|
/// <value>The revenue.</value>
|
||||||
public double? Revenue { get; set; }
|
public double? Revenue { get; set; }
|
||||||
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
|
||||||
var key = Movie.GetMovieUserDataKey(this);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(key))
|
|
||||||
{
|
|
||||||
key = key + "-trailer";
|
|
||||||
|
|
||||||
// Make sure different trailers have their own data.
|
|
||||||
if (RunTimeTicks.HasValue)
|
|
||||||
{
|
|
||||||
key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture);
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override UnratedItem GetBlockUnratedType()
|
public override UnratedItem GetBlockUnratedType()
|
||||||
{
|
{
|
||||||
return UnratedItem.Trailer;
|
return UnratedItem.Trailer;
|
||||||
|
|
|
@ -348,7 +348,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
.Where(i => !i.IsFolder)
|
.Where(i => !i.IsFolder)
|
||||||
.OfType<IHasAlbumArtist>();
|
.OfType<IHasAlbumArtist>();
|
||||||
|
|
||||||
var artists = _libraryManager.GetAlbumArtists(items).Where(i => _userDataManager.GetUserData(user.Id, i.GetUserDataKey()).IsFavorite);
|
var artists = _libraryManager.GetAlbumArtists(items).Where(i => _userDataManager.GetUserData(user, i).IsFavorite);
|
||||||
|
|
||||||
return GetResult(artists, parent, query);
|
return GetResult(artists, parent, query);
|
||||||
}
|
}
|
||||||
|
@ -1218,7 +1218,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
if (query.IsLiked.HasValue)
|
if (query.IsLiked.HasValue)
|
||||||
{
|
{
|
||||||
userData = userData ?? userDataManager.GetUserData(user.Id, item.GetUserDataKey());
|
userData = userData ?? userDataManager.GetUserData(user, item);
|
||||||
|
|
||||||
if (!userData.Likes.HasValue || userData.Likes != query.IsLiked.Value)
|
if (!userData.Likes.HasValue || userData.Likes != query.IsLiked.Value)
|
||||||
{
|
{
|
||||||
|
@ -1228,7 +1228,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
if (query.IsFavoriteOrLiked.HasValue)
|
if (query.IsFavoriteOrLiked.HasValue)
|
||||||
{
|
{
|
||||||
userData = userData ?? userDataManager.GetUserData(user.Id, item.GetUserDataKey());
|
userData = userData ?? userDataManager.GetUserData(user, item);
|
||||||
var isFavoriteOrLiked = userData.IsFavorite || (userData.Likes ?? false);
|
var isFavoriteOrLiked = userData.IsFavorite || (userData.Likes ?? false);
|
||||||
|
|
||||||
if (isFavoriteOrLiked != query.IsFavoriteOrLiked.Value)
|
if (isFavoriteOrLiked != query.IsFavoriteOrLiked.Value)
|
||||||
|
@ -1239,7 +1239,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
if (query.IsFavorite.HasValue)
|
if (query.IsFavorite.HasValue)
|
||||||
{
|
{
|
||||||
userData = userData ?? userDataManager.GetUserData(user.Id, item.GetUserDataKey());
|
userData = userData ?? userDataManager.GetUserData(user, item);
|
||||||
|
|
||||||
if (userData.IsFavorite != query.IsFavorite.Value)
|
if (userData.IsFavorite != query.IsFavorite.Value)
|
||||||
{
|
{
|
||||||
|
@ -1249,7 +1249,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
if (query.IsResumable.HasValue)
|
if (query.IsResumable.HasValue)
|
||||||
{
|
{
|
||||||
userData = userData ?? userDataManager.GetUserData(user.Id, item.GetUserDataKey());
|
userData = userData ?? userDataManager.GetUserData(user, item);
|
||||||
var isResumable = userData.PlaybackPositionTicks > 0;
|
var isResumable = userData.PlaybackPositionTicks > 0;
|
||||||
|
|
||||||
if (isResumable != query.IsResumable.Value)
|
if (isResumable != query.IsResumable.Value)
|
||||||
|
|
|
@ -44,6 +44,20 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override string PresentationUniqueKey
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (PrimaryVersionId.HasValue)
|
||||||
|
{
|
||||||
|
return PrimaryVersionId.Value.ToString("N");
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.PresentationUniqueKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long? Size { get; set; }
|
public long? Size { get; set; }
|
||||||
public string Container { get; set; }
|
public string Container { get; set; }
|
||||||
public int? TotalBitrate { get; set; }
|
public int? TotalBitrate { get; set; }
|
||||||
|
@ -90,6 +104,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (PrimaryVersionId.HasValue)
|
||||||
|
{
|
||||||
|
var item = LibraryManager.GetItemById(PrimaryVersionId.Value) as Video;
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
return item.MediaSourceCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
return LinkedAlternateVersions.Count + LocalAlternateVersions.Count + 1;
|
return LinkedAlternateVersions.Count + LocalAlternateVersions.Count + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,15 +153,57 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string CreateUserDataKey()
|
[IgnoreDataMember]
|
||||||
|
protected virtual bool EnableDefaultVideoUserDataKeys
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<string> GetUserDataKeys()
|
||||||
|
{
|
||||||
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
if (EnableDefaultVideoUserDataKeys)
|
||||||
{
|
{
|
||||||
if (ExtraType.HasValue)
|
if (ExtraType.HasValue)
|
||||||
{
|
{
|
||||||
var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb);
|
var key = this.GetProviderId(MetadataProviders.Tmdb);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(key))
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
{
|
{
|
||||||
key = key + "-" + ExtraType.ToString().ToLower();
|
list.Insert(0, GetUserDataKey(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
key = this.GetProviderId(MetadataProviders.Imdb);
|
||||||
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, GetUserDataKey(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var key = this.GetProviderId(MetadataProviders.Imdb);
|
||||||
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
key = this.GetProviderId(MetadataProviders.Tmdb);
|
||||||
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetUserDataKey(string providerId)
|
||||||
|
{
|
||||||
|
var key = providerId + "-" + ExtraType.ToString().ToLower();
|
||||||
|
|
||||||
// Make sure different trailers have their own data.
|
// Make sure different trailers have their own data.
|
||||||
if (RunTimeTicks.HasValue)
|
if (RunTimeTicks.HasValue)
|
||||||
|
@ -149,25 +213,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the linked children.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
|
||||||
public IEnumerable<Video> GetAlternateVersions()
|
|
||||||
{
|
|
||||||
var filesWithinSameDirectory = GetLocalAlternateVersionIds()
|
|
||||||
.Select(i => LibraryManager.GetItemById(i))
|
|
||||||
.Where(i => i != null)
|
|
||||||
.OfType<Video>();
|
|
||||||
|
|
||||||
return filesWithinSameDirectory.Concat(GetLinkedAlternateVersions())
|
|
||||||
.OrderBy(i => i.SortName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Video> GetLinkedAlternateVersions()
|
public IEnumerable<Video> GetLinkedAlternateVersions()
|
||||||
{
|
{
|
||||||
|
@ -317,6 +362,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newAsVideo.VideoType != VideoType)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.IsValidFromResolver(newItem);
|
return base.IsValidFromResolver(newItem);
|
||||||
|
@ -463,6 +513,36 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}).FirstOrDefault();
|
}).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Tuple<Video, MediaSourceType>> GetAllVideosForMediaSources()
|
||||||
|
{
|
||||||
|
var list = new List<Tuple<Video, MediaSourceType>>();
|
||||||
|
|
||||||
|
list.Add(new Tuple<Video, MediaSourceType>(this, MediaSourceType.Default));
|
||||||
|
list.AddRange(GetLinkedAlternateVersions().Select(i => new Tuple<Video, MediaSourceType>(i, MediaSourceType.Grouping)));
|
||||||
|
|
||||||
|
if (PrimaryVersionId.HasValue)
|
||||||
|
{
|
||||||
|
var primary = LibraryManager.GetItemById(PrimaryVersionId.Value) as Video;
|
||||||
|
if (primary != null)
|
||||||
|
{
|
||||||
|
var existingIds = list.Select(i => i.Item1.Id).ToList();
|
||||||
|
list.Add(new Tuple<Video, MediaSourceType>(primary, MediaSourceType.Grouping));
|
||||||
|
list.AddRange(primary.GetLinkedAlternateVersions().Where(i => !existingIds.Contains(i.Id)).Select(i => new Tuple<Video, MediaSourceType>(i, MediaSourceType.Grouping)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var localAlternates = list
|
||||||
|
.SelectMany(i => i.Item1.GetLocalAlternateVersionIds())
|
||||||
|
.Select(LibraryManager.GetItemById)
|
||||||
|
.Where(i => i != null)
|
||||||
|
.OfType<Video>()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
list.AddRange(localAlternates.Select(i => new Tuple<Video, MediaSourceType>(i, MediaSourceType.Default)));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
|
public virtual IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
|
||||||
{
|
{
|
||||||
if (SourceType == SourceType.Channel)
|
if (SourceType == SourceType.Channel)
|
||||||
|
@ -481,13 +561,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = this;
|
var list = GetAllVideosForMediaSources();
|
||||||
|
var result = list.Select(i => GetVersionInfo(enablePathSubstitution, i.Item1, i.Item2)).ToList();
|
||||||
var result = item.GetAlternateVersions()
|
|
||||||
.Select(i => GetVersionInfo(enablePathSubstitution, i, MediaSourceType.Grouping))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
result.Add(GetVersionInfo(enablePathSubstitution, item, MediaSourceType.Default));
|
|
||||||
|
|
||||||
return result.OrderBy(i =>
|
return result.OrderBy(i =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,13 +11,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Year : BaseItem, IItemByName
|
public class Year : BaseItem, IItemByName
|
||||||
{
|
{
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return "Year-" + Name;
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.Insert(0, "Year-" + Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
BaseItem FindByPath(string path);
|
BaseItem FindByPath(string path, bool? isFolder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the artist.
|
/// Gets the artist.
|
||||||
|
@ -243,6 +243,8 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <returns>BaseItem.</returns>
|
/// <returns>BaseItem.</returns>
|
||||||
BaseItem RetrieveItem(Guid id);
|
BaseItem RetrieveItem(Guid id);
|
||||||
|
|
||||||
|
bool IsScanRunning { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when [item added].
|
/// Occurs when [item added].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -45,6 +45,11 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <returns>Task{UserItemData}.</returns>
|
/// <returns>Task{UserItemData}.</returns>
|
||||||
UserItemData GetUserData(Guid userId, string key);
|
UserItemData GetUserData(Guid userId, string key);
|
||||||
|
|
||||||
|
UserItemData GetUserData(IHasUserData user, IHasUserData item);
|
||||||
|
|
||||||
|
UserItemData GetUserData(string userId, IHasUserData item);
|
||||||
|
UserItemData GetUserData(Guid userId, IHasUserData item);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user data dto.
|
/// Gets the user data dto.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The banner URL
|
/// The banner URL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string BannerUrl = "http://www.thetvdb.com/banners/";
|
public static readonly string BannerUrl = "https://www.thetvdb.com/banners/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the air days.
|
/// Gets the air days.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Library
|
namespace MediaBrowser.Controller.Library
|
||||||
{
|
{
|
||||||
|
@ -15,11 +16,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <value>The user id.</value>
|
/// <value>The user id.</value>
|
||||||
public Guid UserId { get; set; }
|
public Guid UserId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
public List<string> Keys { get; set; }
|
||||||
/// Gets or sets the key.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The key.</value>
|
|
||||||
public string Key { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the save reason.
|
/// Gets or sets the save reason.
|
||||||
|
|
|
@ -46,6 +46,8 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task<List<MediaSourceInfo>>.</returns>
|
/// <returns>Task<List<MediaSourceInfo>>.</returns>
|
||||||
Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
|
Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(string channelId, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
string ApplyDuration(string streamPath, TimeSpan duration);
|
||||||
}
|
}
|
||||||
public interface IConfigurableTunerHost
|
public interface IConfigurableTunerHost
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,17 +45,6 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
|
||||||
var name = GetClientTypeName();
|
|
||||||
|
|
||||||
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is owned item.
|
/// Gets a value indicating whether this instance is owned item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -11,13 +11,12 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
{
|
{
|
||||||
public class LiveTvChannel : BaseItem, IHasMediaSources
|
public class LiveTvChannel : BaseItem, IHasMediaSources
|
||||||
{
|
{
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
return GetClientTypeName() + "-" + Name;
|
var list = base.GetUserDataKeys();
|
||||||
|
|
||||||
|
list.Insert(0, GetClientTypeName() + "-" + Name);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UnratedItem GetBlockUnratedType()
|
public override UnratedItem GetBlockUnratedType()
|
||||||
|
@ -45,6 +44,15 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool EnableRememberingTrackSelections
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the number.
|
/// Gets or sets the number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -4,36 +4,40 @@ using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.LiveTv;
|
using MediaBrowser.Model.LiveTv;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.LiveTv
|
namespace MediaBrowser.Controller.LiveTv
|
||||||
{
|
{
|
||||||
public class LiveTvProgram : BaseItem, IHasLookupInfo<LiveTvProgramLookupInfo>, IHasStartDate, IHasProgramAttributes
|
public class LiveTvProgram : BaseItem, IHasLookupInfo<LiveTvProgramLookupInfo>, IHasStartDate, IHasProgramAttributes
|
||||||
{
|
{
|
||||||
/// <summary>
|
public override List<string> GetUserDataKeys()
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
{
|
||||||
if (IsMovie)
|
var list = base.GetUserDataKeys();
|
||||||
{
|
|
||||||
var key = Movie.GetMovieUserDataKey(this);
|
|
||||||
|
|
||||||
|
if (!IsSeries)
|
||||||
|
{
|
||||||
|
var key = this.GetProviderId(MetadataProviders.Imdb);
|
||||||
if (!string.IsNullOrWhiteSpace(key))
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
{
|
{
|
||||||
return key;
|
list.Insert(0, key);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSeries && !string.IsNullOrWhiteSpace(EpisodeTitle))
|
key = this.GetProviderId(MetadataProviders.Tmdb);
|
||||||
|
if (!string.IsNullOrWhiteSpace(key))
|
||||||
|
{
|
||||||
|
list.Insert(0, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrWhiteSpace(EpisodeTitle))
|
||||||
{
|
{
|
||||||
var name = GetClientTypeName();
|
var name = GetClientTypeName();
|
||||||
|
|
||||||
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
|
list.Insert(0, name + "-" + Name + (EpisodeTitle ?? string.Empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
|
|
@ -45,32 +45,6 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user data key.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
protected override string CreateUserDataKey()
|
|
||||||
{
|
|
||||||
if (IsMovie)
|
|
||||||
{
|
|
||||||
var key = Movie.GetMovieUserDataKey(this);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(key))
|
|
||||||
{
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsSeries && !string.IsNullOrWhiteSpace(EpisodeTitle))
|
|
||||||
{
|
|
||||||
var name = GetClientTypeName();
|
|
||||||
|
|
||||||
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.CreateUserDataKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public override string MediaType
|
public override string MediaType
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,13 +4,14 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Model.Dlna;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.MediaEncoding
|
namespace MediaBrowser.Controller.MediaEncoding
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface IMediaEncoder
|
/// Interface IMediaEncoder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IMediaEncoder
|
public interface IMediaEncoder : ITranscoderSupport
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the encoder path.
|
/// Gets the encoder path.
|
||||||
|
|
|
@ -20,12 +20,6 @@ namespace MediaBrowser.Controller.Notifications
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
|
event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens the connection to the repository
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task Initialize();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the notifications.
|
/// Gets the notifications.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -11,12 +11,6 @@ namespace MediaBrowser.Controller.Persistence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IDisplayPreferencesRepository : IRepository
|
public interface IDisplayPreferencesRepository : IRepository
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Opens the connection to the repository
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task Initialize();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves display preferences for an item
|
/// Saves display preferences for an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -13,12 +13,6 @@ namespace MediaBrowser.Controller.Persistence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IItemRepository : IRepository
|
public interface IItemRepository : IRepository
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Opens the connection to the repository
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task Initialize();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves an item
|
/// Saves an item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -11,12 +11,6 @@ namespace MediaBrowser.Controller.Persistence
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IUserDataRepository : IRepository
|
public interface IUserDataRepository : IRepository
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Opens the connection to the repository
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task Initialize();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the user data.
|
/// Saves the user data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -21,11 +21,5 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task SaveMetadataStatus(MetadataStatus status, CancellationToken cancellationToken);
|
Task SaveMetadataStatus(MetadataStatus status, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes this instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
Task Initialize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.ContentDirectory
|
namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
{
|
{
|
||||||
|
@ -27,6 +28,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
private readonly IChannelManager _channelManager;
|
private readonly IChannelManager _channelManager;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private readonly IUserViewManager _userViewManager;
|
private readonly IUserViewManager _userViewManager;
|
||||||
|
private readonly Func<IMediaEncoder> _mediaEncoder;
|
||||||
|
|
||||||
public ContentDirectory(IDlnaManager dlna,
|
public ContentDirectory(IDlnaManager dlna,
|
||||||
IUserDataManager userDataManager,
|
IUserDataManager userDataManager,
|
||||||
|
@ -35,7 +37,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
IServerConfigurationManager config,
|
IServerConfigurationManager config,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
IHttpClient httpClient, ILocalizationManager localization, IChannelManager channelManager, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager)
|
IHttpClient httpClient, ILocalizationManager localization, IChannelManager channelManager, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager, Func<IMediaEncoder> mediaEncoder)
|
||||||
: base(logger, httpClient)
|
: base(logger, httpClient)
|
||||||
{
|
{
|
||||||
_dlna = dlna;
|
_dlna = dlna;
|
||||||
|
@ -48,6 +50,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
_channelManager = channelManager;
|
_channelManager = channelManager;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_userViewManager = userViewManager;
|
_userViewManager = userViewManager;
|
||||||
|
_mediaEncoder = mediaEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int SystemUpdateId
|
private int SystemUpdateId
|
||||||
|
@ -89,7 +92,8 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
_localization,
|
_localization,
|
||||||
_channelManager,
|
_channelManager,
|
||||||
_mediaSourceManager,
|
_mediaSourceManager,
|
||||||
_userViewManager)
|
_userViewManager,
|
||||||
|
_mediaEncoder())
|
||||||
.ProcessControlRequest(request);
|
.ProcessControlRequest(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.ContentDirectory
|
namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
{
|
{
|
||||||
|
@ -34,6 +35,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
private readonly User _user;
|
private readonly User _user;
|
||||||
private readonly IUserViewManager _userViewManager;
|
private readonly IUserViewManager _userViewManager;
|
||||||
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
|
|
||||||
private const string NS_DC = "http://purl.org/dc/elements/1.1/";
|
private const string NS_DC = "http://purl.org/dc/elements/1.1/";
|
||||||
private const string NS_DIDL = "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/";
|
private const string NS_DIDL = "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/";
|
||||||
|
@ -47,7 +49,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
|
|
||||||
private readonly DeviceProfile _profile;
|
private readonly DeviceProfile _profile;
|
||||||
|
|
||||||
public ControlHandler(ILogger logger, ILibraryManager libraryManager, DeviceProfile profile, string serverAddress, string accessToken, IImageProcessor imageProcessor, IUserDataManager userDataManager, User user, int systemUpdateId, IServerConfigurationManager config, ILocalizationManager localization, IChannelManager channelManager, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager)
|
public ControlHandler(ILogger logger, ILibraryManager libraryManager, DeviceProfile profile, string serverAddress, string accessToken, IImageProcessor imageProcessor, IUserDataManager userDataManager, User user, int systemUpdateId, IServerConfigurationManager config, ILocalizationManager localization, IChannelManager channelManager, IMediaSourceManager mediaSourceManager, IUserViewManager userViewManager, IMediaEncoder mediaEncoder)
|
||||||
: base(config, logger)
|
: base(config, logger)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
|
@ -56,10 +58,11 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
_systemUpdateId = systemUpdateId;
|
_systemUpdateId = systemUpdateId;
|
||||||
_channelManager = channelManager;
|
_channelManager = channelManager;
|
||||||
_userViewManager = userViewManager;
|
_userViewManager = userViewManager;
|
||||||
|
_mediaEncoder = mediaEncoder;
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
||||||
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, Logger, libraryManager);
|
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, Logger, libraryManager, _mediaEncoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
||||||
|
@ -108,7 +111,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
|
|
||||||
var newbookmark = int.Parse(sparams["PosSecond"], _usCulture);
|
var newbookmark = int.Parse(sparams["PosSecond"], _usCulture);
|
||||||
|
|
||||||
var userdata = _userDataManager.GetUserData(user.Id, item.GetUserDataKey());
|
var userdata = _userDataManager.GetUserData(user, item);
|
||||||
|
|
||||||
userdata.PlaybackPositionTicks = TimeSpan.FromSeconds(newbookmark).Ticks;
|
userdata.PlaybackPositionTicks = TimeSpan.FromSeconds(newbookmark).Ticks;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.Didl
|
namespace MediaBrowser.Dlna.Didl
|
||||||
|
@ -42,8 +43,9 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
|
|
||||||
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ILogger logger, ILibraryManager libraryManager)
|
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ILogger logger, ILibraryManager libraryManager, IMediaEncoder mediaEncoder)
|
||||||
{
|
{
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
|
@ -53,6 +55,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
|
_mediaEncoder = mediaEncoder;
|
||||||
_accessToken = accessToken;
|
_accessToken = accessToken;
|
||||||
_user = user;
|
_user = user;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +145,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
{
|
{
|
||||||
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user).ToList();
|
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user).ToList();
|
||||||
|
|
||||||
streamInfo = new StreamBuilder(GetStreamBuilderLogger(options)).BuildVideoItem(new VideoOptions
|
streamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildVideoItem(new VideoOptions
|
||||||
{
|
{
|
||||||
ItemId = GetClientId(video),
|
ItemId = GetClientId(video),
|
||||||
MediaSources = sources,
|
MediaSources = sources,
|
||||||
|
@ -385,7 +388,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
{
|
{
|
||||||
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user).ToList();
|
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user).ToList();
|
||||||
|
|
||||||
streamInfo = new StreamBuilder(GetStreamBuilderLogger(options)).BuildAudioItem(new AudioOptions
|
streamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildAudioItem(new AudioOptions
|
||||||
{
|
{
|
||||||
ItemId = GetClientId(audio),
|
ItemId = GetClientId(audio),
|
||||||
MediaSources = sources,
|
MediaSources = sources,
|
||||||
|
|
|
@ -14,6 +14,7 @@ using MediaBrowser.Dlna.Ssdp;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.Main
|
namespace MediaBrowser.Dlna.Main
|
||||||
{
|
{
|
||||||
|
@ -34,6 +35,7 @@ namespace MediaBrowser.Dlna.Main
|
||||||
private readonly IUserDataManager _userDataManager;
|
private readonly IUserDataManager _userDataManager;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
|
|
||||||
private readonly SsdpHandler _ssdpHandler;
|
private readonly SsdpHandler _ssdpHandler;
|
||||||
private readonly IDeviceDiscovery _deviceDiscovery;
|
private readonly IDeviceDiscovery _deviceDiscovery;
|
||||||
|
@ -54,7 +56,7 @@ namespace MediaBrowser.Dlna.Main
|
||||||
IUserDataManager userDataManager,
|
IUserDataManager userDataManager,
|
||||||
ILocalizationManager localization,
|
ILocalizationManager localization,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
ISsdpHandler ssdpHandler, IDeviceDiscovery deviceDiscovery)
|
ISsdpHandler ssdpHandler, IDeviceDiscovery deviceDiscovery, IMediaEncoder mediaEncoder)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
|
@ -69,6 +71,7 @@ namespace MediaBrowser.Dlna.Main
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_deviceDiscovery = deviceDiscovery;
|
_deviceDiscovery = deviceDiscovery;
|
||||||
|
_mediaEncoder = mediaEncoder;
|
||||||
_ssdpHandler = (SsdpHandler)ssdpHandler;
|
_ssdpHandler = (SsdpHandler)ssdpHandler;
|
||||||
_logger = logManager.GetLogger("Dlna");
|
_logger = logManager.GetLogger("Dlna");
|
||||||
}
|
}
|
||||||
|
@ -196,7 +199,8 @@ namespace MediaBrowser.Dlna.Main
|
||||||
_config,
|
_config,
|
||||||
_userDataManager,
|
_userDataManager,
|
||||||
_localization,
|
_localization,
|
||||||
_mediaSourceManager);
|
_mediaSourceManager,
|
||||||
|
_mediaEncoder);
|
||||||
|
|
||||||
_manager.Start();
|
_manager.Start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.PlayTo
|
namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
|
@ -35,6 +36,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
|
|
||||||
private readonly IDeviceDiscovery _deviceDiscovery;
|
private readonly IDeviceDiscovery _deviceDiscovery;
|
||||||
private readonly string _serverAddress;
|
private readonly string _serverAddress;
|
||||||
|
@ -74,7 +76,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
get { return IsSessionActive; }
|
get { return IsSessionActive; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IConfigurationManager config)
|
public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder)
|
||||||
{
|
{
|
||||||
_session = session;
|
_session = session;
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
|
@ -88,6 +90,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_mediaEncoder = mediaEncoder;
|
||||||
_accessToken = accessToken;
|
_accessToken = accessToken;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_creationTime = DateTime.UtcNow;
|
_creationTime = DateTime.UtcNow;
|
||||||
|
@ -478,7 +481,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
||||||
|
|
||||||
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager)
|
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager, _mediaEncoder)
|
||||||
.GetItemDidl(_config.GetDlnaConfiguration(), item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
.GetItemDidl(_config.GetDlnaConfiguration(), item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
||||||
|
|
||||||
playlistItem.Didl = itemXml;
|
playlistItem.Didl = itemXml;
|
||||||
|
@ -550,7 +553,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
return new PlaylistItem
|
return new PlaylistItem
|
||||||
{
|
{
|
||||||
StreamInfo = new StreamBuilder(GetStreamBuilderLogger()).BuildVideoItem(new VideoOptions
|
StreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildVideoItem(new VideoOptions
|
||||||
{
|
{
|
||||||
ItemId = item.Id.ToString("N"),
|
ItemId = item.Id.ToString("N"),
|
||||||
MediaSources = mediaSources,
|
MediaSources = mediaSources,
|
||||||
|
@ -570,7 +573,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
return new PlaylistItem
|
return new PlaylistItem
|
||||||
{
|
{
|
||||||
StreamInfo = new StreamBuilder(GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions
|
StreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions
|
||||||
{
|
{
|
||||||
ItemId = item.Id.ToString("N"),
|
ItemId = item.Id.ToString("N"),
|
||||||
MediaSources = mediaSources,
|
MediaSources = mediaSources,
|
||||||
|
|
|
@ -12,6 +12,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
|
|
||||||
namespace MediaBrowser.Dlna.PlayTo
|
namespace MediaBrowser.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
|
@ -32,11 +33,12 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
private readonly IDeviceDiscovery _deviceDiscovery;
|
private readonly IDeviceDiscovery _deviceDiscovery;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
|
|
||||||
private readonly List<string> _nonRendererUrls = new List<string>();
|
private readonly List<string> _nonRendererUrls = new List<string>();
|
||||||
private DateTime _lastRendererClear;
|
private DateTime _lastRendererClear;
|
||||||
|
|
||||||
public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager)
|
public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, IServerConfigurationManager config, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
|
@ -51,6 +53,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_userDataManager = userDataManager;
|
_userDataManager = userDataManager;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
|
_mediaEncoder = mediaEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
|
@ -132,7 +135,8 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
_userDataManager,
|
_userDataManager,
|
||||||
_localization,
|
_localization,
|
||||||
_mediaSourceManager,
|
_mediaSourceManager,
|
||||||
_config);
|
_config,
|
||||||
|
_mediaEncoder);
|
||||||
|
|
||||||
controller.Init(device);
|
controller.Init(device);
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,8 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||||
|
|
||||||
var endPoint = new IPEndPoint(localIp, 1900);
|
var endPoint = new IPEndPoint(localIp, 1900);
|
||||||
|
|
||||||
var socket = GetMulticastSocket(localIp, endPoint);
|
using (var socket = GetMulticastSocket(localIp, endPoint))
|
||||||
|
{
|
||||||
var receiveBuffer = new byte[64000];
|
var receiveBuffer = new byte[64000];
|
||||||
|
|
||||||
CreateNotifier(localIp);
|
CreateNotifier(localIp);
|
||||||
|
@ -135,6 +135,7 @@ namespace MediaBrowser.Dlna.Ssdp
|
||||||
TryCreateDevice(args);
|
TryCreateDevice(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_logger.Info("SSDP listener - Task completed");
|
_logger.Info("SSDP listener - Task completed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ using CommonIO;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata
|
namespace MediaBrowser.LocalMetadata
|
||||||
{
|
{
|
||||||
public abstract class BaseXmlProvider<T> : ILocalMetadataProvider<T>, IHasChangeMonitor, IHasOrder
|
public abstract class BaseXmlProvider<T> : ILocalMetadataProvider<T>, IHasItemChangeMonitor, IHasOrder
|
||||||
where T : IHasMetadata, new()
|
where T : IHasMetadata, new()
|
||||||
{
|
{
|
||||||
protected IFileSystem FileSystem;
|
protected IFileSystem FileSystem;
|
||||||
|
@ -56,7 +56,7 @@ namespace MediaBrowser.LocalMetadata
|
||||||
|
|
||||||
protected abstract FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService);
|
protected abstract FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService);
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var file = GetXmlFile(new ItemInfo(item), directoryService);
|
var file = GetXmlFile(new ItemInfo(item), directoryService);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace MediaBrowser.LocalMetadata
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > date;
|
return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > item.DateLastSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
|
|
@ -41,19 +41,36 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const string vn = " -vn";
|
|
||||||
|
|
||||||
var threads = GetNumberOfThreads(state, false);
|
var threads = GetNumberOfThreads(state, false);
|
||||||
|
|
||||||
var inputModifier = GetInputModifier(state);
|
var inputModifier = GetInputModifier(state);
|
||||||
|
|
||||||
return string.Format("{0} {1} -threads {2}{3} {4} -id3v2_version 3 -write_id3v1 1 -y \"{5}\"",
|
var albumCoverInput = string.Empty;
|
||||||
|
var mapArgs = string.Empty;
|
||||||
|
var metadata = string.Empty;
|
||||||
|
var vn = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(state.AlbumCoverPath))
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Format("{0} {1}{6}{7} -threads {2}{3} {4} -id3v2_version 3 -write_id3v1 1{8} -y \"{5}\"",
|
||||||
inputModifier,
|
inputModifier,
|
||||||
GetInputArgument(state),
|
GetInputArgument(state),
|
||||||
threads,
|
threads,
|
||||||
vn,
|
vn,
|
||||||
string.Join(" ", audioTranscodeParams.ToArray()),
|
string.Join(" ", audioTranscodeParams.ToArray()),
|
||||||
state.OutputFilePath).Trim();
|
state.OutputFilePath,
|
||||||
|
albumCoverInput,
|
||||||
|
mapArgs,
|
||||||
|
metadata).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetOutputFileExtension(EncodingJob state)
|
protected override string GetOutputFileExtension(EncodingJob state)
|
||||||
|
|
|
@ -366,9 +366,14 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
protected string GetVideoDecoder(EncodingJob state)
|
protected string GetVideoDecoder(EncodingJob state)
|
||||||
{
|
{
|
||||||
if (string.Equals(GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
|
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
|
||||||
|
{
|
||||||
|
if (string.Equals(GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
switch (state.MediaSource.VideoStream.Codec.ToLower())
|
switch (state.MediaSource.VideoStream.Codec.ToLower())
|
||||||
{
|
{
|
||||||
|
@ -376,7 +381,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
case "h264":
|
case "h264":
|
||||||
if (MediaEncoder.SupportsDecoder("h264_qsv"))
|
if (MediaEncoder.SupportsDecoder("h264_qsv"))
|
||||||
{
|
{
|
||||||
return "-c:v h264_qsv ";
|
// Seeing stalls and failures with decoding. Not worth it compared to encoding.
|
||||||
|
//return "-c:v h264_qsv ";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "mpeg2video":
|
case "mpeg2video":
|
||||||
|
|
|
@ -64,6 +64,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
public long? InputFileSize { get; set; }
|
public long? InputFileSize { get; set; }
|
||||||
public string OutputAudioSync = "1";
|
public string OutputAudioSync = "1";
|
||||||
public string OutputVideoSync = "vfr";
|
public string OutputVideoSync = "vfr";
|
||||||
|
public string AlbumCoverPath { get; set; }
|
||||||
|
|
||||||
public string GetMimeType(string outputPath)
|
public string GetMimeType(string outputPath)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,14 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(request.ItemId, null, false, new[] { MediaType.Audio, MediaType.Video }, cancellationToken).ConfigureAwait(false);
|
var mediaSources = await _mediaSourceManager.GetPlayackMediaSources(request.ItemId, null, false, new[] { MediaType.Audio, MediaType.Video }, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var mediaSource = string.IsNullOrEmpty(request.MediaSourceId)
|
var mediaSource = string.IsNullOrEmpty(request.MediaSourceId)
|
||||||
|
@ -575,6 +583,14 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.Equals("h264", videoStream.Codec, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (videoStream.IsAVC.HasValue && !videoStream.IsAVC.Value)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If client is requesting a specific video profile, it must match the source
|
// If client is requesting a specific video profile, it must match the source
|
||||||
if (!string.IsNullOrEmpty(request.Profile))
|
if (!string.IsNullOrEmpty(request.Profile))
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,15 +96,23 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
FFMpegPath = ffMpegPath;
|
FFMpegPath = ffMpegPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<string> _encoders = new List<string>();
|
||||||
public void SetAvailableEncoders(List<string> list)
|
public void SetAvailableEncoders(List<string> list)
|
||||||
{
|
{
|
||||||
|
_encoders = list.ToList();
|
||||||
|
//_logger.Info("Supported encoders: {0}", string.Join(",", list.ToArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> _decoders = new List<string>();
|
private List<string> _decoders = new List<string>();
|
||||||
public void SetAvailableDecoders(List<string> list)
|
public void SetAvailableDecoders(List<string> list)
|
||||||
{
|
{
|
||||||
_decoders = list.ToList();
|
_decoders = list.ToList();
|
||||||
|
//_logger.Info("Supported decoders: {0}", string.Join(",", list.ToArray()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SupportsEncoder(string decoder)
|
||||||
|
{
|
||||||
|
return _encoders.Contains(decoder, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsDecoder(string decoder)
|
public bool SupportsDecoder(string decoder)
|
||||||
|
@ -112,6 +120,20 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
return _decoders.Contains(decoder, StringComparer.OrdinalIgnoreCase);
|
return _decoders.Contains(decoder, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanEncodeToAudioCodec(string codec)
|
||||||
|
{
|
||||||
|
if (string.Equals(codec, "opus", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
codec = "libopus";
|
||||||
|
}
|
||||||
|
else if (string.Equals(codec, "mp3", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
codec = "libmp3lame";
|
||||||
|
}
|
||||||
|
|
||||||
|
return SupportsEncoder(codec);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the encoder path.
|
/// Gets the encoder path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -75,7 +75,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
{
|
{
|
||||||
if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.Options.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
if (state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.Options.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) && !string.Equals(state.VideoStream.NalLengthSize, "0", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Logger.Debug("Enabling h264_mp4toannexb due to nal_length_size of {0}", state.VideoStream.NalLengthSize);
|
|
||||||
args += " -bsf:v h264_mp4toannexb";
|
args += " -bsf:v h264_mp4toannexb";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,6 +411,17 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||||
NalLengthSize = streamInfo.nal_length_size
|
NalLengthSize = streamInfo.nal_length_size
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (string.Equals(streamInfo.is_avc, "true", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(streamInfo.is_avc, "1", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
stream.IsAVC = true;
|
||||||
|
}
|
||||||
|
else if (string.Equals(streamInfo.is_avc, "false", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(streamInfo.is_avc, "0", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
stream.IsAVC = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out junk
|
// Filter out junk
|
||||||
if (!string.IsNullOrWhiteSpace(streamInfo.codec_tag_string) && streamInfo.codec_tag_string.IndexOf("[0]", StringComparison.OrdinalIgnoreCase) == -1)
|
if (!string.IsNullOrWhiteSpace(streamInfo.codec_tag_string) && streamInfo.codec_tag_string.IndexOf("[0]", StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -201,6 +201,7 @@ namespace MediaBrowser.Model.Configuration
|
||||||
public string[] Migrations { get; set; }
|
public string[] Migrations { get; set; }
|
||||||
|
|
||||||
public int MigrationVersion { get; set; }
|
public int MigrationVersion { get; set; }
|
||||||
|
public int SchemaVersion { get; set; }
|
||||||
|
|
||||||
public bool DownloadImagesInAdvance { get; set; }
|
public bool DownloadImagesInAdvance { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -23,4 +23,17 @@ namespace MediaBrowser.Model.Dlna
|
||||||
/// <returns><c>true</c> if this instance [can access URL] the specified URL; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if this instance [can access URL] the specified URL; otherwise, <c>false</c>.</returns>
|
||||||
bool CanAccessUrl(string url, bool requiresCustomRequestHeaders);
|
bool CanAccessUrl(string url, bool requiresCustomRequestHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface ITranscoderSupport
|
||||||
|
{
|
||||||
|
bool CanEncodeToAudioCodec(string codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FullTranscoderSupport : ITranscoderSupport
|
||||||
|
{
|
||||||
|
public bool CanEncodeToAudioCodec(string codec)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,27 @@ namespace MediaBrowser.Model.Dlna
|
||||||
{
|
{
|
||||||
private readonly ILocalPlayer _localPlayer;
|
private readonly ILocalPlayer _localPlayer;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
private readonly ITranscoderSupport _transcoderSupport;
|
||||||
|
|
||||||
public StreamBuilder(ILocalPlayer localPlayer, ILogger logger)
|
public StreamBuilder(ILocalPlayer localPlayer, ITranscoderSupport transcoderSupport, ILogger logger)
|
||||||
{
|
{
|
||||||
|
_transcoderSupport = transcoderSupport;
|
||||||
_localPlayer = localPlayer;
|
_localPlayer = localPlayer;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StreamBuilder(ITranscoderSupport transcoderSupport, ILogger logger)
|
||||||
|
: this(new NullLocalPlayer(), transcoderSupport, logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamBuilder(ILocalPlayer localPlayer, ILogger logger)
|
||||||
|
: this(localPlayer, new FullTranscoderSupport(), logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public StreamBuilder(ILogger logger)
|
public StreamBuilder(ILogger logger)
|
||||||
: this(new NullLocalPlayer(), logger)
|
: this(new NullLocalPlayer(), new FullTranscoderSupport(), logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +196,14 @@ namespace MediaBrowser.Model.Dlna
|
||||||
foreach (TranscodingProfile i in options.Profile.TranscodingProfiles)
|
foreach (TranscodingProfile i in options.Profile.TranscodingProfiles)
|
||||||
{
|
{
|
||||||
if (i.Type == playlistItem.MediaType && i.Context == options.Context)
|
if (i.Type == playlistItem.MediaType && i.Context == options.Context)
|
||||||
|
{
|
||||||
|
if (_transcoderSupport.CanEncodeToAudioCodec(i.AudioCodec ?? i.Container))
|
||||||
{
|
{
|
||||||
transcodingProfile = i;
|
transcodingProfile = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (transcodingProfile != null)
|
if (transcodingProfile != null)
|
||||||
{
|
{
|
||||||
|
@ -1038,6 +1053,18 @@ namespace MediaBrowser.Model.Dlna
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check audio codec
|
||||||
|
List<string> audioCodecs = profile.GetAudioCodecs();
|
||||||
|
if (audioCodecs.Count > 0)
|
||||||
|
{
|
||||||
|
// Check audio codecs
|
||||||
|
string audioCodec = audioStream == null ? null : audioStream.Codec;
|
||||||
|
if (string.IsNullOrEmpty(audioCodec) || !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,6 +1100,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check audio codec
|
||||||
List<string> audioCodecs = profile.GetAudioCodecs();
|
List<string> audioCodecs = profile.GetAudioCodecs();
|
||||||
if (audioCodecs.Count > 0)
|
if (audioCodecs.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace MediaBrowser.Model.Dto
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string OriginalTitle { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the server identifier.
|
/// Gets or sets the server identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -42,6 +42,8 @@ namespace MediaBrowser.Model.Entities
|
||||||
/// <value><c>true</c> if this instance is interlaced; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance is interlaced; otherwise, <c>false</c>.</value>
|
||||||
public bool IsInterlaced { get; set; }
|
public bool IsInterlaced { get; set; }
|
||||||
|
|
||||||
|
public bool? IsAVC { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the channel layout.
|
/// Gets or sets the channel layout.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace MediaBrowser.Model.LiveTv
|
||||||
public string RecordingPath { get; set; }
|
public string RecordingPath { get; set; }
|
||||||
public bool EnableAutoOrganize { get; set; }
|
public bool EnableAutoOrganize { get; set; }
|
||||||
public bool EnableRecordingEncoding { get; set; }
|
public bool EnableRecordingEncoding { get; set; }
|
||||||
|
public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
|
||||||
|
|
||||||
public List<TunerHostInfo> TunerHosts { get; set; }
|
public List<TunerHostInfo> TunerHosts { get; set; }
|
||||||
public List<ListingsProviderInfo> ListingProviders { get; set; }
|
public List<ListingsProviderInfo> ListingProviders { get; set; }
|
||||||
|
|
|
@ -130,6 +130,8 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Metascore,
|
Metascore,
|
||||||
|
|
||||||
|
OriginalTitle,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The item overview
|
/// The item overview
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -102,6 +102,8 @@ namespace MediaBrowser.Model.Sync
|
||||||
/// <value>The index of the job item.</value>
|
/// <value>The index of the job item.</value>
|
||||||
public int JobItemIndex { get; set; }
|
public int JobItemIndex { get; set; }
|
||||||
|
|
||||||
|
public long ItemDateModifiedTicks { get; set; }
|
||||||
|
|
||||||
public SyncJobItem()
|
public SyncJobItem()
|
||||||
{
|
{
|
||||||
AdditionalFiles = new List<ItemFileInfo>();
|
AdditionalFiles = new List<ItemFileInfo>();
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace MediaBrowser.Providers.BoxSets
|
||||||
{
|
{
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
|
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
||||||
|
|
||||||
return GetImages(mainResult, language, tmdbImageUrl);
|
return GetImages(mainResult, language, tmdbImageUrl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.Providers.BoxSets
|
||||||
{
|
{
|
||||||
public class MovieDbBoxSetProvider : IRemoteMetadataProvider<BoxSet, BoxSetInfo>
|
public class MovieDbBoxSetProvider : IRemoteMetadataProvider<BoxSet, BoxSetInfo>
|
||||||
{
|
{
|
||||||
private const string GetCollectionInfo3 = @"http://api.themoviedb.org/3/collection/{0}?api_key={1}&append_to_response=images";
|
private const string GetCollectionInfo3 = @"https://api.themoviedb.org/3/collection/{0}?api_key={1}&append_to_response=images";
|
||||||
|
|
||||||
internal static MovieDbBoxSetProvider Current;
|
internal static MovieDbBoxSetProvider Current;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ namespace MediaBrowser.Providers.BoxSets
|
||||||
|
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
|
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
||||||
|
|
||||||
var result = new RemoteSearchResult
|
var result = new RemoteSearchResult
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,7 +295,12 @@ namespace MediaBrowser.Providers.Manager
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item is BoxSet || item is IItemByName || item is Playlist)
|
if (!(item is Audio) && !(item is Video))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item is IItemByName)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -305,16 +310,6 @@ namespace MediaBrowser.Providers.Manager
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item is ICollectionFolder)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(item is Audio) && !(item is Video))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,18 +430,18 @@ namespace MediaBrowser.Providers.Manager
|
||||||
var providersWithChanges = providers
|
var providersWithChanges = providers
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
{
|
{
|
||||||
var hasChangeMonitor = i as IHasChangeMonitor;
|
|
||||||
if (hasChangeMonitor != null)
|
|
||||||
{
|
|
||||||
return HasChanged(item, hasChangeMonitor, currentItem.DateLastSaved, options.DirectoryService);
|
|
||||||
}
|
|
||||||
|
|
||||||
var hasFileChangeMonitor = i as IHasItemChangeMonitor;
|
var hasFileChangeMonitor = i as IHasItemChangeMonitor;
|
||||||
if (hasFileChangeMonitor != null)
|
if (hasFileChangeMonitor != null)
|
||||||
{
|
{
|
||||||
return HasChanged(item, hasFileChangeMonitor, options.DirectoryService);
|
return HasChanged(item, hasFileChangeMonitor, options.DirectoryService);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasChangeMonitor = i as IHasChangeMonitor;
|
||||||
|
if (hasChangeMonitor != null)
|
||||||
|
{
|
||||||
|
return HasChanged(item, hasChangeMonitor, currentItem.DateLastSaved, options.DirectoryService);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
|
@ -40,6 +40,15 @@ namespace MediaBrowser.Providers.Manager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (replaceData || string.IsNullOrEmpty(target.OriginalTitle))
|
||||||
|
{
|
||||||
|
// Safeguard against incoming data having an emtpy name
|
||||||
|
if (!string.IsNullOrWhiteSpace(source.OriginalTitle))
|
||||||
|
{
|
||||||
|
target.OriginalTitle = source.OriginalTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (replaceData || !target.CommunityRating.HasValue)
|
if (replaceData || !target.CommunityRating.HasValue)
|
||||||
{
|
{
|
||||||
target.CommunityRating = source.CommunityRating;
|
target.CommunityRating = source.CommunityRating;
|
||||||
|
|
|
@ -443,10 +443,14 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
if (!string.IsNullOrWhiteSpace(data.Name))
|
if (!string.IsNullOrWhiteSpace(data.Name))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(video.Name) || string.Equals(video.Name, Path.GetFileNameWithoutExtension(video.Path), StringComparison.OrdinalIgnoreCase))
|
if (string.IsNullOrWhiteSpace(video.Name) || string.Equals(video.Name, Path.GetFileNameWithoutExtension(video.Path), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// Don't use the embedded name for extras because it will often be the same name as the movie
|
||||||
|
if (!video.ExtraType.HasValue && !video.IsOwnedItem)
|
||||||
{
|
{
|
||||||
video.Name = data.Name;
|
video.Name = data.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we don't have a ProductionYear try and get it from PremiereDate
|
// If we don't have a ProductionYear try and get it from PremiereDate
|
||||||
if (video.PremiereDate.HasValue && !video.ProductionYear.HasValue)
|
if (video.PremiereDate.HasValue && !video.ProductionYear.HasValue)
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
{
|
{
|
||||||
class FanartMovieUpdatesPostScanTask : ILibraryPostScanTask
|
class FanartMovieUpdatesPostScanTask : ILibraryPostScanTask
|
||||||
{
|
{
|
||||||
private const string UpdatesUrl = "http://webservice.fanart.tv/v3/movies/latest?api_key={0}&date={1}";
|
private const string UpdatesUrl = "https://webservice.fanart.tv/v3/movies/latest?api_key={0}&date={1}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _HTTP client
|
/// The _HTTP client
|
||||||
|
|
|
@ -16,6 +16,7 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommonIO;
|
using CommonIO;
|
||||||
|
@ -23,7 +24,7 @@ using MediaBrowser.Providers.TV;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Movies
|
namespace MediaBrowser.Providers.Movies
|
||||||
{
|
{
|
||||||
public class FanartMovieImageProvider : IRemoteImageProvider, IHasChangeMonitor, IHasOrder
|
public class FanartMovieImageProvider : IRemoteImageProvider, IHasItemChangeMonitor, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
@ -31,7 +32,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IJsonSerializer _json;
|
private readonly IJsonSerializer _json;
|
||||||
|
|
||||||
private const string FanArtBaseUrl = "http://webservice.fanart.tv/v3/movies/{1}?api_key={0}";
|
private const string FanArtBaseUrl = "https://webservice.fanart.tv/v3/movies/{1}?api_key={0}";
|
||||||
// &client_key=52c813aa7b8c8b3bb87f4797532a2f8c
|
// &client_key=52c813aa7b8c8b3bb87f4797532a2f8c
|
||||||
|
|
||||||
internal static FanartMovieImageProvider Current;
|
internal static FanartMovieImageProvider Current;
|
||||||
|
@ -185,6 +186,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
PopulateImages(list, obj.moviebackground, ImageType.Backdrop, 1920, 1080);
|
PopulateImages(list, obj.moviebackground, ImageType.Backdrop, 1920, 1080);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Regex _regex_http = new Regex("^http://");
|
||||||
private void PopulateImages(List<RemoteImageInfo> list, List<Image> images, ImageType type, int width, int height)
|
private void PopulateImages(List<RemoteImageInfo> list, List<Image> images, ImageType type, int width, int height)
|
||||||
{
|
{
|
||||||
if (images == null)
|
if (images == null)
|
||||||
|
@ -208,7 +210,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
Width = width,
|
Width = width,
|
||||||
Height = height,
|
Height = height,
|
||||||
ProviderName = Name,
|
ProviderName = Name,
|
||||||
Url = url,
|
Url = _regex_http.Replace(url, "https://", 1),
|
||||||
Language = i.lang
|
Language = i.lang
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -239,7 +241,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var options = FanartSeriesProvider.Current.GetFanartOptions();
|
var options = FanartSeriesProvider.Current.GetFanartOptions();
|
||||||
if (!options.EnableAutomaticUpdates)
|
if (!options.EnableAutomaticUpdates)
|
||||||
|
@ -260,7 +262,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
var fileInfo = _fileSystem.GetFileInfo(path);
|
var fileInfo = _fileSystem.GetFileInfo(path);
|
||||||
|
|
||||||
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
|
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -249,7 +249,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
}
|
}
|
||||||
|
|
||||||
resultItem.ResetPeople();
|
resultItem.ResetPeople();
|
||||||
var tmdbImageUrl = settings.images.base_url + "original";
|
var tmdbImageUrl = settings.images.secure_base_url + "original";
|
||||||
|
|
||||||
//Actors, Directors, Writers - all in People
|
//Actors, Directors, Writers - all in People
|
||||||
//actors come from cast
|
//actors come from cast
|
||||||
|
@ -329,7 +329,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
{
|
{
|
||||||
hasTrailers.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl
|
hasTrailers.RemoteTrailers = movieData.trailers.youtube.Select(i => new MediaUrl
|
||||||
{
|
{
|
||||||
Url = string.Format("http://www.youtube.com/watch?v={0}", i.source),
|
Url = string.Format("https://www.youtube.com/watch?v={0}", i.source),
|
||||||
Name = i.name,
|
Name = i.name,
|
||||||
VideoSize = string.Equals("hd", i.size, StringComparison.OrdinalIgnoreCase) ? VideoSize.HighDefinition : VideoSize.StandardDefinition
|
VideoSize = string.Equals("hd", i.size, StringComparison.OrdinalIgnoreCase) ? VideoSize.HighDefinition : VideoSize.StandardDefinition
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Movies
|
namespace MediaBrowser.Providers.Movies
|
||||||
{
|
{
|
||||||
class MovieDbImageProvider : IRemoteImageProvider, IHasOrder, IHasChangeMonitor
|
class MovieDbImageProvider : IRemoteImageProvider, IHasOrder, IHasItemChangeMonitor
|
||||||
{
|
{
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
|
@ -72,7 +72,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
|
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
||||||
|
|
||||||
var supportedImages = GetSupportedImages(item).ToList();
|
var supportedImages = GetSupportedImages(item).ToList();
|
||||||
|
|
||||||
|
@ -222,9 +222,9 @@ namespace MediaBrowser.Providers.Movies
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
return MovieDbProvider.Current.HasChanged(item, date);
|
return MovieDbProvider.Current.HasChanged(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
var tmdbSettings = await GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
|
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
||||||
|
|
||||||
var remoteResult = new RemoteSearchResult
|
var remoteResult = new RemoteSearchResult
|
||||||
{
|
{
|
||||||
|
@ -172,8 +172,8 @@ namespace MediaBrowser.Providers.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string TmdbConfigUrl = "http://api.themoviedb.org/3/configuration?api_key={0}";
|
private const string TmdbConfigUrl = "https://api.themoviedb.org/3/configuration?api_key={0}";
|
||||||
private const string GetMovieInfo3 = @"http://api.themoviedb.org/3/movie/{0}?api_key={1}&append_to_response=casts,releases,images,keywords,trailers";
|
private const string GetMovieInfo3 = @"https://api.themoviedb.org/3/movie/{0}?api_key={1}&append_to_response=casts,releases,images,keywords,trailers";
|
||||||
|
|
||||||
internal static string ApiKey = "f6bd687ffa63cd282b6ff2c6877f2669";
|
internal static string ApiKey = "f6bd687ffa63cd282b6ff2c6877f2669";
|
||||||
internal static string AcceptHeader = "application/json,image/*";
|
internal static string AcceptHeader = "application/json,image/*";
|
||||||
|
@ -281,7 +281,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
public static string NormalizeLanguage(string language)
|
public static string NormalizeLanguage(string language)
|
||||||
{
|
{
|
||||||
// They require this to be uppercase
|
// They require this to be uppercase
|
||||||
// http://emby.media/community/index.php?/topic/32454-fr-follow-tmdbs-new-language-api-update/?p=311148
|
// https://emby.media/community/index.php?/topic/32454-fr-follow-tmdbs-new-language-api-update/?p=311148
|
||||||
var parts = language.Split('-');
|
var parts = language.Split('-');
|
||||||
|
|
||||||
if (parts.Length == 2)
|
if (parts.Length == 2)
|
||||||
|
@ -414,7 +414,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
return _configurationManager.GetConfiguration<TheMovieDbOptions>("themoviedb");
|
return _configurationManager.GetConfiguration<TheMovieDbOptions>("themoviedb");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
public bool HasChanged(IHasMetadata item)
|
||||||
{
|
{
|
||||||
if (!GetTheMovieDbOptions().EnableAutomaticUpdates)
|
if (!GetTheMovieDbOptions().EnableAutomaticUpdates)
|
||||||
{
|
{
|
||||||
|
@ -430,7 +430,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
var fileInfo = _fileSystem.GetFileInfo(dataFilePath);
|
var fileInfo = _fileSystem.GetFileInfo(dataFilePath);
|
||||||
|
|
||||||
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
|
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
public class MovieDbSearch
|
public class MovieDbSearch
|
||||||
{
|
{
|
||||||
private static readonly CultureInfo EnUs = new CultureInfo("en-US");
|
private static readonly CultureInfo EnUs = new CultureInfo("en-US");
|
||||||
private const string Search3 = @"http://api.themoviedb.org/3/search/{3}?api_key={1}&query={0}&language={2}";
|
private const string Search3 = @"https://api.themoviedb.org/3/search/{3}?api_key={1}&query={0}&language={2}";
|
||||||
|
|
||||||
internal static string ApiKey = "f6bd687ffa63cd282b6ff2c6877f2669";
|
internal static string ApiKey = "f6bd687ffa63cd282b6ff2c6877f2669";
|
||||||
internal static string AcceptHeader = "application/json,image/*";
|
internal static string AcceptHeader = "application/json,image/*";
|
||||||
|
@ -56,7 +56,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
|
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(name))
|
if (!string.IsNullOrWhiteSpace(name))
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,9 +33,9 @@ namespace MediaBrowser.Providers.Movies
|
||||||
get { return MovieDbProvider.Current.Name; }
|
get { return MovieDbProvider.Current.Name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
return MovieDbProvider.Current.HasChanged(item, date);
|
return MovieDbProvider.Current.HasChanged(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public int Order
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://www.themoviedb.org/movie/{0}"; }
|
get { return "https://www.themoviedb.org/movie/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -51,7 +51,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://www.themoviedb.org/tv/{0}"; }
|
get { return "https://www.themoviedb.org/tv/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -74,7 +74,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://www.themoviedb.org/collection/{0}"; }
|
get { return "https://www.themoviedb.org/collection/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -97,7 +97,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://www.themoviedb.org/person/{0}"; }
|
get { return "https://www.themoviedb.org/person/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -120,7 +120,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://www.themoviedb.org/collection/{0}"; }
|
get { return "https://www.themoviedb.org/collection/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The updates URL
|
/// The updates URL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const string UpdatesUrl = "http://api.themoviedb.org/3/movie/changes?start_date={0}&api_key={1}&page={2}";
|
private const string UpdatesUrl = "https://api.themoviedb.org/3/movie/changes?start_date={0}&api_key={1}&page={2}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _HTTP client
|
/// The _HTTP client
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace MediaBrowser.Providers.Movies
|
||||||
internal class TmdbImageSettings
|
internal class TmdbImageSettings
|
||||||
{
|
{
|
||||||
public List<string> backdrop_sizes { get; set; }
|
public List<string> backdrop_sizes { get; set; }
|
||||||
public string base_url { get; set; }
|
public string secure_base_url { get; set; }
|
||||||
public List<string> poster_sizes { get; set; }
|
public List<string> poster_sizes { get; set; }
|
||||||
public List<string> profile_sizes { get; set; }
|
public List<string> profile_sizes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ using MediaBrowser.Model.Serialization;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Music
|
namespace MediaBrowser.Providers.Music
|
||||||
{
|
{
|
||||||
public class FanartAlbumProvider : IRemoteImageProvider, IHasChangeMonitor, IHasOrder
|
public class FanartAlbumProvider : IRemoteImageProvider, IHasItemChangeMonitor, IHasOrder
|
||||||
{
|
{
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
@ -213,7 +213,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var options = FanartSeriesProvider.Current.GetFanartOptions();
|
var options = FanartSeriesProvider.Current.GetFanartOptions();
|
||||||
if (!options.EnableAutomaticUpdates)
|
if (!options.EnableAutomaticUpdates)
|
||||||
|
@ -235,7 +235,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
var fileInfo = _fileSystem.GetFileInfo(artistJsonPath);
|
var fileInfo = _fileSystem.GetFileInfo(artistJsonPath);
|
||||||
|
|
||||||
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
|
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,11 @@ using MediaBrowser.Model.Serialization;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Music
|
namespace MediaBrowser.Providers.Music
|
||||||
{
|
{
|
||||||
public class FanartArtistProvider : IRemoteImageProvider, IHasChangeMonitor, IHasOrder
|
public class FanartArtistProvider : IRemoteImageProvider, IHasItemChangeMonitor, IHasOrder
|
||||||
{
|
{
|
||||||
internal readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(3, 3);
|
internal readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(3, 3);
|
||||||
internal const string ApiKey = "5c6b04c68e904cfed1e6cbc9a9e683d4";
|
internal const string ApiKey = "5c6b04c68e904cfed1e6cbc9a9e683d4";
|
||||||
private const string FanArtBaseUrl = "http://webservice.fanart.tv/v3.1/music/{1}?api_key={0}";
|
private const string FanArtBaseUrl = "https://webservice.fanart.tv/v3.1/music/{1}?api_key={0}";
|
||||||
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
@ -207,7 +207,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var options = FanartSeriesProvider.Current.GetFanartOptions();
|
var options = FanartSeriesProvider.Current.GetFanartOptions();
|
||||||
if (!options.EnableAutomaticUpdates)
|
if (!options.EnableAutomaticUpdates)
|
||||||
|
@ -224,7 +224,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
var fileInfo = _fileSystem.GetFileInfo(artistJsonPath);
|
var fileInfo = _fileSystem.GetFileInfo(artistJsonPath);
|
||||||
|
|
||||||
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > date;
|
return !fileInfo.Exists || _fileSystem.GetLastWriteTimeUtc(fileInfo) > item.DateLastRefreshed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
{
|
{
|
||||||
class FanartUpdatesPostScanTask : ILibraryPostScanTask
|
class FanartUpdatesPostScanTask : ILibraryPostScanTask
|
||||||
{
|
{
|
||||||
private const string UpdatesUrl = "http://api.fanart.tv/webservice/newmusic/{0}/{1}/";
|
private const string UpdatesUrl = "https://api.fanart.tv/webservice/newmusic/{0}/{1}/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _HTTP client
|
/// The _HTTP client
|
||||||
|
|
|
@ -27,9 +27,9 @@ namespace MediaBrowser.Providers.Music
|
||||||
get { return MovieDbProvider.Current.Name; }
|
get { return MovieDbProvider.Current.Name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
return MovieDbProvider.Current.HasChanged(item, date);
|
return MovieDbProvider.Current.HasChanged(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(releaseId))
|
if (!string.IsNullOrEmpty(releaseId))
|
||||||
{
|
{
|
||||||
url = string.Format("http://www.musicbrainz.org/ws/2/release/?query=reid:{0}", releaseId);
|
url = string.Format("https://www.musicbrainz.org/ws/2/release/?query=reid:{0}", releaseId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(artistMusicBrainzId))
|
if (!string.IsNullOrWhiteSpace(artistMusicBrainzId))
|
||||||
{
|
{
|
||||||
url = string.Format("http://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND arid:{1}",
|
url = string.Format("https://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND arid:{1}",
|
||||||
WebUtility.UrlEncode(searchInfo.Name),
|
WebUtility.UrlEncode(searchInfo.Name),
|
||||||
artistMusicBrainzId);
|
artistMusicBrainzId);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
{
|
{
|
||||||
isNameSearch = true;
|
isNameSearch = true;
|
||||||
|
|
||||||
url = string.Format("http://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
|
url = string.Format("https://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
|
||||||
WebUtility.UrlEncode(searchInfo.Name),
|
WebUtility.UrlEncode(searchInfo.Name),
|
||||||
WebUtility.UrlEncode(searchInfo.GetAlbumArtist()));
|
WebUtility.UrlEncode(searchInfo.GetAlbumArtist()));
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
private IEnumerable<RemoteSearchResult> GetResultsFromResponse(XmlDocument doc)
|
private IEnumerable<RemoteSearchResult> GetResultsFromResponse(XmlDocument doc)
|
||||||
{
|
{
|
||||||
var ns = new XmlNamespaceManager(doc.NameTable);
|
var ns = new XmlNamespaceManager(doc.NameTable);
|
||||||
ns.AddNamespace("mb", "http://musicbrainz.org/ns/mmd-2.0#");
|
ns.AddNamespace("mb", "https://musicbrainz.org/ns/mmd-2.0#");
|
||||||
|
|
||||||
var list = new List<RemoteSearchResult>();
|
var list = new List<RemoteSearchResult>();
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
private async Task<ReleaseResult> GetReleaseResult(string albumName, string artistId, CancellationToken cancellationToken)
|
private async Task<ReleaseResult> GetReleaseResult(string albumName, string artistId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var url = string.Format("http://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND arid:{1}",
|
var url = string.Format("https://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND arid:{1}",
|
||||||
WebUtility.UrlEncode(albumName),
|
WebUtility.UrlEncode(albumName),
|
||||||
artistId);
|
artistId);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
private async Task<ReleaseResult> GetReleaseResultByArtistName(string albumName, string artistName, CancellationToken cancellationToken)
|
private async Task<ReleaseResult> GetReleaseResultByArtistName(string albumName, string artistName, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var url = string.Format("http://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
|
var url = string.Format("https://www.musicbrainz.org/ws/2/release/?query=\"{0}\" AND artist:\"{1}\"",
|
||||||
WebUtility.UrlEncode(albumName),
|
WebUtility.UrlEncode(albumName),
|
||||||
WebUtility.UrlEncode(artistName));
|
WebUtility.UrlEncode(artistName));
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
private ReleaseResult GetReleaseResult(XmlDocument doc)
|
private ReleaseResult GetReleaseResult(XmlDocument doc)
|
||||||
{
|
{
|
||||||
var ns = new XmlNamespaceManager(doc.NameTable);
|
var ns = new XmlNamespaceManager(doc.NameTable);
|
||||||
ns.AddNamespace("mb", "http://musicbrainz.org/ns/mmd-2.0#");
|
ns.AddNamespace("mb", "https://musicbrainz.org/ns/mmd-2.0#");
|
||||||
|
|
||||||
var result = new ReleaseResult
|
var result = new ReleaseResult
|
||||||
{
|
{
|
||||||
|
@ -258,12 +258,12 @@ namespace MediaBrowser.Providers.Music
|
||||||
/// <returns>Task{System.String}.</returns>
|
/// <returns>Task{System.String}.</returns>
|
||||||
private async Task<string> GetReleaseGroupId(string releaseEntryId, CancellationToken cancellationToken)
|
private async Task<string> GetReleaseGroupId(string releaseEntryId, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var url = string.Format("http://www.musicbrainz.org/ws/2/release-group/?query=reid:{0}", releaseEntryId);
|
var url = string.Format("https://www.musicbrainz.org/ws/2/release-group/?query=reid:{0}", releaseEntryId);
|
||||||
|
|
||||||
var doc = await GetMusicBrainzResponse(url, false, cancellationToken).ConfigureAwait(false);
|
var doc = await GetMusicBrainzResponse(url, false, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var ns = new XmlNamespaceManager(doc.NameTable);
|
var ns = new XmlNamespaceManager(doc.NameTable);
|
||||||
ns.AddNamespace("mb", "http://musicbrainz.org/ns/mmd-2.0#");
|
ns.AddNamespace("mb", "https://musicbrainz.org/ns/mmd-2.0#");
|
||||||
var node = doc.SelectSingleNode("//mb:release-group-list/mb:release-group/@id", ns);
|
var node = doc.SelectSingleNode("//mb:release-group-list/mb:release-group/@id", ns);
|
||||||
|
|
||||||
return node != null ? node.Value : null;
|
return node != null ? node.Value : null;
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(musicBrainzId))
|
if (!string.IsNullOrWhiteSpace(musicBrainzId))
|
||||||
{
|
{
|
||||||
var url = string.Format("http://www.musicbrainz.org/ws/2/artist/?query=arid:{0}", musicBrainzId);
|
var url = string.Format("https://www.musicbrainz.org/ws/2/artist/?query=arid:{0}", musicBrainzId);
|
||||||
|
|
||||||
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, false, cancellationToken)
|
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, false, cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
@ -35,7 +35,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
// They seem to throw bad request failures on any term with a slash
|
// They seem to throw bad request failures on any term with a slash
|
||||||
var nameToSearch = searchInfo.Name.Replace('/', ' ');
|
var nameToSearch = searchInfo.Name.Replace('/', ' ');
|
||||||
|
|
||||||
var url = String.Format("http://www.musicbrainz.org/ws/2/artist/?query=artist:\"{0}\"", UrlEncode(nameToSearch));
|
var url = String.Format("https://www.musicbrainz.org/ws/2/artist/?query=artist:\"{0}\"", UrlEncode(nameToSearch));
|
||||||
|
|
||||||
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
var doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
if (HasDiacritics(searchInfo.Name))
|
if (HasDiacritics(searchInfo.Name))
|
||||||
{
|
{
|
||||||
// Try again using the search with accent characters url
|
// Try again using the search with accent characters url
|
||||||
url = String.Format("http://www.musicbrainz.org/ws/2/artist/?query=artistaccent:\"{0}\"", UrlEncode(nameToSearch));
|
url = String.Format("https://www.musicbrainz.org/ws/2/artist/?query=artistaccent:\"{0}\"", UrlEncode(nameToSearch));
|
||||||
|
|
||||||
doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
doc = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
private IEnumerable<RemoteSearchResult> GetResultsFromResponse(XmlDocument doc)
|
private IEnumerable<RemoteSearchResult> GetResultsFromResponse(XmlDocument doc)
|
||||||
{
|
{
|
||||||
var ns = new XmlNamespaceManager(doc.NameTable);
|
var ns = new XmlNamespaceManager(doc.NameTable);
|
||||||
ns.AddNamespace("mb", "http://musicbrainz.org/ns/mmd-2.0#");
|
ns.AddNamespace("mb", "https://musicbrainz.org/ns/mmd-2.0#");
|
||||||
|
|
||||||
var list = new List<RemoteSearchResult>();
|
var list = new List<RemoteSearchResult>();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://musicbrainz.org/release-group/{0}"; }
|
get { return "https://musicbrainz.org/release-group/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -41,7 +41,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://musicbrainz.org/artist/{0}"; }
|
get { return "https://musicbrainz.org/artist/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -64,7 +64,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://musicbrainz.org/release/{0}"; }
|
get { return "https://musicbrainz.org/release/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -87,7 +87,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://musicbrainz.org/artist/{0}"; }
|
get { return "https://musicbrainz.org/artist/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -110,7 +110,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://musicbrainz.org/artist/{0}"; }
|
get { return "https://musicbrainz.org/artist/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
@ -133,7 +133,7 @@ namespace MediaBrowser.Providers.Music
|
||||||
|
|
||||||
public string UrlFormatString
|
public string UrlFormatString
|
||||||
{
|
{
|
||||||
get { return "http://musicbrainz.org/track/{0}"; }
|
get { return "https://musicbrainz.org/track/{0}"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace MediaBrowser.Providers.Omdb
|
||||||
list.Add(new RemoteImageInfo
|
list.Add(new RemoteImageInfo
|
||||||
{
|
{
|
||||||
ProviderName = Name,
|
ProviderName = Name,
|
||||||
Url = string.Format("http://img.omdbapi.com/?i={0}&apikey=82e83907", imdbId)
|
Url = string.Format("https://img.omdbapi.com/?i={0}&apikey=82e83907", imdbId)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user