From 9cda3106de6cfc88aa68ccd59756b6f4f67de15f Mon Sep 17 00:00:00 2001 From: 15cm Date: Sat, 13 Feb 2016 22:49:03 +0800 Subject: [PATCH] Try to load embedded lyrics first --- DynamicLyrics/LyricX/MainController.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/DynamicLyrics/LyricX/MainController.m b/DynamicLyrics/LyricX/MainController.m index fef65c6..299e8ff 100644 --- a/DynamicLyrics/LyricX/MainController.m +++ b/DynamicLyrics/LyricX/MainController.m @@ -230,6 +230,7 @@ - (void) WorkingThread:(NSMutableDictionary*)tmpDict NSString *SongTitle = [iTunesCurrentTrack name]; NSString *SongArtist = [iTunesCurrentTrack artist]; + NSString *SongEmbeddedLyrics = [iTunesCurrentTrack lyrics]; if(SongTitle == nil) { self.CurrentSongLyrics = @""; @@ -237,9 +238,16 @@ - (void) WorkingThread:(NSMutableDictionary*)tmpDict self.CurrentSongLyrics = [NSString stringWithFormat:@"%@ - %@",SongTitle,SongArtist]; } [nc postNotificationName:@"LyricsChanged" object:self userInfo:[NSDictionary dictionaryWithObject:self.CurrentSongLyrics forKey:@"Lyrics"]]; - - - if ([userDefaults valueForKey:[NSString stringWithFormat:@"%@%@",SongArtist,SongTitle]]) + + if([SongEmbeddedLyrics length] != 0){ + self.SongLyrics = SongEmbeddedLyrics; + CurrentLyric = 0; + LyricsDelay = [userDefaults floatForKey:[NSString stringWithFormat:@"Delay%@%@",SongArtist,SongTitle]]; + [currentDelayMenuItem setTitle:[NSString stringWithFormat:@"%@ %.2fs",NSLocalizedString(@"CurrentDelay", nil),0 - LyricsDelay]]; + + [self Anylize]; + } + else if ([userDefaults valueForKey:[NSString stringWithFormat:@"%@%@",SongArtist,SongTitle]]) { self.SongLyrics = [NSString stringWithString:[userDefaults valueForKey:[NSString stringWithFormat:@"%@%@",SongArtist,SongTitle]]];