mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 10:29:01 -07:00
fix merge conflict
This commit is contained in:
parent
170f463664
commit
02aee9dc90
@ -104,11 +104,6 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
.OrderBy(i => i.Name);
|
.OrderBy(i => i.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Guid> GetInstalledChannelIds()
|
|
||||||
{
|
|
||||||
return GetAllChannels().Select(i => GetInternalChannelId(i.Name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<QueryResult<Channel>> GetChannelsInternal(ChannelQuery query, CancellationToken cancellationToken)
|
public Task<QueryResult<Channel>> GetChannelsInternal(ChannelQuery query, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var user = string.IsNullOrWhiteSpace(query.UserId)
|
var user = string.IsNullOrWhiteSpace(query.UserId)
|
||||||
@ -413,15 +408,25 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
|
|
||||||
private async Task<Channel> GetChannel(IChannel channelInfo, CancellationToken cancellationToken)
|
private async Task<Channel> GetChannel(IChannel channelInfo, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var parentFolder = await GetInternalChannelFolder(cancellationToken).ConfigureAwait(false);
|
|
||||||
var parentFolderId = parentFolder.Id;
|
|
||||||
|
|
||||||
var id = GetInternalChannelId(channelInfo.Name);
|
var id = GetInternalChannelId(channelInfo.Name);
|
||||||
|
|
||||||
var path = Channel.GetInternalMetadataPath(_config.ApplicationPaths.InternalMetadataPath, id);
|
var path = Channel.GetInternalMetadataPath(_config.ApplicationPaths.InternalMetadataPath, id);
|
||||||
|
|
||||||
var isNew = false;
|
var isNew = false;
|
||||||
var forceUpdate = false;
|
|
||||||
|
if (!_fileSystem.DirectoryExists(path))
|
||||||
|
{
|
||||||
|
_logger.Debug("Creating directory {0}", path);
|
||||||
|
|
||||||
|
_fileSystem.CreateDirectory(path);
|
||||||
|
|
||||||
|
if (!_fileSystem.DirectoryExists(path))
|
||||||
|
{
|
||||||
|
throw new IOException("Path not created: " + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
isNew = true;
|
||||||
|
}
|
||||||
|
|
||||||
var item = _libraryManager.GetItemById(id) as Channel;
|
var item = _libraryManager.GetItemById(id) as Channel;
|
||||||
var channelId = channelInfo.Name.GetMD5().ToString("N");
|
var channelId = channelInfo.Name.GetMD5().ToString("N");
|
||||||
@ -433,29 +438,18 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
Name = channelInfo.Name,
|
Name = channelInfo.Name,
|
||||||
Id = id,
|
Id = id,
|
||||||
DateCreated = _fileSystem.GetCreationTimeUtc(path),
|
DateCreated = _fileSystem.GetCreationTimeUtc(path),
|
||||||
DateModified = _fileSystem.GetLastWriteTimeUtc(path)
|
DateModified = _fileSystem.GetLastWriteTimeUtc(path),
|
||||||
|
Path = path,
|
||||||
|
ChannelId = channelId
|
||||||
};
|
};
|
||||||
|
|
||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
isNew = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
item.Path = path;
|
|
||||||
|
|
||||||
if (!string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
forceUpdate = true;
|
|
||||||
}
|
|
||||||
item.ChannelId = channelId;
|
|
||||||
|
|
||||||
if (item.ParentId != parentFolderId)
|
|
||||||
{
|
|
||||||
forceUpdate = true;
|
|
||||||
}
|
|
||||||
item.ParentId = parentFolderId;
|
|
||||||
|
|
||||||
item.OfficialRating = GetOfficialRating(channelInfo.ParentalRating);
|
item.OfficialRating = GetOfficialRating(channelInfo.ParentalRating);
|
||||||
item.Overview = channelInfo.Description;
|
item.Overview = channelInfo.Description;
|
||||||
@ -465,17 +459,13 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
{
|
{
|
||||||
item.Name = channelInfo.Name;
|
item.Name = channelInfo.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNew)
|
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
|
||||||
{
|
{
|
||||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
ForceSave = isNew
|
||||||
}
|
|
||||||
else if (forceUpdate)
|
}, cancellationToken);
|
||||||
{
|
|
||||||
await item.UpdateToRepository(ItemUpdateType.None, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem), cancellationToken);
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1235,7 +1225,6 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
{
|
{
|
||||||
BaseItem item;
|
BaseItem item;
|
||||||
bool isNew;
|
bool isNew;
|
||||||
bool forceUpdate = false;
|
|
||||||
|
|
||||||
if (info.Type == ChannelItemType.Folder)
|
if (info.Type == ChannelItemType.Folder)
|
||||||
{
|
{
|
||||||
@ -1265,26 +1254,25 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
item.ProductionYear = info.ProductionYear;
|
item.ProductionYear = info.ProductionYear;
|
||||||
item.ProviderIds = info.ProviderIds;
|
item.ProviderIds = info.ProviderIds;
|
||||||
item.OfficialRating = info.OfficialRating;
|
item.OfficialRating = info.OfficialRating;
|
||||||
|
|
||||||
item.DateCreated = info.DateCreated ?? DateTime.UtcNow;
|
item.DateCreated = info.DateCreated ?? DateTime.UtcNow;
|
||||||
item.Tags = info.Tags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var channelItem = (IChannelItem)item;
|
var channelItem = (IChannelItem)item;
|
||||||
|
|
||||||
channelItem.ChannelId = internalChannelId.ToString("N");
|
channelItem.ChannelId = internalChannelId.ToString("N");
|
||||||
|
|
||||||
if (item.ParentId != internalChannelId)
|
|
||||||
{
|
|
||||||
forceUpdate = true;
|
|
||||||
}
|
|
||||||
item.ParentId = internalChannelId;
|
|
||||||
|
|
||||||
if (!string.Equals(channelItem.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(channelItem.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
forceUpdate = true;
|
isNew = true;
|
||||||
}
|
}
|
||||||
channelItem.ExternalId = info.Id;
|
channelItem.ExternalId = info.Id;
|
||||||
|
|
||||||
|
if (isNew)
|
||||||
|
{
|
||||||
|
channelItem.Tags = info.Tags;
|
||||||
|
}
|
||||||
|
|
||||||
var channelMediaItem = item as IChannelMediaItem;
|
var channelMediaItem = item as IChannelMediaItem;
|
||||||
|
|
||||||
if (channelMediaItem != null)
|
if (channelMediaItem != null)
|
||||||
@ -1312,10 +1300,6 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
await _libraryManager.UpdatePeople(item, info.People ?? new List<PersonInfo>()).ConfigureAwait(false);
|
await _libraryManager.UpdatePeople(item, info.People ?? new List<PersonInfo>()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (forceUpdate)
|
|
||||||
{
|
|
||||||
await item.UpdateToRepository(ItemUpdateType.None, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user