-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds new features, optimizations and under-the-hood changes. In this PR includes the changes: [Feature] Construct series from command [Feature] Support multiple IDs to be processed on `get` command [Improvements] Skip already existing files upon retrying after failure or cancel [Improvements] Add configuration options (see wiki) [Framework] Update dependencies to latest [Framework] Migrates to .NET 7 [Code] Refactored command parsers [Code] Refactored downloader [Fix] Fixes issue where when tachiyomi layout is enabled may produce empty directory compression. [Docs] Moved docs to wiki
- Loading branch information
Showing
114 changed files
with
2,537 additions
and
1,799 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using asuka.Commandline; | ||
using asuka.Commandline.Options; | ||
using CommandLine; | ||
using asuka.CommandOptions; | ||
using asuka.CommandParsers; | ||
using asuka.Output; | ||
using asuka.Output.Writer; | ||
|
||
namespace asuka; | ||
|
||
public class AsukaApplication | ||
{ | ||
private readonly IGetCommandService _getCommand; | ||
private readonly IRecommendCommandService _recommendCommand; | ||
private readonly ISearchCommandService _searchCommand; | ||
private readonly IRandomCommandService _randomCommand; | ||
private readonly IFileCommandService _fileCommand; | ||
private readonly IConsoleWriter _console; | ||
private readonly IConfigureCommand _configureCommand; | ||
private readonly ICommandLineParserFactory _command; | ||
|
||
public AsukaApplication( | ||
IGetCommandService getCommand, | ||
IRecommendCommandService recommendCommand, | ||
IConsoleWriter console, | ||
ISearchCommandService searchCommand, | ||
IRandomCommandService randomCommand, | ||
IFileCommandService fileCommand, | ||
IConfigureCommand configureCommand) | ||
public AsukaApplication(IConsoleWriter console, ICommandLineParserFactory command) | ||
{ | ||
_getCommand = getCommand; | ||
_recommendCommand = recommendCommand; | ||
_console = console; | ||
_searchCommand = searchCommand; | ||
_randomCommand = randomCommand; | ||
_fileCommand = fileCommand; | ||
_configureCommand = configureCommand; | ||
_command = command; | ||
} | ||
|
||
public async Task RunAsync(IEnumerable<string> args) | ||
{ | ||
try | ||
{ | ||
var parser = Parser.Default | ||
.ParseArguments<GetOptions, RecommendOptions, SearchOptions, RandomOptions, FileCommandOptions, ConfigureOptions>(args); | ||
await parser.MapResult( | ||
async (GetOptions opts) => { await _getCommand.RunAsync(opts); }, | ||
async (RecommendOptions opts) => { await _recommendCommand.RunAsync(opts); }, | ||
async (SearchOptions opts) => { await _searchCommand.RunAsync(opts); }, | ||
async (RandomOptions opts) => { await _randomCommand.RunAsync(opts); }, | ||
async (FileCommandOptions opts) => { await _fileCommand.RunAsync(opts); }, | ||
async (ConfigureOptions opts) => { await _configureCommand.RunAsync(opts); }, | ||
_ => Task.FromResult(1)); | ||
_console.SuccessLine("Task completed."); | ||
} | ||
catch (Exception err) | ||
{ | ||
_console.ErrorLine($"An exception occured. Error: {err.Message}"); | ||
_console.ErrorLine("Full Error:"); | ||
_console.WriteLine(err); | ||
} | ||
var parser = Parser.Default | ||
.ParseArguments<GetOptions, RecommendOptions, SearchOptions, RandomOptions, FileCommandOptions, ConfigureOptions, SeriesCreatorCommandOptions, CookieConfigureOptions>(args); | ||
await parser.MapResult( | ||
async (GetOptions opts) => { await RunCommand(opts, CommandLineParserTokens.Get); }, | ||
async (RecommendOptions opts) => { await RunCommand(opts, CommandLineParserTokens.Recommend); }, | ||
async (SearchOptions opts) => { await RunCommand(opts, CommandLineParserTokens.Search); }, | ||
async (RandomOptions opts) => { await RunCommand(opts, CommandLineParserTokens.Random); }, | ||
async (FileCommandOptions opts) => { await RunCommand(opts, CommandLineParserTokens.File); }, | ||
async (ConfigureOptions opts) => { await RunCommand(opts, CommandLineParserTokens.Configure); }, | ||
async (SeriesCreatorCommandOptions opts) => { await RunCommand(opts, CommandLineParserTokens.Series); }, | ||
async (CookieConfigureOptions opts) => { await RunCommand(opts, CommandLineParserTokens.Cookie); }, | ||
errors => | ||
{ | ||
foreach (var error in errors) | ||
{ | ||
_console.ErrorLine($"An error occured. Type: {error.Tag}"); | ||
} | ||
return Task.FromResult(1); | ||
}); | ||
} | ||
|
||
private async Task RunCommand(object opts, CommandLineParserTokens token) | ||
{ | ||
var service = _command.GetInstance(token); | ||
await service.RunAsync(opts); | ||
|
||
_console.SuccessLine("Task completed."); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.