コード例 #1
0
        public static LyricArchiveWrapper GetLyrics(IITTrackWrapper track)
        {
            var arcCached = App.LyricCollection.FindById(LyricArchive.GetID(track));

            if (arcCached != null && arcCached.Lyric != null)
            {
                return(new LyricArchiveWrapper(track, arcCached, true));
            }

            AlsongLyric[]       lyrics;
            LyricArchiveWrapper archive;

            lyrics = AlsongAPI.SearchByFile(track.Location);
            if (lyrics?.Length > 0 && TryWrap(track, lyrics[0], out archive))
            {
                return(archive);
            }

            lyrics = AlsongAPI.SearchByText(track.Artist, track.Title, 0);
            if (lyrics?.Length > 0 && TryWrap(track, lyrics[0], out archive))
            {
                return(archive);
            }

            return(null);
        }
コード例 #2
0
        private LyricArchiveWrapper(IITTrackWrapper track, LyricArchive archive, bool isArchived)
        {
            this.m_archive  = archive;
            this.IsArchived = isArchived;
            this.Track      = track;

            this.LinesGroup = new LyricLineGroupCollection(archive.Lyric);
        }
コード例 #3
0
        public static bool TryWrap(IITTrackWrapper track, AlsongLyric lyric, out LyricArchiveWrapper archive)
        {
            archive = null;

            if (!lyric.GetLyrics())
            {
                return(false);
            }

            var arc = new LyricArchive(track)
            {
                LyricID = lyric.LyricID,
                Lyric   = lyric.Lyric,
            };

            archive = new LyricArchiveWrapper(track, arc, false);
            archive.Save();

            return(true);
        }
コード例 #4
0
 private void ITunes_OnPlayerPlayEvent(object iTrack)
 => this.OnPlayerPlayEvent?.Invoke(IITTrackWrapper.Convert((IITTrack)iTrack));
コード例 #5
0
 public AlsongLyricWrapper(IITTrackWrapper track, bool foundByFile, AlsongLyric lyric)
 {
     this.CurrentTrack = track;
     this.FoundByFile  = foundByFile;
     this.AlsongLyric  = lyric;
 }