mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 00:55:13 +01:00
update metadata editor
This commit is contained in:
@@ -650,11 +650,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(info.Etag))
|
||||
{
|
||||
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1162,15 +1169,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
|
||||
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);
|
||||
|
||||
programs.Add(programItem.Id);
|
||||
|
||||
@@ -232,6 +232,7 @@
|
||||
<Compile Include="Localization\LocalizationManager.cs" />
|
||||
<Compile Include="Logging\PatternsLogger.cs" />
|
||||
<Compile Include="MediaEncoder\EncodingManager.cs" />
|
||||
<Compile Include="Notifications\IConfigurableNotificationService.cs" />
|
||||
<Compile Include="Persistence\BaseSqliteRepository.cs" />
|
||||
<Compile Include="Persistence\CleanDatabaseScheduledTask.cs" />
|
||||
<Compile Include="Social\SharingManager.cs" />
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,11 @@ using MediaBrowser.Controller.Notifications;
|
||||
using MediaBrowser.Model.Notifications;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Notifications
|
||||
{
|
||||
public class InternalNotificationService : INotificationService
|
||||
public class InternalNotificationService : INotificationService, IConfigurableNotificationService
|
||||
{
|
||||
private readonly INotificationsRepository _repo;
|
||||
|
||||
@@ -36,6 +37,24 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +230,19 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
||||
|
||||
private bool IsEnabled(INotificationService service, string notificationType)
|
||||
{
|
||||
return string.IsNullOrEmpty(notificationType) ||
|
||||
GetConfiguration().IsServiceEnabled(service.Name, notificationType);
|
||||
if (string.IsNullOrEmpty(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)
|
||||
@@ -268,7 +279,13 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
||||
|
||||
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,
|
||||
Id = i.Name.GetMD5().ToString("N")
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
private IDbCommand _deletePeopleCommand;
|
||||
private IDbCommand _savePersonCommand;
|
||||
|
||||
private const int LatestSchemaVersion = 7;
|
||||
private const int LatestSchemaVersion = 9;
|
||||
|
||||
/// <summary>
|
||||
/// 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", "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();
|
||||
|
||||
_mediaStreamsRepository.Initialize();
|
||||
@@ -199,6 +204,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
"IsMovie",
|
||||
"IsSports",
|
||||
"IsKids",
|
||||
"IsSeries",
|
||||
"IsLive",
|
||||
"IsNews",
|
||||
"IsPremiere",
|
||||
"CommunityRating",
|
||||
"CustomRating",
|
||||
"IndexNumber",
|
||||
@@ -222,6 +231,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
"IsKids",
|
||||
"IsMovie",
|
||||
"IsSports",
|
||||
"IsSeries",
|
||||
"IsLive",
|
||||
"IsNews",
|
||||
"IsPremiere",
|
||||
"CommunityRating",
|
||||
"CustomRating",
|
||||
"IndexNumber",
|
||||
@@ -369,12 +382,20 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsKids;
|
||||
_saveItemCommand.GetParameter(index++).Value = hasProgramAttributes.IsMovie;
|
||||
_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
|
||||
{
|
||||
_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;
|
||||
@@ -563,26 +584,46 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
{
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user