diff --git a/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Service2.cs b/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Service2.cs index 4563e26f..46ce731c 100644 --- a/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Service2.cs +++ b/OneShelf.Videos/OneShelf.Videos.BusinessLogic/Services/Service2.cs @@ -24,6 +24,13 @@ public Service2(ExtendedGooglePhotosService extendedGooglePhotosService, ILogger _videosDatabaseOperations = videosDatabaseOperations; } + public async Task> ListAlbums() + { + await _extendedGooglePhotosService.LoginAsync(); + var albums = await _extendedGooglePhotosService.GetAlbumsAsync(); + return albums.Select(x => x.title).ToList(); + } + public async Task SaveInventory() { await _extendedGooglePhotosService.LoginAsync(); diff --git a/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Commands/GetFileSize.cs b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Commands/GetFileSize.cs new file mode 100644 index 00000000..770f4bfa --- /dev/null +++ b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Commands/GetFileSize.cs @@ -0,0 +1,24 @@ +using OneShelf.Telegram.Model.CommandAttributes; +using OneShelf.Telegram.Model.Ios; +using OneShelf.Telegram.Services.Base; +using OneShelf.Videos.Database; + +namespace OneShelf.Videos.Telegram.Processor.Commands; + +[AdminCommand("get_file_size", "Файлик", "Посмотреть файл")] +public class GetFileSize : Command +{ + private readonly VideosDatabase _videosDatabase; + + public GetFileSize(Io io, VideosDatabase videosDatabase) + : base(io) + { + _videosDatabase = videosDatabase; + } + + protected override async Task ExecuteQuickly() + { + var path = Io.FreeChoice("Path to file:"); + Io.WriteLine(new FileInfo(path).Length.ToString()); + } +} \ No newline at end of file diff --git a/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Commands/ListAlbums.cs b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Commands/ListAlbums.cs new file mode 100644 index 00000000..75772ec8 --- /dev/null +++ b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Commands/ListAlbums.cs @@ -0,0 +1,32 @@ +using OneShelf.Telegram.Model.CommandAttributes; +using OneShelf.Telegram.Model.Ios; +using OneShelf.Telegram.Services.Base; +using OneShelf.Videos.BusinessLogic.Services; + +namespace OneShelf.Videos.Telegram.Processor.Commands; + +[AdminCommand("get_file_size", "Файлик", "Посмотреть файл")] +public class ListAlbums : Command +{ + private readonly Service2 _service2; + + public ListAlbums(Io io, Service2 service2) + : base(io) + { + _service2 = service2; + } + + protected override async Task ExecuteQuickly() + { + Scheduled(List()); + } + + private async Task List() + { + var albums = await _service2.ListAlbums(); + foreach (var album in albums) + { + Io.WriteLine(album); + } + } +} \ No newline at end of file diff --git a/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/ServiceCollectionExtensions.cs b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/ServiceCollectionExtensions.cs index e718f579..0436e3d7 100644 --- a/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/ServiceCollectionExtensions.cs +++ b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/ServiceCollectionExtensions.cs @@ -25,6 +25,8 @@ public static IServiceCollection AddProcessor(this IServiceCollection services, .AddCommand() .AddCommand() + .AddCommand() + .AddCommand() .AddPipelineHandlerInOrder() .AddPipelineHandlerInOrder() diff --git a/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Services/SingletonAbstractions.cs b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Services/SingletonAbstractions.cs index 92070bbf..7de614d5 100644 --- a/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Services/SingletonAbstractions.cs +++ b/OneShelf.Videos/OneShelf.Videos.Telegram.Processor/Services/SingletonAbstractions.cs @@ -12,6 +12,8 @@ public List> GetCommandsGrid() => [ typeof(Start), typeof(Help), typeof(ViewChats), + typeof(GetFileSize), + typeof(ListAlbums), ], [ typeof(UpdateCommands),