Skip to content

Commit

Permalink
deezer: fetching songs from startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyklan committed Jun 16, 2019
1 parent f7bde09 commit 36c483c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions Songify Slim/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ private void Cbx_Source_SelectionChanged(object sender, System.Windows.Controls.
case 0:
case 3:
case 4:
// Spotify
// Spotify, VLC or foobar2000
FetchTimer(1000);
break;

case 1:
// Youtube User-Set Poll Rate (seconds) * 1000 for milliseconds
case 5:
// Browser User-Set Poll Rate (seconds) * 1000 for milliseconds
FetchTimer(Settings.ChromeFetchRate * 1000);
break;

Expand Down Expand Up @@ -404,10 +405,13 @@ private void MetroWindowLoaded(object sender, RoutedEventArgs e)
switch (_selectedSource)
{
case 0:
case 3:
case 4:
FetchTimer(1000);
break;

case 1:
case 5:
FetchTimer(Settings.ChromeFetchRate * 1000);
break;

Expand Down
3 changes: 2 additions & 1 deletion Songify Slim/SongFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ public string FetchBrowser(string website, string browser = "chrome")
_parent = TreeWalker.RawViewWalker.GetParent(elem);
Console.WriteLine(elem.Current.Name);
// Regex pattern to replace the notification in front of the tab (1) - (99+)
string temp = Regex.Replace(elem.Current.Name, @"^\([\d]*(\d+)[\d]*\+*\)", "");
string temp = elem.Current.Name;
//string temp = Regex.Replace(elem.Current.Name, @"^\([\d]*(\d+)[\d]*\+*\)", "");
int index = temp.LastIndexOf("- Deezer", StringComparison.Ordinal);
// Remove everything after the last "-" int the string
// which is "- Youtube" and info that music is playing on this tab
Expand Down

0 comments on commit 36c483c

Please sign in to comment.