encode with qsv

This commit is contained in:
Luke Pulverenti
2015-11-06 10:02:22 -05:00
parent 6aa3313bc0
commit ce34c35b94
43 changed files with 317 additions and 226 deletions

View File

@@ -104,6 +104,11 @@ namespace MediaBrowser.Server.Implementations.Channels
.OrderBy(i => i.Name);
}
public IEnumerable<Guid> GetInstalledChannelIds()
{
return GetAllChannels().Select(i => GetInternalChannelId(i.Name));
}
public Task<QueryResult<Channel>> GetChannelsInternal(ChannelQuery query, CancellationToken cancellationToken)
{
var user = string.IsNullOrWhiteSpace(query.UserId)
@@ -416,20 +421,7 @@ namespace MediaBrowser.Server.Implementations.Channels
var path = Channel.GetInternalMetadataPath(_config.ApplicationPaths.InternalMetadataPath, id);
var isNew = 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 forceUpdate = false;
var item = _libraryManager.GetItemById(id) as Channel;
var channelId = channelInfo.Name.GetMD5().ToString("N");
@@ -441,23 +433,27 @@ namespace MediaBrowser.Server.Implementations.Channels
Name = channelInfo.Name,
Id = id,
DateCreated = _fileSystem.GetCreationTimeUtc(path),
DateModified = _fileSystem.GetLastWriteTimeUtc(path),
Path = path,
ChannelId = channelId
DateModified = _fileSystem.GetLastWriteTimeUtc(path)
};
isNew = true;
}
if (!string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase))
if (!string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
{
isNew = true;
}
item.Path = path;
if (!string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase))
{
forceUpdate = true;
}
item.ChannelId = channelId;
if (item.ParentId != parentFolderId)
{
isNew = true;
forceUpdate = true;
}
item.ParentId = parentFolderId;
@@ -469,13 +465,17 @@ namespace MediaBrowser.Server.Implementations.Channels
{
item.Name = channelInfo.Name;
}
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem)
if (isNew)
{
ForceSave = isNew
}, cancellationToken);
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
}
else if (forceUpdate)
{
await item.UpdateToRepository(ItemUpdateType.None, cancellationToken).ConfigureAwait(false);
}
await item.RefreshMetadata(new MetadataRefreshOptions(_fileSystem), cancellationToken);
return item;
}
@@ -1281,7 +1281,7 @@ namespace MediaBrowser.Server.Implementations.Channels
if (!string.Equals(channelItem.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase))
{
isNew = true;
forceUpdate = true;
}
channelItem.ExternalId = info.Id;