Example #1
0
 public IProcessorMutable CreateProcessor(TrackNumberGenerator trackNumberGenerator)
 {
     return(new DirectoryProcessor(new DirectoryFreedbToTags(
                                       (MultipleItemChooser.MultipleChoiseHeuristic)MultipleChoiseHeuristic.ItemT <DocEnum>().Value,
                                       trackNumberGenerator),
                                   true));
 }
Example #2
0
 public DirectoryFreedbToTags(
     MultipleItemChooser.MultipleChoiseHeuristic multipleChoiseHeuristic,
     TrackNumberGenerator trackNumberGenerator)
 {
     TrackNumberGenerator = trackNumberGenerator;
     Processor            = new FileProcessor(new WordsToTagProcessor());
     Heuristic            = multipleChoiseHeuristic;
 }
Example #3
0
        public virtual void Process(object obj)
        {
            string trackNumberText = TrackNumberGenerator.ApplyPattern(TrackNumber, TrackCount);

            Logger.WriteLine(Tokens.InfoVerbose, "Creating track number " + trackNumberText);

            new TagEditor(obj as Tag).TrackNumber = trackNumberText;
        }
Example #4
0
        public static IEnumerable <KeyValuePair <FileInfo, IDictionary <FrameMeaning, object> > > CreateObjects(
            string dir,
            Release release,
            TrackNumberGenerator trackNumberGenerator)
        {
            string[] files = VirtualDrive.GetFiles(dir, "*.mp3");

            for (int i = 0; i < files.Length; i++)
            {
                yield return(new KeyValuePair <FileInfo, IDictionary <FrameMeaning, object> >(
                                 new FileInfo(files[i]),
                                 CreateObjects(release, i, trackNumberGenerator)));
            }
        }
Example #5
0
        public DirectoryWebQueryToTags(
            IQueryByNames queryEngine,
            TrackNumberGenerator trackNumberGenerator)
        {
            Explorer.AlbumRequired         = true;
            Explorer.ArtistRequired        = true;
            Explorer.TitleRequired         = false;
            Explorer.TrackNumberRequired   = false;
            Explorer.ReleaseYearRequired   = false;
            Explorer.MinimumTracksRequired = 1;

            QueryEngine          = queryEngine;
            TrackNumberGenerator = trackNumberGenerator;

            Processor = new FileProcessor(new WordsToTagProcessor());
        }
Example #6
0
        private static IDictionary <FrameMeaning, object> CreateObjects(
            ID3WebQueryBase.Release release,
            int index,
            TrackNumberGenerator trackNumberGenerator)
        {
            IDictionary <FrameMeaning, object> result = new Dictionary <FrameMeaning, object>();

            result[FrameMeaning.Artist]      = release.Artist;
            result[FrameMeaning.Album]       = release.Title;
            result[FrameMeaning.TrackNumber] = trackNumberGenerator.ApplyPattern(index + 1, release.Tracks.Count());
            result[FrameMeaning.Title]       = release.Tracks.ElementAt(index).Title;
            result[FrameMeaning.ReleaseYear] = release.Year;

            if (release.CoverArt != null)
            {
                result[FrameMeaning.Picture] = release.CoverArt;
            }

            return(result);
        }
Example #7
0
        public IProcessorMutable CreateProcessor(
            TrackNumberGenerator trackNumberGenerator,
            PreferencesCommon prefsCommon,
            PreferencesAlbumRecognition prefsAlbumRecognition)
        {
            ProcessorListMutable toplevel = new ProcessorListMutable();

            {
                ProcessorListMutable plm = new ProcessorListMutable();

                if (DropCodecs.Value <bool>())
                {
                    plm.ProcessorList.Add(new DropCodecsProcessor());
                }

                plm.ProcessorList.Add(new TagVersionProcessor(ID3.Preferences.PreferredVersion));

                if (CreateTrackNumbers.Value <bool>())
                {
                    plm.ProcessorList.Add(new TagProcessorTrackNumber(trackNumberGenerator));
                }
                if (DropUnwantedFrames.Value <bool>())
                {
                    plm.ProcessorList.Add(CreateDropFramesProcessor());
                }

                TextProcessorList textProcessorList = new TextProcessorList();
                if (TextTrim.Value <bool>())
                {
                    textProcessorList.ProcessorList.Add(new TextTrim());
                }
                if (TextBreakCamelCase.Value <bool>())
                {
                    textProcessorList.ProcessorList.Add(new TextBreakCamelCase());
                }
                if (TextBreakUnderscores.Value <bool>())
                {
                    textProcessorList.ProcessorList.Add(new TextBreakUnderscores());
                }
                if (TextFirstCharUpper.Value <bool>())
                {
                    textProcessorList.ProcessorList.Add(new TextFirstCharUpper());
                }
                if (textProcessorList.ProcessorList.Count > 0)
                {
                    plm.ProcessorList.Add(new TagProcessor(new FrameProcessorText(textProcessorList)));
                }
                //return new DirectoryProcessor(new FileProcessor(plm), true);

                toplevel.ProcessorList.Add(new DirectoryProcessor(new FileProcessor(plm), true));
            }

            {
                AlbumExplorerProcessor explorer = prefsAlbumRecognition.CreateProcessorExplorer(false);
                explorer.OnFineProcessor = new AlbumTagToFilenameProcessor(prefsCommon.FileNamePattern.Value <string>());

                toplevel.ProcessorList.Add(new ID3.Processor.DirectoryProcessor(explorer, true));
            }

            {
                AlbumExplorerProcessor explorer = prefsAlbumRecognition.CreateProcessorExplorer(false);
                explorer.OnFineProcessor = new AlbumTagToDirectoryProcessor(prefsCommon.DirectoryPattern.Value <string>());

                toplevel.ProcessorList.Add(new ID3.Processor.DirectoryProcessor(explorer, true));
            }

            return(toplevel);
        }
Example #8
0
 private int NumberOfTracks(Tag tag)
 {
     return TrackNumberGenerator.ParseNumberOfTracks(new TagEditor(tag).TrackNumber);
 }
Example #9
0
 public TagProcessorTrackNumber(TrackNumberGenerator trackNumberGenerator)
 {
     TrackNumberGenerator = trackNumberGenerator;
 }
Example #10
0
 public TagProcessorTrackNumber()
 {
     TrackNumberGenerator = new TrackNumberGenerator(DefaultPattern);
 }