Permalink
Browse files

Do not refresh the lyrics when the same song is repeatedly played

  • Loading branch information...
1 parent abd162b commit 3bf71bf1a5833343bb9e1d77d431601a946a274b Smile4ever committed Jun 22, 2015
Showing with 26 additions and 4 deletions.
  1. +26 −4 lyricsfinder.lua
View
@@ -909,10 +909,32 @@ function input_changed()
-- update_metas() --doesn't work (freezes)
-- requires input-listener
collectgarbage()
- title:set_text(get_title())
- artist:set_text(get_artist())
- lyric:set_text(translation["message_newsong"])
- dlg:set_title(translation["dialogtitle_normal"])
+ local title_prev = title:get_text()
+ local artist_prev = artist:get_text()
+
+ local title_curr = get_title()
+ local artist_curr = get_artist()
+
+ if title_prev and title_curr then
+ if title_prev == title_curr then
+ --maybe this song has the same title, but a different performer
+ if artist_prev and artist_curr then
+ if artist_prev == artist_curr then
+ --nothing, do not reload (keep the lyrics as they are)
+ else
+ lyric:set_text(translation["message_newsong"])
+ dlg:set_title(translation["dialogtitle_normal"])
+ end
+ end
+ else
+ --it's a different song
+ lyric:set_text(translation["message_newsong"])
+ dlg:set_title(translation["dialogtitle_normal"])
+ end
+ end
+
+ title:set_text(title_curr)
+ artist:set_text(artist_curr)
dlg:update()
--click_google()
collectgarbage()

0 comments on commit 3bf71bf

Please sign in to comment.