Пример #1
0
 public void PhantomScanner()
 {
     PhantomScanner scanner = new PhantomScanner(controller, catalog);
     scanner.ArtistFilter = "pomplamoose";
     scanner.AlbumFilter = "pomplamoose video songs";
     scanner.Execute();
 }
Пример #2
0
        /// <summary>
        /// Scan the entire iTunes library deleting all entries without a defined location
        /// or pointing to non-existent files.  Typically referred to as "dead tracks",
        /// these are <i>"phantom entries"</i>.
        /// </summary>

        public void ScanPhantomTracks()
        {
            if (!disabled.Contains(Resx.I_ScanPhantoms))
            {
                IScanner scanner = new PhantomScanner(controller, catalog);
                AddScanner(scanner, PhantomScannerPriority);
            }
        }
Пример #3
0
        /// <summary>
        /// Clean the specified (current) artist's album.
        /// </summary>
        /// <param name="album"></param>
        /// <param name="artist"></param>
        /// <remarks>
        /// This is invoked automatically whenever a new track is played, as prescribed by
        /// the isCleansed verification.
        /// </remarks>

        public void Clean(string album, string artist)
        {
            if (catalog == null)
            {
                // catalog is null until InitializingScanner is complete
                return;
            }

            bool allowArtworkScanner   = IsScannerAllowed(Resx.I_ScanArtwork);
            bool allowDuplicateScanner = IsScannerAllowed(Resx.I_ScanDuplicates);
            bool allowPhantomScanner   = IsScannerAllowed(Resx.I_ScanPhantoms);

            if (allowArtworkScanner || allowDuplicateScanner || allowPhantomScanner)
            {
                string key = album + "~" + artist;

                string logtext = String.Format("Auto-cleaning album '{0}'", key);
                Logger.WriteAppLog(LogCategory, logtext);
                Logger.WriteLine(LogCategory, logtext);

                cleansed.Add(key);

                if (allowDuplicateScanner)
                {
                    DuplicateScanner dscanner = new DuplicateScanner(controller, catalog);
                    dscanner.AlbumFilter  = album;
                    dscanner.ArtistFilter = artist;
                    AddScanner(dscanner, DuplicateScannerPriority);
                }

                if (allowPhantomScanner)
                {
                    PhantomScanner pscanner = new PhantomScanner(controller, catalog);
                    pscanner.AlbumFilter  = album;
                    pscanner.ArtistFilter = artist;
                    AddScanner(pscanner, PhantomScannerPriority);
                }

                if (allowArtworkScanner && NetworkStatus.IsAvailable)
                {
                    ArtworkScanner ascanner = new ArtworkScanner(controller, catalog);
                    ascanner.AlbumFilter  = album;
                    ascanner.ArtistFilter = artist;
                    AddScanner(ascanner, ArtworkScannerPriority);
                }
            }
        }
Пример #4
0
 /// <summary>
 /// Scan the entire iTunes library deleting all entries without a defined location
 /// or pointing to non-existent files.  Typically referred to as "dead tracks",
 /// these are <i>"phantom entries"</i>.
 /// </summary>
 public void ScanPhantomTracks()
 {
     if (!disabled.Contains(Resx.I_ScanPhantoms))
     {
         IScanner scanner = new PhantomScanner(controller, catalog);
         AddScanner(scanner);
     }
 }
Пример #5
0
        /// <summary>
        /// Clean either the current album if in the Music library or the current user-defined
        /// playlist by scanning for duplicates and removing phantom tracks within that context.
        /// </summary>
        /// <remarks>
        /// This is invoked manually by the user from the Clean context menu.
        /// </remarks>
        public void CleanContext(bool isAlbumContext)
        {
            if (catalog == null)
            {
                // catalog is null until InitializingScanner is complete
                return;
            }

            if (isAlbumContext)
            {
                // DO NOT dispose current or we'll destroy the original CurrentTrack RCW
                Track current = controller.CurrentTrack;
                string album = current.Album;
                string artist = current.Artist;

                string key = album + "~" + artist;
                string logtext = String.Format("cleaning album '{0}'", key);
                Logger.WriteAppLog(LogCategory, logtext);
                Logger.WriteLine(LogCategory, logtext);

                cleansed.Add(key);

                DuplicateScanner dscanner = new DuplicateScanner(controller, catalog);
                PhantomScanner pscanner = new PhantomScanner(controller, catalog);

                dscanner.AlbumFilter = album;
                pscanner.AlbumFilter = album;
                dscanner.ArtistFilter = artist;
                pscanner.ArtistFilter = artist;

                AddScanner(dscanner);
                AddScanner(pscanner);
            }
            else // (isPlaylistContext)
            {
                // DO NOT dispose current or we'll destory the original CurrentPlaylist RCW
                Playlist current = controller.CurrentPlaylist;

                string logtext = String.Format("cleaning playlist '{0}'", current.Name);
                Logger.WriteAppLog(LogCategory, logtext);
                Logger.WriteLine(LogCategory, logtext);

                DuplicateScanner dscanner = new DuplicateScanner(controller, catalog);
                PhantomScanner pscanner = new PhantomScanner(controller, catalog);

                dscanner.PlaylistFilter = current.PersistentID;
                pscanner.PlaylistFilter = current.PersistentID;

                AddScanner(dscanner);
                AddScanner(pscanner);
            }
        }
Пример #6
0
        /// <summary>
        /// Clean the specified (current) artist's album.
        /// </summary>
        /// <param name="album"></param>
        /// <param name="artist"></param>
        /// <remarks>
        /// This is invoked automatically whenever a new track is played, as prescribed by
        /// the isCleansed verification.
        /// </remarks>
        public void Clean(string album, string artist)
        {
            if (catalog == null)
            {
                // catalog is null until InitializingScanner is complete
                return;
            }

            bool allowDuplicateScanner = IsScannerAllowed(Resx.I_ScanDuplicates);
            bool allowPhantomScanner = IsScannerAllowed(Resx.I_ScanPhantoms);

            if (allowDuplicateScanner || allowPhantomScanner)
            {
                string key = album + "~" + artist;

                string logtext = String.Format("Auto-cleaning album '{0}'", key);
                Logger.WriteAppLog(LogCategory, logtext);
                Logger.WriteLine(LogCategory, logtext);

                cleansed.Add(key);

                if (allowDuplicateScanner)
                {
                    DuplicateScanner dscanner = new DuplicateScanner(controller, catalog);
                    dscanner.AlbumFilter = album;
                    dscanner.ArtistFilter = artist;
                    AddScanner(dscanner);
                }

                if (allowPhantomScanner)
                {
                    PhantomScanner pscanner = new PhantomScanner(controller, catalog);
                    pscanner.AlbumFilter = album;
                    pscanner.ArtistFilter = artist;
                    AddScanner(pscanner);
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Clean either the current album if in the Music library or the current user-defined
        /// playlist by scanning for duplicates and removing phantom tracks within that context.
        /// </summary>
        /// <remarks>
        /// This is invoked manually by the user from the Clean context menu.
        /// </remarks>

        public void CleanContext(bool isAlbumContext)
        {
            if (catalog == null)
            {
                // catalog is null until InitializingScanner is complete
                return;
            }

            if (isAlbumContext)
            {
                // DO NOT dispose current or we'll destroy the original CurrentTrack RCW
                Track  current = controller.CurrentTrack;
                string album   = current.Album;
                string artist  = current.Artist;

                string key     = album + "~" + artist;
                string logtext = String.Format("cleaning album '{0}'", key);
                Logger.WriteAppLog(LogCategory, logtext);
                Logger.WriteLine(LogCategory, logtext);

                cleansed.Add(key);

                var dscanner = new DuplicateScanner(controller, catalog);
                dscanner.AlbumFilter  = album;
                dscanner.ArtistFilter = artist;
                AddScanner(dscanner, DuplicateScannerPriority);

                var pscanner = new PhantomScanner(controller, catalog);
                pscanner.AlbumFilter  = album;
                pscanner.ArtistFilter = artist;
                AddScanner(pscanner, PhantomScannerPriority);

                if (NetworkStatus.IsAvailable)
                {
                    var ascanner = new ArtworkScanner(controller, catalog);
                    ascanner.AlbumFilter  = album;
                    ascanner.ArtistFilter = artist;
                    AddScanner(ascanner, ArtworkScannerPriority);
                }
            }
            else             // (isPlaylistContext)
            {
                // DO NOT dispose current or we'll destory the original CurrentPlaylist RCW
                Playlist current = controller.CurrentPlaylist;

                string logtext = String.Format("cleaning playlist '{0}'", current.Name);
                Logger.WriteAppLog(LogCategory, logtext);
                Logger.WriteLine(LogCategory, logtext);

                var dscanner = new DuplicateScanner(controller, catalog);
                dscanner.PlaylistFilter = current.PersistentID;
                AddScanner(dscanner, DuplicateScannerPriority);

                var pscanner = new PhantomScanner(controller, catalog);
                pscanner.PlaylistFilter = current.PersistentID;
                AddScanner(pscanner, PhantomScannerPriority);

                if (NetworkStatus.IsAvailable)
                {
                    var ascanner = new ArtworkScanner(controller, catalog);
                    ascanner.PlaylistFilter = current.PersistentID;
                    AddScanner(ascanner, ArtworkScannerPriority);
                }
            }
        }