Skip to content

Commit 9761906

Browse files
committed
fea: add preload files on streaming option
1 parent 2906995 commit 9761906

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

TelegramDownloader/Data/FileService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ public async Task<String> CreateStrmFiles(string path, string dbName, string hos
11881188
if (FileExtensionTypeTest.isVideoExtension(file.Type) || FileExtensionTypeTest.isAudioExtension(file.Type))
11891189
{
11901190
string contenido = Path.Combine(host, "api/file/GetFileStream", dbName, file.Id, "file" + file.Type).Replace("\\", "/");
1191-
if (HelperService.bytesToMegaBytes(file.Size) < GeneralConfigStatic.config.MaxPreloadFileSizeInMb)
1191+
if (GeneralConfigStatic.config.PreloadFilesOnStream || HelperService.bytesToMegaBytes(file.Size) < GeneralConfigStatic.config.MaxPreloadFileSizeInMb)
11921192
{
11931193
contenido = Path.Combine(host, "api/file/GetFile", Uri.EscapeDataString(file.Name)).Replace("\\", "/") + $"?idChannel={dbName}&idFile={file.Id}";
11941194
}

TelegramDownloader/Models/GeneralConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class GeneralConfig
8484
public int MaxPreloadFileSizeInMb { get; set; } = 30;
8585
public bool ShouldShowCaptionPath { get; set; } = false;
8686
public bool ShouldShowLogInTerminal { get; set; } = false;
87+
public bool PreloadFilesOnStream { get; set; } = false;
8788
public bool ShouldShowPaginatedFileChannel { get; set; } = false;
8889
public bool hasFileManagerVirtualScroll { get; set; } = false;
8990
public List<long> FavouriteChannels { get; set; } = new List<long>();

TelegramDownloader/Pages/Config.razor

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,20 @@
7676
<InputCheckbox @bind-Value="Model!.ShouldShowCaptionPath" class="form-check-input" type="checkbox" id="CheckHash" />
7777
<label class="form-check-label" for="ShouldShowCaptionPath">Show relative path in Telegram msg caption</label>
7878
</div>
79-
80-
8179
</div>
8280

8381
<div>
8482
<div class="form-check form-switch">
8583
<InputCheckbox @bind-Value="Model!.hasFileManagerVirtualScroll" class="form-check-input" type="checkbox" id="hasFileManagerVirtualScroll" />
8684
<label class="form-check-label" for="hasFileManagerVirtualScroll">File manager virtual scroll</label>
8785
</div>
86+
</div>
8887

89-
88+
<div>
89+
<div class="form-check form-switch">
90+
<InputCheckbox @bind-Value="Model!.PreloadFilesOnStream" class="form-check-input" type="checkbox" id="PreloadFilesOnStream" />
91+
<label class="form-check-label" for="PreloadFilesOnStream">Preload Files on Stream</label>
92+
</div>
9093
</div>
9194

9295
<div>

0 commit comments

Comments
 (0)