Esempio n. 1
0
        static int Main(string[] args)
        {
            Mapper.Initialize(cfg => cfg.AddProfile<OSDbProfile>());

            client = new OSDbClient(OSDbClient.DefaultUserAgent);
            options = new SubtleOptions();
            CommandLine.Parser.Default.ParseArgumentsStrict(args, options);

            if (string.IsNullOrEmpty(options.Path))
            {
                Console.WriteLine("Missing path.");
                Console.WriteLine(options.GetUsage());
                return 1;
            }

            language = OSDbConfig.Languages.SingleOrDefault(l =>
                options.Language.Equals(l.Iso6391, StringComparison.OrdinalIgnoreCase) ||
                options.Language.Equals(l.Iso6392, StringComparison.OrdinalIgnoreCase));

            if (language == null)
            {
                Console.WriteLine("Unrecognized language code.");
                Console.WriteLine(options.GetUsage());
                return 1;
            }

            return MainAsync().GetAwaiter().GetResult();
        }
Esempio n. 2
0
        public AboutForm(OSDbClient osdbClient, IGitHubClient githubClient)
        {
            this.osdbClient = osdbClient;
            this.githubClient = githubClient;
            InitializeComponent();

            LoadSubtleInfo();
            LoadServerInfo();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            client = new OSDbClient(OSDbClient.DefaultUserAgent);
            options = new SubtleOptions();
            CommandLine.Parser.Default.ParseArgumentsStrict(args, options);

            if (string.IsNullOrEmpty(options.Path))
            {
                Console.WriteLine("Missing path.");
                Console.WriteLine(options.GetUsage());
                Environment.Exit(1);
            }

            language = OSDbConfig.Languages.SingleOrDefault(l =>
                options.Language.Equals(l.Iso6391, StringComparison.OrdinalIgnoreCase) ||
                options.Language.Equals(l.Iso6392, StringComparison.OrdinalIgnoreCase));

            if (language == null)
            {
                Console.WriteLine("Unrecognized language code.");
                Console.WriteLine(options.GetUsage());
                Environment.Exit(1);
            }

            if (Directory.Exists(options.Path))
            {
                client.InitSession();
                var results = ScanDirectory(options.Path)
                    .Select(SearchSubtitle)
                    .Where(s => s.Selection != null)
                    .ToList();

                if (!options.DryRun)
                {
                    Console.WriteLine();
                    DownloadSubtitles(results);
                }
            }
            else if (File.Exists(options.Path))
            {
                client.InitSession();
                var sub = SearchSubtitle(options.Path);
                if (sub.Selection != null && !options.DryRun)
                {
                    DownloadSubtitle(sub);
                }
            }
            else
            {
                Console.WriteLine("Path must be an existing file or directory.");
                Console.WriteLine(options.GetUsage());
                Environment.Exit(1);
            }
        }
Esempio n. 4
0
        static void Main()
        {
            #if DEBUG
            var osdbClient = new OSDbClient(OSDbClient.TestUserAgent);
            #else
            var osdbClient = new OSDbClient();
            #endif
            var githubClient = new GitHubClient(new ProductHeaderValue(Application.ProductName, Application.ProductVersion));

            Mapper.Initialize(cfg => cfg.AddProfile<OSDbProfile>());
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm(osdbClient, githubClient));
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var client = new OSDbClient(OSDbClient.TestUserAgent);
            client.InitSession();

            var query = new ImdbSearchQuery
            {
                LanguageIds = "eng",
                ImdbId = "0111161",
            };

            var subs = client.SearchSubtitles(query);

            File.WriteAllText("SearchSubtitles.json", JsonConvert.SerializeObject(subs, Formatting.Indented));
        }
Esempio n. 6
0
        public MainForm()
        {
            InitializeComponent();
            InitLanguages();
            InitSearchMethods();
            InitFileDialog();
            InitSubtitleGrid();

            WindowTitle = $"{Application.ProductName} {Application.ProductVersion}";

#if DEBUG
            client = new OSDbClient(OSDbClient.TestUserAgent);
            WindowTitle += " (debug)";
#else
            client = new OSDbClient();
#endif
        }
Esempio n. 7
0
        public MainForm(OSDbClient osdbClient, IGitHubClient githubClient)
        {
            InitializeComponent();
            InitSearchMethods();
            InitFileDialog();

            subtitleGrid.SelectionChanged += HandleSubtitleSelectionChanged;

            this.osdbClient = osdbClient;
            this.githubClient = githubClient;
            this.omdbClient = new OmdbClient();

            WindowTitle = Application.ProductName;

#if DEBUG
            WindowTitle += " (debug)";
#endif
        }