public static async Task <int> Main(string[] args) { var config = new ConfigurationBuilder().AddJsonFile("app.config").Build(); var hostBuilder = new HostBuilder(); hostBuilder.ConfigureLogging((context, builder) => { builder.AddConsole(); }); try { var api = new OpenSubtitlesClient(); var openSubtitlesOptions = new OpenSubtitlesOptions(); config.GetSection(OpenSubtitlesOptions.OpenSubtitles).Bind(openSubtitlesOptions); await api.LogInAsync(openSubtitlesOptions.Language, openSubtitlesOptions.Agent, openSubtitlesOptions.Username, openSubtitlesOptions.Password); hostBuilder.ConfigureServices(builder => { builder.AddSingleton <OpenSubtitlesClient>(api); }); } catch (Exception ex) { OutputExtensions.WriteError(ex.Message); Environment.Exit(0); } return(await hostBuilder.RunCommandLineApplicationAsync <Program>(args)); }
public MediaInfoFactory(OpenSubtitlesClient api, ILogger logger) { _logger = logger; _api = api; }
public SearchCommand(ILogger <SearchCommand> logger, OpenSubtitlesClient apiClient) : base(logger, apiClient) { }
public RenameCommand(ILogger <RenameCommand> logger, OpenSubtitlesClient apiClient) : base(logger, apiClient) { _mifactory = new MediaInfoFactory(_apiClient, logger); }
public BaseCommand(ILogger <BaseCommand> logger, OpenSubtitlesClient apiClient) { _logger = logger; _apiClient = apiClient; }