Пример #1
0
        public void CopyTo(ScannerOptions opts)
        {
            CopyOptions(opts);

            opts.BufferSize = this.BufferSize;
            opts.ComputeHashs = this.ComputeHashs;
        }
Пример #2
0
        public void CopyTo(ScannerOptions opts)
        {
            CopyOptions(opts);

            opts.BufferSize   = this.BufferSize;
            opts.ComputeHashs = this.ComputeHashs;
        }
Пример #3
0
        protected override void CopyOptions(ScannerOptions opts)
        {
            if (!(opts is AudioCdScannerOptions))
                return;

            AudioCdScannerOptions tmp = opts as AudioCdScannerOptions;

            tmp.EnableMusicBrainz = this.EnableMusicBrainz;
        }
Пример #4
0
        protected override void CopyOptions(ScannerOptions opts)
        {
            if (!(opts is AudioCdScannerOptions))
            {
                return;
            }

            AudioCdScannerOptions tmp = opts as AudioCdScannerOptions;

            tmp.EnableMusicBrainz = this.EnableMusicBrainz;
        }
Пример #5
0
        protected override void CopyOptions(ScannerOptions opts)
        {
            if (!(opts is FilesystemScannerOptions))
                return;

            FilesystemScannerOptions tmp = opts as FilesystemScannerOptions;

            tmp.DiscardSymLinks = this.DiscardSymLinks;
            tmp.GenerateThumbnails = this.GenerateThumbnails;

            // don't deep-copy the metadata providers, it's too expensive
            // (e.g. native libextractor instantiation and initialization)
            tmp.MetadataProviders = this.MetadataProviders;
            tmp.DbDataPath = this.DbDataPath;
        }
Пример #6
0
        protected override void CopyOptions(ScannerOptions opts)
        {
            if (!(opts is FilesystemScannerOptions))
            {
                return;
            }

            FilesystemScannerOptions tmp = opts as FilesystemScannerOptions;

            tmp.DiscardSymLinks    = this.DiscardSymLinks;
            tmp.GenerateThumbnails = this.GenerateThumbnails;

            // don't deep-copy the metadata providers, it's too expensive
            // (e.g. native libextractor instantiation and initialization)
            tmp.MetadataProviders = this.MetadataProviders;
            tmp.DbDataPath        = this.DbDataPath;
        }
Пример #7
0
 protected abstract void CopyOptions(ScannerOptions opts);
Пример #8
0
        public VolumeScanner(VolumeDatabase db, DriveInfo drive)
        {
            this.scanCompleted = false;
            this.database = db;
            this.newVolume = null;

            infoIcon	= RenderIcon(Icons.Icon.Stock_DialogInfo,	   ICON_SIZE);
            warningIcon = RenderIcon(Icons.Icon.Stock_DialogWarning,   ICON_SIZE);
            errorIcon	= RenderIcon(Icons.Icon.Stock_DialogError,	   ICON_SIZE);

            mdps = null;

            if (App.Settings.ScannerExtractMetaData &&
                (VolumeProber.ProbeVolume(drive) == VolumeProber.VolumeProbeResult.Filesystem)) {

                mdps = new MetadataProvider[] {
                    new TagLibMetadataProvider(),
                    new ArchiveMetadataProvider()
                };
            }

            // setup scanner options
            ScannerOptions[] opts = new ScannerOptions[2] {

                new FilesystemScannerOptions() {
                    BufferSize			= App.Settings.ScannerBufferSize,
                    ComputeHashs		= App.Settings.ScannerComputeHashs,
                    DiscardSymLinks		= App.Settings.ScannerDiscardSymLinks,
                    GenerateThumbnails	= App.Settings.ScannerGenerateThumbnails,
                    MetadataProviders	= mdps,
                    DbDataPath			= PathUtil.GetDbDataPath(database)
                },

                new AudioCdScannerOptions() {
                    EnableMusicBrainz = App.Settings.ScannerEnableMusicBrainz
                }
            };

            scanner = VolumeProber.GetScannerForVolume(drive, database, opts);

            // scanner eventhandlers
            scanner.BeforeScanItem	  += scanner_BeforeScanItem;
            scanner.ScannerWarning	  += scanner_ScannerWarning;
            scanner.Error			  += scanner_Error;
            scanner.ScanCompleted	  += scanner_ScanCompleted;

            /* volumedatabase event handlers */
            database.BeginWriteAccess	+= database_BeginWriteAccess;
            database.EndWriteAccess		+= database_EndWriteAccess;

            // must be called _after_ scanner instanciation
            // (requires scanner.VolumeInfo.GetVolumeType())
            BuildGui();
            InitTreeView();

            scannerLog = new StringBuilder();
            timer = new StatusUpdateTimer(this);

            try {
                /* NOTE: make sure the timer will be removed properly later,
                 * or it keeps running, even if this window has been closed. */
                timer.Install();

                string tmp;
                // e.g. GIO network 'drives' do not have a devicefile
                if (string.IsNullOrEmpty(drive.Device))
                    tmp = S._("Scanning started.");
                else
                    tmp = string.Format(S._("Scanning of drive '{0}' started."), drive.Device);

                UpdateLog(LogIcon.Info, tmp);

                switch (scanner.VolumeInfo.GetVolumeType()) {
                    case VolumeType.FileSystemVolume:
                        UpdateLog(LogIcon.Info, string.Format(S._("Options: generate thumbs: {0}, extract metadata: {1}, discard symlinks: {2}, hashing: {3}."),
                                                              BoolToStr(App.Settings.ScannerGenerateThumbnails),
                                                              BoolToStr(App.Settings.ScannerExtractMetaData),
                                                              BoolToStr(App.Settings.ScannerDiscardSymLinks),
                                                              BoolToStr(App.Settings.ScannerComputeHashs)));
                        break;
                    case VolumeType.AudioCdVolume:
                        UpdateLog(LogIcon.Info, string.Format(S._("Options: MusicBrainz enabled: {0}"),
                                                          BoolToStr(App.Settings.ScannerEnableMusicBrainz)));
                        break;
                    default:
                        throw new NotImplementedException(string.Format("Missing options output for scannertyp {0}", scanner.GetType()));
                }

                if (scanner.VolumeInfo.GetVolumeType() == VolumeType.FileSystemVolume) {
                    // copy already known volume data into the editor
                    volEditor.ArchiveNo = scanner.VolumeInfo.ArchiveNo;
                    volEditor.Title = scanner.VolumeInfo.Title;
                } else {
                    // other volumetypes have no useful data yet (e.g. AudioCD data may be queried from musicbrainz.org),
                    // so disable the editor and re-enable it and fill in the data when scanning has been completed.
                    volEditor.Sensitive = false;
                }

                // start scanning on a new thread and return immediately
                scanner.RunAsync();
            } catch {
                timer.Remove();
                throw;
            }
        }
Пример #9
0
 protected abstract void CopyOptions(ScannerOptions opts);