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); }
private LyricArchiveWrapper(IITTrackWrapper track, LyricArchive archive, bool isArchived) { this.m_archive = archive; this.IsArchived = isArchived; this.Track = track; this.LinesGroup = new LyricLineGroupCollection(archive.Lyric); }
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); }
private void ITunes_OnPlayerPlayEvent(object iTrack) => this.OnPlayerPlayEvent?.Invoke(IITTrackWrapper.Convert((IITTrack)iTrack));
public AlsongLyricWrapper(IITTrackWrapper track, bool foundByFile, AlsongLyric lyric) { this.CurrentTrack = track; this.FoundByFile = foundByFile; this.AlsongLyric = lyric; }