mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 09:04:42 +01:00
update program queries
This commit is contained in:
@@ -219,7 +219,9 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
|
||||
foreach (var itemId in itemIds)
|
||||
{
|
||||
var child = collection.LinkedChildren.FirstOrDefault(i => i.ItemId.HasValue && i.ItemId.Value == itemId);
|
||||
var childItem = _libraryManager.GetItemById(itemId);
|
||||
|
||||
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value == itemId) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
@@ -228,47 +230,15 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
|
||||
list.Add(child);
|
||||
|
||||
var childItem = _libraryManager.GetItemById(itemId);
|
||||
|
||||
if (childItem != null)
|
||||
{
|
||||
itemList.Add(childItem);
|
||||
}
|
||||
}
|
||||
|
||||
var shortcutFiles = _fileSystem
|
||||
.GetFilePaths(collection.Path)
|
||||
.Where(i => _fileSystem.IsShortcut(i))
|
||||
.ToList();
|
||||
|
||||
var shortcutFilesToDelete = list.Where(child => !string.IsNullOrWhiteSpace(child.Path) && child.Type == LinkedChildType.Shortcut)
|
||||
.Select(child => shortcutFiles.FirstOrDefault(i => string.Equals(child.Path, _fileSystem.ResolveShortcut(i), StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToList();
|
||||
|
||||
foreach (var file in shortcutFilesToDelete)
|
||||
foreach (var child in list)
|
||||
{
|
||||
_iLibraryMonitor.ReportFileSystemChangeBeginning(file);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var file in shortcutFilesToDelete)
|
||||
{
|
||||
_fileSystem.DeleteFile(file);
|
||||
}
|
||||
|
||||
foreach (var child in list)
|
||||
{
|
||||
collection.LinkedChildren.Remove(child);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
foreach (var file in shortcutFilesToDelete)
|
||||
{
|
||||
_iLibraryMonitor.ReportFileSystemChangeComplete(file, false);
|
||||
}
|
||||
collection.LinkedChildren.Remove(child);
|
||||
}
|
||||
|
||||
collection.UpdateRatingToContent();
|
||||
|
||||
@@ -105,6 +105,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
var includeItemTypes = (query.IncludeItemTypes ?? new string[] { }).ToList();
|
||||
|
||||
excludeItemTypes.Add(typeof(Year).Name);
|
||||
excludeItemTypes.Add(typeof(Folder).Name);
|
||||
|
||||
if (query.IncludeGenres && (includeItemTypes.Count == 0 || includeItemTypes.Contains("Genre", StringComparer.OrdinalIgnoreCase)))
|
||||
{
|
||||
|
||||
@@ -882,7 +882,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
}
|
||||
|
||||
private readonly SemaphoreSlim _liveStreamsSemaphore = new SemaphoreSlim(1, 1);
|
||||
private readonly Dictionary<string, LiveStream> _liveStreams = new Dictionary<string, LiveStream>();
|
||||
private readonly List<LiveStream> _liveStreams = new List<LiveStream>();
|
||||
|
||||
public async Task<MediaSourceInfo> GetChannelStream(string channelId, string streamId, CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -921,7 +921,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
try
|
||||
{
|
||||
return _liveStreams.Values
|
||||
return _liveStreams
|
||||
.FirstOrDefault(i => string.Equals(i.UniqueId, uniqueId, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
finally
|
||||
@@ -937,16 +937,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
await _liveStreamsSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var result = _liveStreams.Values.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));
|
||||
var result = _liveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (result != null && result.EnableStreamSharing)
|
||||
{
|
||||
result.ConsumerCount++;
|
||||
var openedMediaSource = CloneMediaSource(result.OpenedMediaSource, result.EnableStreamSharing);
|
||||
result.SharedStreamIds.Add(openedMediaSource.Id);
|
||||
_liveStreamsSemaphore.Release();
|
||||
|
||||
_logger.Info("Live stream {0} consumer count is now {1}", streamId, result.ConsumerCount);
|
||||
|
||||
var openedMediaSource = CloneMediaSource(result.OpenedMediaSource, result.EnableStreamSharing);
|
||||
_liveStreamsSemaphore.Release();
|
||||
return new Tuple<LiveStream, MediaSourceInfo, ITunerHost>(result, openedMediaSource, result.TunerHost);
|
||||
}
|
||||
|
||||
@@ -960,9 +960,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
var openedMediaSource = CloneMediaSource(result.OpenedMediaSource, result.EnableStreamSharing);
|
||||
|
||||
_liveStreams[openedMediaSource.Id] = result;
|
||||
result.SharedStreamIds.Add(openedMediaSource.Id);
|
||||
_liveStreams.Add(result);
|
||||
|
||||
result.ConsumerCount++;
|
||||
result.TunerHost = hostInstance;
|
||||
result.OriginalStreamId = streamId;
|
||||
|
||||
@@ -1047,16 +1047,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
try
|
||||
{
|
||||
LiveStream stream;
|
||||
if (_liveStreams.TryGetValue(id, out stream))
|
||||
var stream = _liveStreams.FirstOrDefault(i => i.SharedStreamIds.Contains(id));
|
||||
if (stream != null)
|
||||
{
|
||||
stream.ConsumerCount--;
|
||||
stream.SharedStreamIds.Remove(id);
|
||||
|
||||
_logger.Info("Live stream {0} consumer count is now {1}", id, stream.ConsumerCount);
|
||||
|
||||
if (stream.ConsumerCount <= 0)
|
||||
{
|
||||
_liveStreams.Remove(id);
|
||||
_liveStreams.Remove(stream);
|
||||
|
||||
_logger.Info("Closing live stream {0}", id);
|
||||
|
||||
|
||||
@@ -871,7 +871,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
SortOrder = query.SortOrder ?? SortOrder.Ascending,
|
||||
EnableTotalRecordCount = query.EnableTotalRecordCount,
|
||||
TopParentIds = new[] { topFolder.Id.ToString("N") },
|
||||
Fields = options.Fields
|
||||
DtoOptions = options
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.SeriesTimerId))
|
||||
@@ -940,7 +940,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
EnableTotalRecordCount = query.EnableTotalRecordCount,
|
||||
SortBy = new[] { ItemSortBy.StartDate },
|
||||
TopParentIds = new[] { topFolder.Id.ToString("N") },
|
||||
Fields = options.Fields
|
||||
DtoOptions = options
|
||||
};
|
||||
|
||||
if (query.Limit.HasValue)
|
||||
@@ -1566,7 +1566,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
IncludeItemTypes = includeItemTypes.ToArray(),
|
||||
ExcludeItemTypes = excludeItemTypes.ToArray(),
|
||||
Genres = genres.ToArray(),
|
||||
Fields = dtoOptions.Fields
|
||||
DtoOptions = dtoOptions
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1857,11 +1857,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
}
|
||||
index++;
|
||||
|
||||
if (!reader.IsDBNull(index))
|
||||
if (query.DtoOptions.EnableImages)
|
||||
{
|
||||
DeserializeImages(reader.GetString(index), item);
|
||||
if (!reader.IsDBNull(index))
|
||||
{
|
||||
DeserializeImages(reader.GetString(index), item);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
|
||||
if (query.HasField(ItemFields.ProductionLocations))
|
||||
{
|
||||
@@ -2259,6 +2262,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
}
|
||||
}
|
||||
|
||||
if (!query.DtoOptions.EnableImages)
|
||||
{
|
||||
list.Remove("Images");
|
||||
}
|
||||
|
||||
if (EnableJoinUserData(query))
|
||||
{
|
||||
list.Add("UserDataDb.UserData.UserId");
|
||||
|
||||
Reference in New Issue
Block a user