Exemple #1
0
        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));
        }
Exemple #2
0
 public MediaInfoFactory(OpenSubtitlesClient api, ILogger logger)
 {
     _logger = logger;
     _api    = api;
 }
Exemple #3
0
 public SearchCommand(ILogger <SearchCommand> logger, OpenSubtitlesClient apiClient)
     : base(logger, apiClient)
 {
 }
Exemple #4
0
 public RenameCommand(ILogger <RenameCommand> logger, OpenSubtitlesClient apiClient)
     : base(logger, apiClient)
 {
     _mifactory = new MediaInfoFactory(_apiClient, logger);
 }
Exemple #5
0
 public BaseCommand(ILogger <BaseCommand> logger, OpenSubtitlesClient apiClient)
 {
     _logger    = logger;
     _apiClient = apiClient;
 }