Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing songtitle function
Fixing mouseMove function
  • Loading branch information
Dan Egbert committed Dec 29, 2012
1 parent 0cc9fb9 commit f1dcbb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
18 changes: 6 additions & 12 deletions FrmMain.cs
Expand Up @@ -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\"); }"
;
Expand All @@ -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();

Expand All @@ -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");
}
Expand All @@ -788,7 +785,6 @@ private void currentSongTimer_Tick(object sender, EventArgs e)
buttonPause.Icon = Properties.Resources.PlayerPlay;
isbuttonPaused = true;
}

}
}
}
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions WinGrooves.csproj
Expand Up @@ -7,8 +7,7 @@
<ProjectGuid>{18215C6D-2A47-4EF5-BBD4-8D237DA30049}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<ApplicationIcon>wingrooves_combined.ico</ApplicationIcon>
<AssemblyKeyContainerName />
<AssemblyName>WinGrooves</AssemblyName>
<AssemblyOriginatorKeyFile />
Expand Down Expand Up @@ -43,8 +42,8 @@
<PublisherName>WinGrooves</PublisherName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>6</ApplicationRevision>
<ApplicationVersion>1.0.1.6</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.7.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
Expand Down

0 comments on commit f1dcbb5

Please sign in to comment.