internal MusicCueConverterImporter(IMusicConverter iIMusicConverter, List<Tuple<string, AlbumDescriptor>> MusicandCue, List<string> Image, IImportHelper ClueName)
 {
     _IMusicConverter = iIMusicConverter;
     _MusicandCueFile = MusicandCue;
     _ListImage = Image;
     _ClueName = ClueName;
 }
 internal MusicConverterImporter(IMusicConverter iIMusicConverter, List<string> Music, List<string> Image, IImportHelper ClueName)
 {
     _IMusicConverter = iIMusicConverter;
     _ListMusic = Music;
     _ListImage = Image;
     _ClueName = ClueName;
 }
示例#3
0
 public MusicITunesHandler(IMusicTrackDatabase musicDatabase)
 {
     CreateFolder();
     this.musicDatabase = musicDatabase;
     musicParser        = new MusicParserFacade();
     musicDownloader    = new MusicDownloaderITunes();
     musicConverters    = new IMusicConverter[]
     {
         new MusicMp3Converter(folderPath),
         new MusicOggConverter(folderPath)
     };
 }
        static internal ICollector CollectorForMusicToConvert(IMusicConverter iMusicConverter,
            List<string> Music, List<string> Image, List<string> Cue, IImportHelper ClueName, IEventListener IEL)
        {
            int ccont = Cue.Count;
            int mcount =Music.Count;
            if (ccont >= mcount)
            {
                if ((ccont == 1) && (mcount==1))
                {
                    AlbumDescriptor ad = AlbumDescriptor.FromCUESheet(Cue[0]);

                    if (ad != null)
                    {

                        string mus = Path.GetFileNameWithoutExtension(Music[0]).RemoveInvalidCharacters().ToLower();

                        if ((Path.GetFileNameWithoutExtension(ad.CUEFile).RemoveInvalidCharacters().ToLower() == mus) ||
                            (mus == Path.GetFileNameWithoutExtension(Cue[0]).RemoveInvalidCharacters().ToLower()))
                        {
                            if ((ad.CheckCueConsistency() == false) || (iMusicConverter.GetFileLengthInSeconds(Music[0]) <= ad.GetCueMinLengthInseconds()))
                            {
                                CueWillbeDiscarded cwd = new CueWillbeDiscarded(Cue[0],Music[0]);
                                IEL.Report(cwd);

                                if (cwd.Continue == false)
                                    return null;
                            }
                            else
                            {
                                return new CollectorForCueConvertMusic(iMusicConverter, Music[0], Image, ad, ClueName);
                            }
                        }
                    }

                }
                else
                {
                    var cues = Cue.Select(c=>AlbumDescriptor.FromCUESheet(c)).Where(c=>c!=null);

                    //Cherchons les matchs parfaits
                    CuePairingHelper cph = new CuePairingHelper(Music, cues).SetCueGlue(c => Path.GetFileName(c.CUEFile).RemoveInvalidCharacters().ToLower())
                        .SetMusicGlue(M => Path.GetFileName(M).RemoveInvalidCharacters().ToLower()).Compute();

                    List<Tuple<string, AlbumDescriptor>> OK = cph.Matches;

                    if (cph.FullMatch)
                    {
                        return new CollectorForCueConvertMusic(iMusicConverter,OK, Image, ClueName);
                    }

                    //Cherchons les matchs imparfaits pour les cue restants             
                    cph = new CuePairingHelper(cph.Remaining, cues).SetCueGlue(c => Path.GetFileNameWithoutExtension(c.CUEFile).RemoveInvalidCharacters().ToLower())
                        .SetMusicGlue(M => Path.GetFileNameWithoutExtension(M).RemoveInvalidCharacters().ToLower()).Compute();

                    OK.AddRange(cph.Matches);


                    if (cph.FullMatch)
                    {
                        return new CollectorForCueConvertMusic(iMusicConverter,OK, Image, ClueName);
                    }

                    //Derniere chance    
                    cph = new CuePairingHelper(cph.Remaining, cues).SetCueGlue(c => Path.GetFileNameWithoutExtension(c.CUESheetFileName).RemoveInvalidCharacters().ToLower())
                        .SetMusicGlue(M => Path.GetFileNameWithoutExtension(M).RemoveInvalidCharacters().ToLower()).Compute();

                    if (cph.FullMatch)
                    {
                        OK.AddRange(cph.Matches);
                        return new CollectorForCueConvertMusic(iMusicConverter,OK, Image, ClueName);
                    }
                }
            }

            return new CollectorForConvertMusic(iMusicConverter,Music, Image, ClueName);
        }
 internal CollectorForConvertMusic(IMusicConverter iMusicConverter, List<string> Music, 
     List<string> Image, IImportHelper ClueName)
     : base(Music, Image, ClueName)
 {
     _IMusicConverter = iMusicConverter;
 }
 internal CollectorForCueConvertMusic(IMusicConverter imc, string Music, List<string> Image, AlbumDescriptor Cue, IImportHelper ClueName)
     : base(Image, ClueName)
 {
     _IMusicConverter = imc;
     _MusicandCue = new List<Tuple<string, AlbumDescriptor>>();
     _MusicandCue.Add(new Tuple<string, AlbumDescriptor>(Music, Cue));
 }
 internal CollectorForCueConvertMusic(IMusicConverter imc, List<Tuple<string, AlbumDescriptor>> MusicandCue, 
             List<string> Image, IImportHelper ClueName)
     : base(Image, ClueName)
 {
     _IMusicConverter = imc;
     _MusicandCue = MusicandCue;
 }
 internal CDImporter(IMusicConverter iit, char Driver, bool iOpenCDDoorOnComplete)
 {
     _IMusicConverter = iit;
     _Driver = Driver;
     _OpenCDDoorOnComplete = iOpenCDDoorOnComplete;
 }