From 49ac494969537a3ffc8b7bd98fa1156da4cd7d3a Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Wed, 15 Jun 2022 03:04:26 -0500 Subject: [PATCH] Fixed some things --- Tesses.YouTubeDownloader/IStorage.cs | 2 +- Tesses.YouTubeDownloader/TYTDFilesystem.cs | 32 +++++++++++++++++++ .../TYTDIDownloaderStorageProxy.cs | 7 ++++ .../Tesses.YouTubeDownloader.csproj | 6 ++-- .../Tesses.YouTubeDownloader.sln | 17 ---------- 5 files changed, 43 insertions(+), 21 deletions(-) delete mode 100644 Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.sln diff --git a/Tesses.YouTubeDownloader/IStorage.cs b/Tesses.YouTubeDownloader/IStorage.cs index 0f7e9cb..827fc63 100644 --- a/Tesses.YouTubeDownloader/IStorage.cs +++ b/Tesses.YouTubeDownloader/IStorage.cs @@ -54,6 +54,6 @@ namespace Tesses.YouTubeDownloader Task DownloadVideoOnlyAsync(SavedVideo video,CancellationToken token,IProgress progress,bool report=true); Task MoveLegacyStreams(SavedVideo video,BestStreams streams); - + void StartLoop(CancellationToken token=default(CancellationToken)); } } \ No newline at end of file diff --git a/Tesses.YouTubeDownloader/TYTDFilesystem.cs b/Tesses.YouTubeDownloader/TYTDFilesystem.cs index 7829a3d..b40eb76 100644 --- a/Tesses.YouTubeDownloader/TYTDFilesystem.cs +++ b/Tesses.YouTubeDownloader/TYTDFilesystem.cs @@ -85,18 +85,34 @@ namespace Tesses.YouTubeDownloader public override async IAsyncEnumerable EnumerateDirectoriesAsync(string path) { + if(string.IsNullOrWhiteSpace(path)) + { + foreach(var item in Directory.EnumerateDirectories(Environment.CurrentDirectory)) + { + yield return await Task.FromResult(Path.GetFileName(item)); + } + }else{ foreach(var dir in Directory.EnumerateDirectories(path)) { yield return await Task.FromResult(Path.GetFileName(dir)); } + } } public override async IAsyncEnumerable EnumerateFilesAsync(string path) { + if(string.IsNullOrWhiteSpace(path)) + { + foreach(var item in Directory.EnumerateFiles(Environment.CurrentDirectory)) + { + yield return await Task.FromResult(Path.GetFileName(item)); + } + }else{ foreach(var file in Directory.EnumerateFiles(path)) { yield return await Task.FromResult(Path.GetFileName(file)); } + } } public override async Task FileExistsAsync(string path) @@ -217,18 +233,34 @@ namespace Tesses.YouTubeDownloader public override async IAsyncEnumerable EnumerateDirectoriesAsync(string path) { + if(string.IsNullOrWhiteSpace(path)) + { + foreach(var item in Directory.EnumerateDirectories(_path)) + { + yield return await Task.FromResult(Path.GetFileName(item)); + } + }else{ foreach(var dir in Directory.EnumerateDirectories(GetPath(path))) { yield return await Task.FromResult(Path.GetFileName(dir)); } + } } public override async IAsyncEnumerable EnumerateFilesAsync(string path) { + if(string.IsNullOrWhiteSpace(path)) + { + foreach(var item in Directory.EnumerateFiles(_path)) + { + yield return await Task.FromResult(Path.GetFileName(item)); + } + }else{ foreach(var file in Directory.EnumerateFiles(GetPath(path))) { yield return await Task.FromResult(Path.GetFileName(file)); } + } } public override async Task FileExistsAsync(string path) diff --git a/Tesses.YouTubeDownloader/TYTDIDownloaderStorageProxy.cs b/Tesses.YouTubeDownloader/TYTDIDownloaderStorageProxy.cs index 98fa700..983035d 100644 --- a/Tesses.YouTubeDownloader/TYTDIDownloaderStorageProxy.cs +++ b/Tesses.YouTubeDownloader/TYTDIDownloaderStorageProxy.cs @@ -573,6 +573,13 @@ namespace Tesses.YouTubeDownloader e.Unsubscribe(id); }); } + + public void StartLoop(CancellationToken token = default) + { + StorageAsStorage((e)=>{ + e.StartLoop(token); + }); + } } public class DownloaderMigration diff --git a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj b/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj index 5704313..ad6540e 100644 --- a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj +++ b/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj @@ -7,9 +7,9 @@ Tesses.YouTubeDownloader Mike Nolan Tesses - 1.1.0 - 1.1.0 - 1.1.0 + 1.1.1 + 1.1.1 + 1.1.1 A YouTube Downloader LGPL-3.0-only true diff --git a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.sln b/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.sln deleted file mode 100644 index 77f35a6..0000000 --- a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.sln +++ /dev/null @@ -1,17 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tesses.YouTubeDownloader", "Tesses.YouTubeDownloader.csproj", "{77B23470-768E-4927-8F09-20357D2E8032}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {77B23470-768E-4927-8F09-20357D2E8032}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {77B23470-768E-4927-8F09-20357D2E8032}.Debug|Any CPU.Build.0 = Debug|Any CPU - {77B23470-768E-4927-8F09-20357D2E8032}.Release|Any CPU.ActiveCfg = Release|Any CPU - {77B23470-768E-4927-8F09-20357D2E8032}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal