update metadata editor

This commit is contained in:
Luke Pulverenti 2015-09-19 22:06:56 -04:00
parent c3d6c19cc3
commit 718545a79b
24 changed files with 249 additions and 68 deletions

View file

@ -839,7 +839,7 @@ namespace MediaBrowser.Api.Playback
} }
// leave blank so ffmpeg will decide // leave blank so ffmpeg will decide
return string.Empty; return null;
} }
/// <summary> /// <summary>
@ -849,7 +849,7 @@ namespace MediaBrowser.Api.Playback
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
protected string GetInputArgument(StreamState state) protected string GetInputArgument(StreamState state)
{ {
var arg = string.Format("{1}-i {0}", GetInputPathArgument(state), GetVideoDecoder(state)); var arg = string.Format("-i {0}", GetInputPathArgument(state));
if (state.SubtitleStream != null) if (state.SubtitleStream != null)
{ {
@ -1060,6 +1060,7 @@ namespace MediaBrowser.Api.Playback
var bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line); var bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line);
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false); await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
await target.FlushAsync().ConfigureAwait(false);
} }
} }
} }
@ -2191,6 +2192,12 @@ namespace MediaBrowser.Api.Playback
inputModifier += " -re"; inputModifier += " -re";
} }
var videoDecoder = GetVideoDecoder(state);
if (!string.IsNullOrWhiteSpace(videoDecoder))
{
inputModifier += " " + videoDecoder;
}
return inputModifier; return inputModifier;
} }

View file

@ -115,7 +115,11 @@ namespace MediaBrowser.Controller.Channels
var info = GetItemLookupInfo<ChannelItemLookupInfo>(); var info = GetItemLookupInfo<ChannelItemLookupInfo>();
info.ContentType = ContentType; info.ContentType = ContentType;
info.ExtraType = ExtraType;
if (ExtraType.HasValue)
{
info.ExtraType = ExtraType.Value;
}
return info; return info;
} }

View file

@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.Channels
ChannelMediaContentType ContentType { get; set; } ChannelMediaContentType ContentType { get; set; }
ExtraType ExtraType { get; set; } ExtraType? ExtraType { get; set; }
List<ChannelMediaInfo> ChannelMediaSources { get; set; } List<ChannelMediaInfo> ChannelMediaSources { get; set; }
} }

View file

@ -24,14 +24,20 @@ namespace MediaBrowser.Controller.Entities.Audio
IThemeMedia, IThemeMedia,
IArchivable IArchivable
{ {
public string FormatName { get; set; }
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; }
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
public ExtraType ExtraType { get; set; } public ExtraType? ExtraType { get; set; }
public bool IsThemeMedia { get; set; } [IgnoreDataMember]
public bool IsThemeMedia
{
get
{
return ExtraType.HasValue && ExtraType.Value == Model.Entities.ExtraType.ThemeSong;
}
}
public Audio() public Audio()
{ {
@ -46,12 +52,6 @@ namespace MediaBrowser.Controller.Entities.Audio
get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; } get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; }
} }
/// <summary>
/// Gets or sets a value indicating whether this instance has embedded image.
/// </summary>
/// <value><c>true</c> if this instance has embedded image; otherwise, <c>false</c>.</value>
public bool HasEmbeddedImage { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
protected override bool SupportsOwnedItems protected override bool SupportsOwnedItems
{ {
@ -212,8 +212,7 @@ namespace MediaBrowser.Controller.Entities.Audio
Path = enablePathSubstituion ? GetMappedPath(i.Path, locationType) : i.Path, Path = enablePathSubstituion ? GetMappedPath(i.Path, locationType) : i.Path,
RunTimeTicks = i.RunTimeTicks, RunTimeTicks = i.RunTimeTicks,
Container = i.Container, Container = i.Container,
Size = i.Size, Size = i.Size
Formats = (i.FormatName ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList()
}; };
if (string.IsNullOrEmpty(info.Container)) if (string.IsNullOrEmpty(info.Container))

View file

@ -66,6 +66,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets the tracks. /// Gets the tracks.
/// </summary> /// </summary>
/// <value>The tracks.</value> /// <value>The tracks.</value>
[IgnoreDataMember]
public IEnumerable<Audio> Tracks public IEnumerable<Audio> Tracks
{ {
get get

View file

@ -880,7 +880,7 @@ namespace MediaBrowser.Controller.Entities
if (!i.IsThemeMedia) if (!i.IsThemeMedia)
{ {
i.IsThemeMedia = true; i.ExtraType = ExtraType.ThemeVideo;
subOptions.ForceSave = true; subOptions.ForceSave = true;
} }
@ -910,7 +910,7 @@ namespace MediaBrowser.Controller.Entities
if (!i.IsThemeMedia) if (!i.IsThemeMedia)
{ {
i.IsThemeMedia = true; i.ExtraType = ExtraType.ThemeSong;
subOptions.ForceSave = true; subOptions.ForceSave = true;
} }

View file

@ -61,10 +61,6 @@ namespace MediaBrowser.Controller.Entities.TV
return base.CreateUserDataKey(); return base.CreateUserDataKey();
} }
/// <summary>
/// The _series
/// </summary>
private Series _series;
/// <summary> /// <summary>
/// This Episode's Series Instance /// This Episode's Series Instance
/// </summary> /// </summary>
@ -72,7 +68,7 @@ namespace MediaBrowser.Controller.Entities.TV
[IgnoreDataMember] [IgnoreDataMember]
public Series Series public Series Series
{ {
get { return _series ?? (_series = FindParent<Series>()); } get { return FindParent<Series>(); }
} }
[IgnoreDataMember] [IgnoreDataMember]

View file

@ -33,14 +33,20 @@ namespace MediaBrowser.Controller.Entities
public List<string> LocalAlternateVersions { get; set; } public List<string> LocalAlternateVersions { get; set; }
public List<LinkedChild> LinkedAlternateVersions { get; set; } public List<LinkedChild> LinkedAlternateVersions { get; set; }
public bool IsThemeMedia { get; set; } [IgnoreDataMember]
public bool IsThemeMedia
{
get
{
return ExtraType.HasValue && ExtraType.Value == Model.Entities.ExtraType.ThemeVideo;
}
}
public string FormatName { get; set; }
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; }
public string ShortOverview { get; set; } public string ShortOverview { get; set; }
public ExtraType ExtraType { get; set; } public ExtraType? ExtraType { get; set; }
/// <summary> /// <summary>
/// Gets or sets the preferred metadata country code. /// Gets or sets the preferred metadata country code.
@ -498,7 +504,6 @@ namespace MediaBrowser.Controller.Entities
VideoType = i.VideoType, VideoType = i.VideoType,
Container = i.Container, Container = i.Container,
Size = i.Size, Size = i.Size,
Formats = (i.FormatName ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(),
Timestamp = i.Timestamp, Timestamp = i.Timestamp,
Type = type, Type = type,
PlayableStreamFileNames = i.PlayableStreamFileNames.ToList(), PlayableStreamFileNames = i.PlayableStreamFileNames.ToList(),

View file

@ -18,6 +18,7 @@ namespace MediaBrowser.Controller.LiveTv
public string ProviderImagePath { get; set; } public string ProviderImagePath { get; set; }
public string ProviderImageUrl { get; set; } public string ProviderImageUrl { get; set; }
public string EpisodeTitle { get; set; } public string EpisodeTitle { get; set; }
[IgnoreDataMember]
public bool IsSeries { get; set; } public bool IsSeries { get; set; }
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
@ -25,6 +26,7 @@ namespace MediaBrowser.Controller.LiveTv
public RecordingStatus Status { get; set; } public RecordingStatus Status { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
public bool IsSports { get; set; } public bool IsSports { get; set; }
[IgnoreDataMember]
public bool IsNews { get; set; } public bool IsNews { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
public bool IsKids { get; set; } public bool IsKids { get; set; }
@ -32,7 +34,9 @@ namespace MediaBrowser.Controller.LiveTv
[IgnoreDataMember] [IgnoreDataMember]
public bool IsMovie { get; set; } public bool IsMovie { get; set; }
public bool? IsHD { get; set; } public bool? IsHD { get; set; }
[IgnoreDataMember]
public bool IsLive { get; set; } public bool IsLive { get; set; }
[IgnoreDataMember]
public bool IsPremiere { get; set; } public bool IsPremiere { get; set; }
public ChannelType ChannelType { get; set; } public ChannelType ChannelType { get; set; }
public string ProgramId { get; set; } public string ProgramId { get; set; }

View file

@ -125,18 +125,21 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets or sets a value indicating whether this instance is series. /// Gets or sets a value indicating whether this instance is series.
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsSeries { get; set; } public bool IsSeries { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this instance is live. /// Gets or sets a value indicating whether this instance is live.
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is live; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsLive { get; set; } public bool IsLive { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether this instance is news. /// Gets or sets a value indicating whether this instance is news.
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is news; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsNews { get; set; } public bool IsNews { get; set; }
/// <summary> /// <summary>
@ -150,6 +153,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets or sets a value indicating whether this instance is premiere. /// Gets or sets a value indicating whether this instance is premiere.
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsPremiere { get; set; } public bool IsPremiere { get; set; }
/// <summary> /// <summary>
@ -248,6 +252,7 @@ namespace MediaBrowser.Controller.LiveTv
return info; return info;
} }
[IgnoreDataMember]
public override bool SupportsPeople public override bool SupportsPeople
{ {
get get

View file

@ -18,6 +18,7 @@ namespace MediaBrowser.Controller.LiveTv
public string ProviderImagePath { get; set; } public string ProviderImagePath { get; set; }
public string ProviderImageUrl { get; set; } public string ProviderImageUrl { get; set; }
public string EpisodeTitle { get; set; } public string EpisodeTitle { get; set; }
[IgnoreDataMember]
public bool IsSeries { get; set; } public bool IsSeries { get; set; }
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
@ -25,6 +26,7 @@ namespace MediaBrowser.Controller.LiveTv
public RecordingStatus Status { get; set; } public RecordingStatus Status { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
public bool IsSports { get; set; } public bool IsSports { get; set; }
[IgnoreDataMember]
public bool IsNews { get; set; } public bool IsNews { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
public bool IsKids { get; set; } public bool IsKids { get; set; }
@ -32,7 +34,9 @@ namespace MediaBrowser.Controller.LiveTv
[IgnoreDataMember] [IgnoreDataMember]
public bool IsMovie { get; set; } public bool IsMovie { get; set; }
public bool? IsHD { get; set; } public bool? IsHD { get; set; }
[IgnoreDataMember]
public bool IsLive { get; set; } public bool IsLive { get; set; }
[IgnoreDataMember]
public bool IsPremiere { get; set; } public bool IsPremiere { get; set; }
public ChannelType ChannelType { get; set; } public ChannelType ChannelType { get; set; }
public string ProgramId { get; set; } public string ProgramId { get; set; }

View file

@ -342,9 +342,55 @@ namespace MediaBrowser.MediaEncoding.Encoder
inputModifier += " -re"; inputModifier += " -re";
} }
var videoDecoder = GetVideoDecoder(job);
if (!string.IsNullOrWhiteSpace(videoDecoder))
{
inputModifier += " " + videoDecoder;
}
return inputModifier; return inputModifier;
} }
/// <summary>
/// Gets the name of the output video codec
/// </summary>
/// <param name="state">The state.</param>
/// <returns>System.String.</returns>
protected string GetVideoDecoder(EncodingJob state)
{
if (string.Equals(GetEncodingOptions().HardwareVideoDecoder, "qsv", StringComparison.OrdinalIgnoreCase))
{
if (state.VideoStream != null && !string.IsNullOrWhiteSpace(state.VideoStream.Codec))
{
switch (state.MediaSource.VideoStream.Codec.ToLower())
{
case "avc":
case "h264":
if (MediaEncoder.SupportsDecoder("h264_qsv"))
{
return "-c:v h264_qsv ";
}
break;
case "mpeg2video":
if (MediaEncoder.SupportsDecoder("mpeg2_qsv"))
{
return "-c:v mpeg2_qsv ";
}
break;
case "vc1":
if (MediaEncoder.SupportsDecoder("vc1_qsv"))
{
return "-c:v vc1_qsv ";
}
break;
}
}
}
// leave blank so ffmpeg will decide
return null;
}
private string GetUserAgentParam(EncodingJob job) private string GetUserAgentParam(EncodingJob job)
{ {
string useragent = null; string useragent = null;
@ -436,7 +482,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
state.IsoMount = await IsoManager.Mount(state.MediaPath, cancellationToken).ConfigureAwait(false); state.IsoMount = await IsoManager.Mount(state.MediaPath, cancellationToken).ConfigureAwait(false);
} }
if (state.MediaSource.RequiresOpening) if (state.MediaSource.RequiresOpening && string.IsNullOrWhiteSpace(state.LiveStreamId))
{ {
var liveStreamResponse = await MediaSourceManager.OpenLiveStream(new LiveStreamRequest var liveStreamResponse = await MediaSourceManager.OpenLiveStream(new LiveStreamRequest
{ {

View file

@ -56,7 +56,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
public bool EnableMpegtsM2TsMode { get; set; } public bool EnableMpegtsM2TsMode { get; set; }
public TranscodeSeekInfo TranscodeSeekInfo { get; set; } public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
public long? EncodingDurationTicks { get; set; } public long? EncodingDurationTicks { get; set; }
public string LiveTvStreamId { get; set; } public string LiveStreamId { get; set; }
public long? RunTimeTicks; public long? RunTimeTicks;
public string ItemType { get; set; } public string ItemType { get; set; }

View file

@ -326,26 +326,36 @@ namespace MediaBrowser.MediaEncoding.Encoder
/// <returns>System.Nullable{System.Int32}.</returns> /// <returns>System.Nullable{System.Int32}.</returns>
private int? GetNumAudioChannelsParam(EncodingJobOptions request, MediaStream audioStream, string outputAudioCodec) private int? GetNumAudioChannelsParam(EncodingJobOptions request, MediaStream audioStream, string outputAudioCodec)
{ {
if (audioStream != null) var inputChannels = audioStream == null
{ ? null
var codec = outputAudioCodec ?? string.Empty; : audioStream.Channels;
if (audioStream.Channels > 2 && codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1) if (inputChannels <= 0)
{ {
// wmav2 currently only supports two channel output inputChannels = null;
return 2; }
}
var codec = outputAudioCodec ?? string.Empty;
if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
{
// wmav2 currently only supports two channel output
return Math.Min(2, inputChannels ?? 2);
} }
if (request.MaxAudioChannels.HasValue) if (request.MaxAudioChannels.HasValue)
{ {
if (audioStream != null && audioStream.Channels.HasValue) if (inputChannels.HasValue)
{ {
return Math.Min(request.MaxAudioChannels.Value, audioStream.Channels.Value); return Math.Min(request.MaxAudioChannels.Value, inputChannels.Value);
} }
var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1
? 2
: 6;
// If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels // If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
return Math.Min(request.MaxAudioChannels.Value, 5); return Math.Min(request.MaxAudioChannels.Value, channelLimit);
} }
return request.AudioChannels; return request.AudioChannels;
@ -519,6 +529,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
return false; return false;
} }
if (videoStream.IsAnamorphic ?? false)
{
return false;
}
// Can't stream copy if we're burning in subtitles // Can't stream copy if we're burning in subtitles
if (request.SubtitleStreamIndex.HasValue) if (request.SubtitleStreamIndex.HasValue)
{ {

View file

@ -43,7 +43,7 @@ namespace MediaBrowser.Providers.MediaInfo
var audio = (Audio)item; var audio = (Audio)item;
// Can't extract if we didn't find a video stream in the file // Can't extract if we didn't find a video stream in the file
if (!audio.HasEmbeddedImage) if (!audio.GetMediaSources(false).Take(1).SelectMany(i => i.MediaStreams).Any(i => i.Type == MediaStreamType.EmbeddedImage))
{ {
return Task.FromResult(new DynamicImageResponse { HasImage = false }); return Task.FromResult(new DynamicImageResponse { HasImage = false });
} }

View file

@ -103,9 +103,8 @@ namespace MediaBrowser.Providers.MediaInfo
{ {
var mediaStreams = mediaInfo.MediaStreams; var mediaStreams = mediaInfo.MediaStreams;
audio.FormatName = mediaInfo.Container; //audio.FormatName = mediaInfo.Container;
audio.TotalBitrate = mediaInfo.Bitrate; audio.TotalBitrate = mediaInfo.Bitrate;
audio.HasEmbeddedImage = mediaStreams.Any(i => i.Type == MediaStreamType.EmbeddedImage);
audio.RunTimeTicks = mediaInfo.RunTimeTicks; audio.RunTimeTicks = mediaInfo.RunTimeTicks;
audio.Size = mediaInfo.Size; audio.Size = mediaInfo.Size;

View file

@ -190,8 +190,8 @@ namespace MediaBrowser.Providers.MediaInfo
var mediaStreams = mediaInfo.MediaStreams; var mediaStreams = mediaInfo.MediaStreams;
video.TotalBitrate = mediaInfo.Bitrate; video.TotalBitrate = mediaInfo.Bitrate;
video.FormatName = (mediaInfo.Container ?? string.Empty) //video.FormatName = (mediaInfo.Container ?? string.Empty)
.Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase); // .Replace("matroska", "mkv", StringComparison.OrdinalIgnoreCase);
// For dvd's this may not always be accurate, so don't set the runtime if the item already has one // For dvd's this may not always be accurate, so don't set the runtime if the item already has one
var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks == null || video.RunTimeTicks.Value == 0; var needToSetRuntime = video.VideoType != VideoType.Dvd || video.RunTimeTicks == null || video.RunTimeTicks.Value == 0;

View file

@ -650,11 +650,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{ {
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false); await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
} }
else if (string.IsNullOrWhiteSpace(info.Etag))
{
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
}
else else
{ {
if (string.IsNullOrWhiteSpace(info.Etag) || !string.Equals(info.Etag, item.Etag, StringComparison.OrdinalIgnoreCase)) // Increment this whenver some internal change deems it necessary
var etag = info.Etag + "1";
if (!string.Equals(etag, item.Etag, StringComparison.OrdinalIgnoreCase))
{ {
item.Etag = info.Etag; item.Etag = etag;
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
} }
} }
@ -1162,15 +1169,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
foreach (var program in channelPrograms) foreach (var program in channelPrograms)
{ {
if (program.StartDate.Kind != DateTimeKind.Utc)
{
_logger.Error("{0} returned StartDate.DateTimeKind.{1} instead of UTC for program {2}", service.Name, program.StartDate.Kind.ToString(), program.Name);
}
else if (program.EndDate.Kind != DateTimeKind.Utc)
{
_logger.Error("{0} returned EndDate.DateTimeKind.{1} instead of UTC for program {2}", service.Name, program.EndDate.Kind.ToString(), program.Name);
}
var programItem = await GetProgram(program, channelId, currentChannel.ChannelType, service.Name, cancellationToken).ConfigureAwait(false); var programItem = await GetProgram(program, channelId, currentChannel.ChannelType, service.Name, cancellationToken).ConfigureAwait(false);
programs.Add(programItem.Id); programs.Add(programItem.Id);

View file

@ -232,6 +232,7 @@
<Compile Include="Localization\LocalizationManager.cs" /> <Compile Include="Localization\LocalizationManager.cs" />
<Compile Include="Logging\PatternsLogger.cs" /> <Compile Include="Logging\PatternsLogger.cs" />
<Compile Include="MediaEncoder\EncodingManager.cs" /> <Compile Include="MediaEncoder\EncodingManager.cs" />
<Compile Include="Notifications\IConfigurableNotificationService.cs" />
<Compile Include="Persistence\BaseSqliteRepository.cs" /> <Compile Include="Persistence\BaseSqliteRepository.cs" />
<Compile Include="Persistence\CleanDatabaseScheduledTask.cs" /> <Compile Include="Persistence\CleanDatabaseScheduledTask.cs" />
<Compile Include="Social\SharingManager.cs" /> <Compile Include="Social\SharingManager.cs" />

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Notifications
{
public interface IConfigurableNotificationService
{
bool IsHidden { get; }
bool IsEnabled(string notificationType);
}
}

View file

@ -3,10 +3,11 @@ using MediaBrowser.Controller.Notifications;
using MediaBrowser.Model.Notifications; using MediaBrowser.Model.Notifications;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System;
namespace MediaBrowser.Server.Implementations.Notifications namespace MediaBrowser.Server.Implementations.Notifications
{ {
public class InternalNotificationService : INotificationService public class InternalNotificationService : INotificationService, IConfigurableNotificationService
{ {
private readonly INotificationsRepository _repo; private readonly INotificationsRepository _repo;
@ -36,6 +37,24 @@ namespace MediaBrowser.Server.Implementations.Notifications
public bool IsEnabledForUser(User user) public bool IsEnabledForUser(User user)
{ {
return user.Policy.IsAdministrator;
}
public bool IsHidden
{
get { return true; }
}
public bool IsEnabled(string notificationType)
{
if (notificationType.IndexOf("playback", StringComparison.OrdinalIgnoreCase) != -1)
{
return false;
}
if (notificationType.IndexOf("newlibrarycontent", StringComparison.OrdinalIgnoreCase) != -1)
{
return false;
}
return true; return true;
} }
} }

View file

@ -230,8 +230,19 @@ namespace MediaBrowser.Server.Implementations.Notifications
private bool IsEnabled(INotificationService service, string notificationType) private bool IsEnabled(INotificationService service, string notificationType)
{ {
return string.IsNullOrEmpty(notificationType) || if (string.IsNullOrEmpty(notificationType))
GetConfiguration().IsServiceEnabled(service.Name, notificationType); {
return true;
}
var configurable = service as IConfigurableNotificationService;
if (configurable != null)
{
return configurable.IsEnabled(notificationType);
}
return GetConfiguration().IsServiceEnabled(service.Name, notificationType);
} }
public void AddParts(IEnumerable<INotificationService> services, IEnumerable<INotificationTypeFactory> notificationTypeFactories) public void AddParts(IEnumerable<INotificationService> services, IEnumerable<INotificationTypeFactory> notificationTypeFactories)
@ -268,7 +279,13 @@ namespace MediaBrowser.Server.Implementations.Notifications
public IEnumerable<NotificationServiceInfo> GetNotificationServices() public IEnumerable<NotificationServiceInfo> GetNotificationServices()
{ {
return _services.Select(i => new NotificationServiceInfo return _services.Where(i =>
{
var configurable = i as IConfigurableNotificationService;
return configurable == null || !configurable.IsHidden;
}).Select(i => new NotificationServiceInfo
{ {
Name = i.Name, Name = i.Name,
Id = i.Name.GetMD5().ToString("N") Id = i.Name.GetMD5().ToString("N")

View file

@ -72,7 +72,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _deletePeopleCommand; private IDbCommand _deletePeopleCommand;
private IDbCommand _savePersonCommand; private IDbCommand _savePersonCommand;
private const int LatestSchemaVersion = 7; private const int LatestSchemaVersion = 9;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class. /// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
@ -177,6 +177,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
_connection.AddColumn(_logger, "TypedBaseItems", "IsOffline", "BIT"); _connection.AddColumn(_logger, "TypedBaseItems", "IsOffline", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "LocationType", "Text"); _connection.AddColumn(_logger, "TypedBaseItems", "LocationType", "Text");
_connection.AddColumn(_logger, "TypedBaseItems", "IsSeries", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsLive", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsNews", "BIT");
_connection.AddColumn(_logger, "TypedBaseItems", "IsPremiere", "BIT");
PrepareStatements(); PrepareStatements();
_mediaStreamsRepository.Initialize(); _mediaStreamsRepository.Initialize();
@ -199,6 +204,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
"IsMovie", "IsMovie",
"IsSports", "IsSports",
"IsKids", "IsKids",
"IsSeries",
"IsLive",
"IsNews",
"IsPremiere",
"CommunityRating", "CommunityRating",
"CustomRating", "CustomRating",
"IndexNumber", "IndexNumber",
@ -222,6 +231,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
"IsKids", "IsKids",
"IsMovie", "IsMovie",
"IsSports", "IsSports",
"IsSeries",
"IsLive",
"IsNews",
"IsPremiere",
"CommunityRating", "CommunityRating",
"CustomRating", "CustomRating",
"IndexNumber", "IndexNumber",
@ -369,12 +382,20 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsKids; _saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsKids;
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsMovie; _saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsMovie;
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsSports; _saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsSports;
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsSeries;
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsLive;
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsNews;
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsPremiere;
} }
else else
{ {
_saveItemCommand.GetParameter(index++).Value = null; _saveItemCommand.GetParameter(index++).Value = null;
_saveItemCommand.GetParameter(index++).Value = null; _saveItemCommand.GetParameter(index++).Value = null;
_saveItemCommand.GetParameter(index++).Value = null; _saveItemCommand.GetParameter(index++).Value = null;
_saveItemCommand.GetParameter(index++).Value = null;
_saveItemCommand.GetParameter(index++).Value = null;
_saveItemCommand.GetParameter(index++).Value = null;
_saveItemCommand.GetParameter(index++).Value = null;
} }
_saveItemCommand.GetParameter(index++).Value = item.CommunityRating; _saveItemCommand.GetParameter(index++).Value = item.CommunityRating;
@ -563,26 +584,46 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
hasProgramAttributes.IsKids = reader.GetBoolean(8); hasProgramAttributes.IsKids = reader.GetBoolean(8);
} }
if (!reader.IsDBNull(9))
{
hasProgramAttributes.IsSeries = reader.GetBoolean(9);
}
if (!reader.IsDBNull(10))
{
hasProgramAttributes.IsLive = reader.GetBoolean(10);
}
if (!reader.IsDBNull(11))
{
hasProgramAttributes.IsNews = reader.GetBoolean(11);
}
if (!reader.IsDBNull(12))
{
hasProgramAttributes.IsPremiere = reader.GetBoolean(12);
}
} }
if (!reader.IsDBNull(9)) if (!reader.IsDBNull(13))
{ {
item.CommunityRating = reader.GetFloat(9); item.CommunityRating = reader.GetFloat(13);
} }
if (!reader.IsDBNull(10)) if (!reader.IsDBNull(14))
{ {
item.CustomRating = reader.GetString(10); item.CustomRating = reader.GetString(14);
} }
if (!reader.IsDBNull(11)) if (!reader.IsDBNull(15))
{ {
item.IndexNumber = reader.GetInt32(11); item.IndexNumber = reader.GetInt32(15);
} }
if (!reader.IsDBNull(12)) if (!reader.IsDBNull(16))
{ {
item.IsLocked = reader.GetBoolean(12); item.IsLocked = reader.GetBoolean(16);
} }
return item; return item;

View file

@ -173,6 +173,12 @@
<Content Include="dashboard-ui\components\imageuploader\imageuploader.template.html"> <Content Include="dashboard-ui\components\imageuploader\imageuploader.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\components\metadataeditor\metadataeditor.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\metadataeditor\metadataeditor.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\paperdialoghelper.js"> <Content Include="dashboard-ui\components\paperdialoghelper.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>