From f1dcbb5ec0c5285dcbeaccc0fc5349e1f07980f4 Mon Sep 17 00:00:00 2001 From: Dan Egbert Date: Sat, 29 Dec 2012 10:59:05 -0700 Subject: [PATCH] Fixing songtitle function Fixing mouseMove function --- FrmMain.cs | 18 ++++++------------ WinGrooves.csproj | 7 +++---- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/FrmMain.cs b/FrmMain.cs index cb4d7f7..931aa7c 100644 --- a/FrmMain.cs +++ b/FrmMain.cs @@ -717,15 +717,14 @@ private void currentSongTimer_Tick(object sender, EventArgs e) { try { - if (!injectedSongInfoFunctions) { HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0]; HtmlElement scriptEl = webBrowser1.Document.CreateElement("script"); IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement; - string injectedJquery = "function getSongTitle() { return $(\"#playerDetails_nowPlaying .song\").text(); } " + - "function getSongArtist() { return $(\"#playerDetails_nowPlaying .artist\").text(); }" + - "function mouseMove() { $(\"#page_wrapper\").mousemove(); }" + + string injectedJquery = "function getSongTitle() { return $(\"#now-playing-metadata .song\").text(); } " + + "function getSongArtist() { return $(\"#now-playing-metadata .artist\").text(); }" + + "function mouseMove() { $(\"#page-wrapper\").mousemove(); }" + "function clickElement(selector) { $(selector).click(); }" + "function getMusicState() {return $(\"#play-pause\").hasClass(\"paused\"); }" ; @@ -737,14 +736,13 @@ private void currentSongTimer_Tick(object sender, EventArgs e) object songTitle = webBrowser1.Document.InvokeScript("getSongTitle"); - //Since the song title changed we must update all the information if (String.IsNullOrEmpty(_cachedSongTitle) || _cachedSongTitle != songTitle.ToString()) { + //cache new song title so we can tell if it changes again _cachedSongTitle = songTitle.ToString(); - //Update thumbnail with album art cover UpdateThumbnail(); @@ -766,7 +764,6 @@ private void currentSongTimer_Tick(object sender, EventArgs e) notifyIcon1.Text = (songTitle + " - " + songArtist).Substring(0, 62); } catch - // Possible you land right on and under, throwing exception. handle with old fallback. { notifyIcon1.Text = ("WinGrooves"); } @@ -788,7 +785,6 @@ private void currentSongTimer_Tick(object sender, EventArgs e) buttonPause.Icon = Properties.Resources.PlayerPlay; isbuttonPaused = true; } - } } } @@ -841,14 +837,12 @@ private void Like_Click(object sender, EventArgs e) private void LikeCurrentSong() { - htmlClickOn("#np-menu"); - htmlClickOn("#jjmenu_main .jj_menu_item_frown"); + htmlClickOn("#player-wrapper .queue-item-active .smile"); } private void DislikeCurrentSong() { - htmlClickOn("#np-menu"); - htmlClickOn("#jjmenu_main .jj_menu_item_smile"); + htmlClickOn("#player-wrapper .queue-item-active .frown"); } private void Dislike_Click(object sender, EventArgs e) diff --git a/WinGrooves.csproj b/WinGrooves.csproj index 2420c45..68ba868 100644 --- a/WinGrooves.csproj +++ b/WinGrooves.csproj @@ -7,8 +7,7 @@ {18215C6D-2A47-4EF5-BBD4-8D237DA30049} Debug AnyCPU - - + wingrooves_combined.ico WinGrooves @@ -43,8 +42,8 @@ WinGrooves true publish.htm - 6 - 1.0.1.6 + 0 + 1.0.7.0 false true true