add sample rate condition
This commit is contained in:
parent
14533d9cc9
commit
0beb803aed
|
@ -488,7 +488,8 @@ namespace Emby.Dlna.Didl
|
|||
var mediaProfile = _profile.GetAudioMediaProfile(streamInfo.Container,
|
||||
streamInfo.TargetAudioCodec,
|
||||
targetChannels,
|
||||
targetAudioBitrate);
|
||||
targetAudioBitrate,
|
||||
targetSampleRate);
|
||||
|
||||
var filename = url.Substring(0, url.IndexOf('?'));
|
||||
|
||||
|
|
|
@ -883,15 +883,6 @@ namespace Emby.Server.Implementations.Dto
|
|||
dto.AspectRatio = hasAspectRatio.AspectRatio;
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.AwardSummary))
|
||||
{
|
||||
var hasAwards = item as IHasAwards;
|
||||
if (hasAwards != null)
|
||||
{
|
||||
dto.AwardSummary = hasAwards.AwardSummary;
|
||||
}
|
||||
}
|
||||
|
||||
var backdropLimit = options.GetImageLimit(ImageType.Backdrop);
|
||||
if (backdropLimit > 0)
|
||||
{
|
||||
|
|
|
@ -335,12 +335,6 @@ namespace MediaBrowser.Api
|
|||
video.Video3DFormat = request.Video3DFormat;
|
||||
}
|
||||
|
||||
var hasAwards = item as IHasAwards;
|
||||
if (hasAwards != null)
|
||||
{
|
||||
hasAwards.AwardSummary = request.AwardSummary;
|
||||
}
|
||||
|
||||
var game = item as Game;
|
||||
|
||||
if (game != null)
|
||||
|
|
|
@ -866,7 +866,7 @@ namespace MediaBrowser.Api.Playback
|
|||
var videoCodec = state.ActualOutputVideoCodec;
|
||||
|
||||
var mediaProfile = state.VideoRequest == null ?
|
||||
profile.GetAudioMediaProfile(state.OutputContainer, audioCodec, state.OutputAudioChannels, state.OutputAudioBitrate) :
|
||||
profile.GetAudioMediaProfile(state.OutputContainer, audioCodec, state.OutputAudioChannels, state.OutputAudioBitrate, state.OutputAudioSampleRate) :
|
||||
profile.GetVideoMediaProfile(state.OutputContainer,
|
||||
audioCodec,
|
||||
videoCodec,
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IHasAwards
|
||||
/// </summary>
|
||||
public interface IHasAwards
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the awards summary.
|
||||
/// </summary>
|
||||
/// <value>The awards summary.</value>
|
||||
string AwardSummary { get; set; }
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||
/// <summary>
|
||||
/// Class Movie
|
||||
/// </summary>
|
||||
public class Movie : Video, IHasSpecialFeatures, IHasTrailers, IHasAwards, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
|
||||
public class Movie : Video, IHasSpecialFeatures, IHasTrailers, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
|
||||
{
|
||||
public List<Guid> SpecialFeatureIds { get; set; }
|
||||
|
||||
|
@ -29,8 +29,6 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||
RemoteTrailerIds = new List<Guid>();
|
||||
}
|
||||
|
||||
public string AwardSummary { get; set; }
|
||||
|
||||
public List<Guid> LocalTrailerIds { get; set; }
|
||||
public List<Guid> RemoteTrailerIds { get; set; }
|
||||
|
||||
|
|
|
@ -131,7 +131,6 @@
|
|||
<Compile Include="Entities\ItemImageInfo.cs" />
|
||||
<Compile Include="Entities\LinkedChild.cs" />
|
||||
<Compile Include="Entities\MusicVideo.cs" />
|
||||
<Compile Include="Entities\IHasAwards.cs" />
|
||||
<Compile Include="Entities\PeopleHelper.cs" />
|
||||
<Compile Include="Entities\Photo.cs" />
|
||||
<Compile Include="Entities\PhotoAlbum.cs" />
|
||||
|
|
|
@ -207,21 +207,6 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
|||
break;
|
||||
}
|
||||
|
||||
case "AwardSummary":
|
||||
{
|
||||
var text = reader.ReadElementContentAsString();
|
||||
var hasAwards = item as IHasAwards;
|
||||
if (hasAwards != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
hasAwards.AwardSummary = text;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "SortTitle":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
"AspectRatio",
|
||||
"AudioDbAlbumId",
|
||||
"AudioDbArtistId",
|
||||
"AwardSummary",
|
||||
"BirthDate",
|
||||
|
||||
// Deprecated. No longer saving in this field.
|
||||
|
@ -403,12 +402,6 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
writer.WriteElementString("DisplayOrder", hasDisplayOrder.DisplayOrder);
|
||||
}
|
||||
|
||||
var hasAwards = item as IHasAwards;
|
||||
if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary))
|
||||
{
|
||||
writer.WriteElementString("AwardSummary", hasAwards.AwardSummary);
|
||||
}
|
||||
|
||||
if (item.CommunityRating.HasValue)
|
||||
{
|
||||
writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(UsCulture));
|
||||
|
|
|
@ -263,7 +263,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
var outputContainer = state.Options.OutputContainer;
|
||||
|
||||
var mediaProfile = state.IsVideoRequest ?
|
||||
profile.GetAudioMediaProfile(outputContainer, audioCodec, state.OutputAudioChannels, state.OutputAudioBitrate) :
|
||||
profile.GetAudioMediaProfile(outputContainer, audioCodec, state.OutputAudioChannels, state.OutputAudioBitrate, state.OutputAudioSampleRate) :
|
||||
profile.GetVideoMediaProfile(outputContainer,
|
||||
audioCodec,
|
||||
videoCodec,
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsAudioConditionSatisfied(ProfileCondition condition, int? audioChannels, int? audioBitrate)
|
||||
public bool IsAudioConditionSatisfied(ProfileCondition condition, int? audioChannels, int? audioBitrate, int? audioSampleRate)
|
||||
{
|
||||
switch (condition.Property)
|
||||
{
|
||||
|
@ -84,6 +84,8 @@ namespace MediaBrowser.Model.Dlna
|
|||
return IsConditionSatisfied(condition, audioBitrate);
|
||||
case ProfileConditionValue.AudioChannels:
|
||||
return IsConditionSatisfied(condition, audioChannels);
|
||||
case ProfileConditionValue.AudioSampleRate:
|
||||
return IsConditionSatisfied(condition, audioSampleRate);
|
||||
default:
|
||||
throw new ArgumentException("Unexpected condition on audio file: " + condition.Property);
|
||||
}
|
||||
|
@ -92,6 +94,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
public bool IsVideoAudioConditionSatisfied(ProfileCondition condition,
|
||||
int? audioChannels,
|
||||
int? audioBitrate,
|
||||
int? audioSampleRate,
|
||||
string audioProfile,
|
||||
bool? isSecondaryTrack)
|
||||
{
|
||||
|
@ -105,6 +108,8 @@ namespace MediaBrowser.Model.Dlna
|
|||
return IsConditionSatisfied(condition, audioChannels);
|
||||
case ProfileConditionValue.IsSecondaryAudio:
|
||||
return IsConditionSatisfied(condition, isSecondaryTrack);
|
||||
case ProfileConditionValue.AudioSampleRate:
|
||||
return IsConditionSatisfied(condition, audioSampleRate);
|
||||
default:
|
||||
throw new ArgumentException("Unexpected condition on audio file: " + condition.Property);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,8 @@ namespace MediaBrowser.Model.Dlna
|
|||
ResponseProfile mediaProfile = _profile.GetAudioMediaProfile(container,
|
||||
audioCodec,
|
||||
audioChannels,
|
||||
audioBitrate);
|
||||
audioBitrate,
|
||||
audioSampleRate);
|
||||
|
||||
string orgPn = mediaProfile == null ? null : mediaProfile.OrgPn;
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
return null;
|
||||
}
|
||||
|
||||
public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate)
|
||||
public ResponseProfile GetAudioMediaProfile(string container, string audioCodec, int? audioChannels, int? audioBitrate, int? audioSampleRate)
|
||||
{
|
||||
container = StringHelper.TrimStart(container ?? string.Empty, '.');
|
||||
|
||||
|
@ -213,7 +213,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
var anyOff = false;
|
||||
foreach (ProfileCondition c in i.Conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate))
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate, audioSampleRate))
|
||||
{
|
||||
anyOff = true;
|
||||
break;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
IsSecondaryAudio = 18,
|
||||
VideoCodecTag = 19,
|
||||
IsAvc = 20,
|
||||
IsInterlaced = 21
|
||||
IsInterlaced = 21,
|
||||
AudioSampleRate = 22
|
||||
}
|
||||
}
|
|
@ -139,6 +139,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
|
||||
int? inputAudioChannels = audioStream == null ? null : audioStream.Channels;
|
||||
int? inputAudioBitrate = audioStream == null ? null : audioStream.BitDepth;
|
||||
int? inputAudioSampleRate = audioStream == null ? null : audioStream.SampleRate;
|
||||
|
||||
if (directPlayMethods.Count > 0)
|
||||
{
|
||||
|
@ -155,7 +156,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
bool applyConditions = true;
|
||||
foreach (ProfileCondition applyCondition in i.ApplyConditions)
|
||||
{
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate))
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate))
|
||||
{
|
||||
LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item);
|
||||
applyConditions = false;
|
||||
|
@ -176,7 +177,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
bool all = true;
|
||||
foreach (ProfileCondition c in conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(c, inputAudioChannels, inputAudioBitrate))
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(c, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate))
|
||||
{
|
||||
LogConditionFailure(options.Profile, "AudioCodecProfile", c, item);
|
||||
all = false;
|
||||
|
@ -251,7 +252,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
bool applyConditions = true;
|
||||
foreach (ProfileCondition applyCondition in i.ApplyConditions)
|
||||
{
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate))
|
||||
if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate))
|
||||
{
|
||||
LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item);
|
||||
applyConditions = false;
|
||||
|
@ -519,8 +520,9 @@ namespace MediaBrowser.Model.Dlna
|
|||
int? inputAudioBitrate = audioStream == null ? null : audioStream.BitRate;
|
||||
int? audioChannels = audioStream == null ? null : audioStream.Channels;
|
||||
string audioProfile = audioStream == null ? null : audioStream.Profile;
|
||||
int? inputAudioSampleRate = audioStream == null ? null : audioStream.SampleRate;
|
||||
|
||||
if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, audioProfile, isSecondaryAudio))
|
||||
if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, audioProfile, isSecondaryAudio))
|
||||
{
|
||||
LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item);
|
||||
applyConditions = false;
|
||||
|
@ -752,6 +754,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
int? audioBitrate = audioStream == null ? null : audioStream.BitRate;
|
||||
int? audioChannels = audioStream == null ? null : audioStream.Channels;
|
||||
string audioProfile = audioStream == null ? null : audioStream.Profile;
|
||||
int? audioSampleRate = audioStream == null ? null : audioStream.SampleRate;
|
||||
|
||||
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp;
|
||||
int? packetLength = videoStream == null ? null : videoStream.PacketLength;
|
||||
|
@ -841,7 +844,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
bool applyConditions = true;
|
||||
foreach (ProfileCondition applyCondition in i.ApplyConditions)
|
||||
{
|
||||
if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioProfile, isSecondaryAudio))
|
||||
if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioProfile, isSecondaryAudio))
|
||||
{
|
||||
LogConditionFailure(profile, "VideoAudioCodecProfile", applyCondition, mediaSource);
|
||||
applyConditions = false;
|
||||
|
@ -861,7 +864,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
|
||||
foreach (ProfileCondition i in conditions)
|
||||
{
|
||||
if (!conditionProcessor.IsVideoAudioConditionSatisfied(i, audioChannels, audioBitrate, audioProfile, isSecondaryAudio))
|
||||
if (!conditionProcessor.IsVideoAudioConditionSatisfied(i, audioChannels, audioBitrate, audioSampleRate, audioProfile, isSecondaryAudio))
|
||||
{
|
||||
LogConditionFailure(profile, "VideoAudioCodecProfile", i, mediaSource);
|
||||
|
||||
|
|
|
@ -79,8 +79,6 @@ namespace MediaBrowser.Model.Dto
|
|||
public string PreferredMetadataLanguage { get; set; }
|
||||
public string PreferredMetadataCountryCode { get; set; }
|
||||
|
||||
public string AwardSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [supports synchronize].
|
||||
/// </summary>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
/// </summary>
|
||||
AlternateEpisodeNumbers,
|
||||
|
||||
/// <summary>
|
||||
/// The awards summary
|
||||
/// </summary>
|
||||
AwardSummary,
|
||||
|
||||
/// <summary>
|
||||
/// The can delete
|
||||
/// </summary>
|
||||
|
|
|
@ -198,7 +198,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
MergeAlbumArtist(source, target, lockedFields, replaceData);
|
||||
MergeCriticRating(source, target, lockedFields, replaceData);
|
||||
MergeAwards(source, target, lockedFields, replaceData);
|
||||
MergeTrailers(source, target, lockedFields, replaceData);
|
||||
MergeVideoInfo(source, target, lockedFields, replaceData);
|
||||
|
||||
|
@ -273,20 +272,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
}
|
||||
}
|
||||
|
||||
private static void MergeAwards(BaseItem source, BaseItem target, List<MetadataFields> lockedFields, bool replaceData)
|
||||
{
|
||||
var sourceCast = source as IHasAwards;
|
||||
var targetCast = target as IHasAwards;
|
||||
|
||||
if (sourceCast != null && targetCast != null)
|
||||
{
|
||||
if (replaceData || string.IsNullOrEmpty(targetCast.AwardSummary))
|
||||
{
|
||||
targetCast.AwardSummary = sourceCast.AwardSummary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void MergeCriticRating(BaseItem source, BaseItem target, List<MetadataFields> lockedFields, bool replaceData)
|
||||
{
|
||||
if (replaceData || !target.CriticRating.HasValue)
|
||||
|
|
|
@ -406,12 +406,6 @@ namespace MediaBrowser.Providers.Omdb
|
|||
}
|
||||
}
|
||||
|
||||
var hasAwards = item as IHasAwards;
|
||||
if (hasAwards != null && !string.IsNullOrEmpty(result.Awards))
|
||||
{
|
||||
hasAwards.AwardSummary = WebUtility.HtmlDecode(result.Awards);
|
||||
}
|
||||
|
||||
if (isConfiguredForEnglish)
|
||||
{
|
||||
// Omdb is currently english only, so for other languages skip this and let secondary providers fill it in
|
||||
|
|
|
@ -341,21 +341,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
break;
|
||||
}
|
||||
|
||||
case "awardsummary":
|
||||
{
|
||||
var text = reader.ReadElementContentAsString();
|
||||
var hasAwards = item as IHasAwards;
|
||||
if (hasAwards != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
hasAwards.AwardSummary = text;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case "sorttitle":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
|
|
@ -81,7 +81,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
"country",
|
||||
"audiodbalbumid",
|
||||
"audiodbartistid",
|
||||
"awardsummary",
|
||||
"enddate",
|
||||
"lockedfields",
|
||||
"zap2itid",
|
||||
|
@ -711,12 +710,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
writer.WriteElementString("plotkeyword", tag);
|
||||
}
|
||||
|
||||
var hasAwards = item as IHasAwards;
|
||||
if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary))
|
||||
{
|
||||
writer.WriteElementString("awardsummary", hasAwards.AwardSummary);
|
||||
}
|
||||
|
||||
var externalId = item.GetProviderId(MetadataProviders.AudioDbArtist);
|
||||
|
||||
if (!string.IsNullOrEmpty(externalId))
|
||||
|
|
Loading…
Reference in New Issue
Block a user