Esempio n. 1
0
        private static int Run()
        {
            try
            {
                using(var movieSystemService = new MovieSystemService())
                {
                    _log.Debug("Rescan started.");
                    VerifyAccessToRoots(movieSystemService);

                    var sourceScanner = new MovieSourceScanner(movieSystemService, new Epidaurus.ScannerLib.SourceScanning.ScannerFactory());
                    sourceScanner.ScanAllStorageLocations();

                    _log.Debug("Folder scan done, updating movie data...");
                }

                using (var ts = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromMinutes(5)))
                {
                    using (var movieSystemService = new MovieSystemService())
                    {
                        var updater = new MovieInformationUpdater(movieSystemService);
                        updater.UpdateAllMoviesInDatabase();
                        ts.Complete();
                        _log.Debug("Rescan completed");
                    }
                }

                return 0;
            }
            catch (Exception ex)
            {
                _log.ErrorException("Error updating: ", ex);
                return 1;
            }
        }
 public void TestAllStorageLocationsScan()
 {
     var bah = new MovieSourceScanner(new MovieSystemService(), new ScannerFactory());
     bah.ScanAllStorageLocations();
 }