Exemple #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;
            }
        }
Exemple #2
0
 public MovieController(MovieSystemService movieSystemService, MovieInformationUpdater movieInformationUpdater, IMimeTypeResolver mimeTypeResolver)
 {
     _movieSystemService = movieSystemService;
     _movieInformationUpdater = movieInformationUpdater;
     _mimeTypeResolver = mimeTypeResolver;
 }
 public MovieSourceScanner(MovieSystemService movieSystemService, IScannerFactory scannerFactory)
 {
     _movieSystemService = movieSystemService;
     _scannerFactory = scannerFactory;
 }
 public ToWatchController(MovieSystemService mss, MovieInformationUpdater movieInformationUpdater)
 {
     _movieSystemService = mss;
     _movieInformationUpdater = movieInformationUpdater;
 }
Exemple #5
0
 private static void VerifyAccessToRoots(MovieSystemService mss)
 {
     foreach (var path in from el in mss.DbEntities.StorageLocations where el.Active && el.Type == "Folder" select el.Data1)
     {
         var di = new DirectoryInfo(path);
         di.GetFiles();
     }
 }
 public MovieInformationUpdater(MovieSystemService movieSystemService)
 {
     _movieSystemService = movieSystemService;
 }