mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 09:34:44 +01:00
update translations
This commit is contained in:
@@ -7,6 +7,7 @@ using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
@@ -154,7 +155,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
{
|
||||
try
|
||||
{
|
||||
await DownloadChannelItem(item, cancellationToken, path);
|
||||
await DownloadChannelItem(item, options, cancellationToken, path);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@@ -176,9 +177,18 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
}
|
||||
|
||||
private async Task DownloadChannelItem(BaseItemDto item,
|
||||
ChannelOptions channelOptions,
|
||||
CancellationToken cancellationToken,
|
||||
string path)
|
||||
{
|
||||
if (channelOptions.DownloadSizeLimit.HasValue)
|
||||
{
|
||||
if (IsSizeLimitReached(path, channelOptions.DownloadSizeLimit.Value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var sources = await _manager.GetChannelItemMediaSources(item.Id, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
@@ -253,6 +263,25 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsSizeLimitReached(string path, double gbLimit)
|
||||
{
|
||||
var byteLimit = gbLimit*1000000000;
|
||||
|
||||
long total = 0;
|
||||
|
||||
foreach (var file in new DirectoryInfo(path).EnumerateFiles("*", SearchOption.AllDirectories))
|
||||
{
|
||||
total += file.Length;
|
||||
|
||||
if (total >= byteLimit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task RefreshMediaSourceItems(IEnumerable<MediaSourceInfo> items, CancellationToken cancellationToken)
|
||||
{
|
||||
foreach (var item in items)
|
||||
|
||||
Reference in New Issue
Block a user