public static string GetAlbumForArtistTrack(string artist, string track) { Scraper scraper = new Scraper(); string result = scraper.LastFMGetAlbum (artist, track); scraper = null; return result; }
public static void GetSelectedItem(ref string SelectedItem, ref string SelectedAlbum, ref string SelectedGenre, ref string SelectedStudios, ref bool isMusicVideo) { try { if (iActiveWindow == (int)GUIWindow.Window.WINDOW_INVALID) return; #region SelectedItem if (iActiveWindow == 6623) // mVids plugin - Outdated. { SelectedItem = Utils.GetProperty("#mvids.artist"); SelectedItem = Utils.GetArtistLeftOfMinusSign(SelectedItem); } else if (iActiveWindow == 47286) // Rockstar plugin { SelectedItem = Utils.GetProperty("#Rockstar.SelectedTrack.ArtistName"); SelectedAlbum = Utils.GetProperty("#Rockstar.SelectedTrack.AlbumName") ; } else if (iActiveWindow == 759) // My TV Recorder SelectedItem = Utils.GetProperty("#TV.RecordedTV.Title"); else if (iActiveWindow == 1) // My TV View SelectedItem = Utils.GetProperty("#TV.View.title"); else if (iActiveWindow == 600) // My TV Guide SelectedItem = Utils.GetProperty("#TV.Guide.Title"); else if (iActiveWindow == 880) // MusicVids plugin SelectedItem = Utils.GetProperty("#MusicVids.ArtistName"); else if (iActiveWindow == 510 || // My Music Plaing Now - Why is it here? iActiveWindow == 90478 || // My Lyrics - Why is it here? iActiveWindow == 25652 || // Radio Time - Why is it here? iActiveWindow == 35) // Basic Home - Why is it here? And where there may appear tag: #Play.Current.Title { SelectedItem = string.Empty; // mvCentral var mvcArtist = Utils.GetProperty("#Play.Current.mvArtist"); var mvcAlbum = Utils.GetProperty("#Play.Current.mvAlbum"); var mvcPlay = Utils.GetProperty("#mvCentral.isPlaying"); var selAlbumArtist = Utils.GetProperty("#Play.Current.AlbumArtist"); var selArtist = Utils.GetProperty("#Play.Current.Artist"); var selTitle = Utils.GetProperty("#Play.Current.Title"); if (!string.IsNullOrEmpty(selArtist)) if (!string.IsNullOrEmpty(selAlbumArtist)) if (selArtist.Equals(selAlbumArtist, StringComparison.InvariantCultureIgnoreCase)) SelectedItem = selArtist; else SelectedItem = selArtist + '|' + selAlbumArtist; else SelectedItem = selArtist; /* if (!string.IsNullOrEmpty(tuneArtist)) SelectedItem = SelectedItem + (string.IsNullOrEmpty(SelectedItem) ? "" : "|") + tuneArtist; */ SelectedAlbum = Utils.GetProperty("#Play.Current.Album"); SelectedGenre = Utils.GetProperty("#Play.Current.Genre"); if (!string.IsNullOrEmpty(selArtist) && !string.IsNullOrEmpty(selTitle) && string.IsNullOrEmpty(SelectedAlbum)) { Scraper scraper = new Scraper(); SelectedAlbum = scraper.LastFMGetAlbum (selArtist, selTitle); scraper = null; } if (!string.IsNullOrEmpty(selAlbumArtist) && !string.IsNullOrEmpty(selTitle) && string.IsNullOrEmpty(SelectedAlbum)) { Scraper scraper = new Scraper(); SelectedAlbum = scraper.LastFMGetAlbum (selAlbumArtist, selTitle); scraper = null; } /* if (!string.IsNullOrEmpty(tuneArtist) && !string.IsNullOrEmpty(tuneTrack) && string.IsNullOrEmpty(tuneAlbum) && string.IsNullOrEmpty(SelectedAlbum)) { Scraper scraper = new Scraper(); SelectedAlbum = scraper.LastFMGetAlbum (tuneArtist, tuneTrack); scraper = null; } */ if (!string.IsNullOrEmpty(mvcPlay) && mvcPlay.Equals("true",StringComparison.CurrentCulture)) { isMusicVideo = true; if (!string.IsNullOrEmpty(mvcArtist)) SelectedItem = SelectedItem + (string.IsNullOrEmpty(SelectedItem) ? "" : "|") + mvcArtist; if (string.IsNullOrEmpty(SelectedAlbum)) SelectedAlbum = string.Empty + mvcAlbum; } if (string.IsNullOrEmpty(SelectedItem) && string.IsNullOrEmpty(selArtist) && string.IsNullOrEmpty(selAlbumArtist)) SelectedItem = selTitle; } else if (iActiveWindow == 6622) // Music Trivia { SelectedItem = Utils.GetProperty("#selecteditem2"); SelectedItem = Utils.GetArtistLeftOfMinusSign(SelectedItem); } else if (iActiveWindow == 2003 || // Dialog Video Info iActiveWindow == 6 || // My Video iActiveWindow == 25 || // My Video Title iActiveWindow == 614 || // Dialog Video Artist Info iActiveWindow == 28 // My Video Play List ) { var movieID = Utils.GetProperty("#movieid"); var selectedTitle = (iActiveWindow != 2003 ? Utils.GetProperty("#selecteditem") : Utils.GetProperty("#title")); SelectedItem = (movieID == null || movieID == string.Empty || movieID == "-1" || movieID == "0") ? selectedTitle : movieID; SelectedGenre = Utils.GetProperty("#genre"); SelectedStudios = Utils.GetProperty("#studios"); // logger.Debug("*** "+movieID+" - "+Utils.GetProperty("#selecteditem")+" - "+Utils.GetProperty("#title")+" - "+Utils.GetProperty("#myvideosuserfanart")+" -> "+SelectedItem+" - "+SelectedGenre); } else if (iActiveWindow == 96742) // Moving Pictures { SelectedItem = Utils.GetProperty("#selecteditem"); SelectedStudios = Utils.GetProperty("#MovingPictures.SelectedMovie.studios"); SelectedGenre = Utils.GetProperty("#MovingPictures.SelectedMovie.genres"); // logger.Debug("*** "+SelectedItem+" - "+SelectedStudios+" - "+SelectedGenre); } else if (iActiveWindow == 9811 || // TVSeries iActiveWindow == 9813) // TVSeries Playlist { SelectedItem = UtilsTVSeries.GetTVSeriesAttributes(ref SelectedGenre, ref SelectedStudios); if (string.IsNullOrEmpty(SelectedItem)) { SelectedItem = Utils.GetProperty("#TVSeries.Title"); } if (string.IsNullOrEmpty(SelectedStudios)) { SelectedStudios = Utils.GetProperty("#TVSeries.Series.Network"); } if (string.IsNullOrEmpty(SelectedGenre)) { SelectedGenre = Utils.GetProperty("#TVSeries.Series.Genre"); } // logger.Debug("*** TVSeries: " + SelectedItem + " - " + SelectedStudios + " - " + SelectedGenre); } else if (iActiveWindow == 112011 || // mvCentral iActiveWindow == 112012 || // mvCentral Playlist iActiveWindow == 112013 || // mvCentral StatsAndInfo iActiveWindow == 112015) // mvCentral SmartDJ { SelectedItem = Utils.GetProperty("#mvCentral.ArtistName"); SelectedAlbum = Utils.GetProperty("#mvCentral.Album"); SelectedGenre = Utils.GetProperty("#mvCentral.Genre"); var mvcIsPlaying = Utils.GetProperty("#mvCentral.isPlaying"); if (!string.IsNullOrEmpty(mvcIsPlaying) && mvcIsPlaying.Equals("true",StringComparison.CurrentCulture)) { isMusicVideo = true; } } else if (iActiveWindow == 25650) // Radio Time { SelectedItem = Utils.GetProperty("#RadioTime.Selected.Subtext"); // Artist - Track || TODO for: Artist - Album - Track SelectedItem = Utils.GetArtistLeftOfMinusSign(SelectedItem, true); } else if (iActiveWindow == 29050 || // youtube.fm videosbase iActiveWindow == 29051 || // youtube.fm playlist iActiveWindow == 29052 // youtube.fm info ) { SelectedItem = Utils.GetProperty("#selecteditem"); SelectedItem = Utils.GetArtistLeftOfMinusSign(SelectedItem); } else if (iActiveWindow == 30885) // GlobalSearch Music { SelectedItem = Utils.GetProperty("#selecteditem"); SelectedItem = Utils.GetArtistLeftOfMinusSign(SelectedItem); } else if (iActiveWindow == 30886) // GlobalSearch Music Details { try { if (GUIWindowManager.GetWindow(iActiveWindow).GetControl(1) != null) SelectedItem = ((GUIFadeLabel) GUIWindowManager.GetWindow(iActiveWindow).GetControl(1)).Label; } catch { } } else SelectedItem = Utils.GetProperty("#selecteditem"); SelectedAlbum = (string.IsNullOrEmpty(SelectedAlbum) ? null : SelectedAlbum); SelectedGenre = (string.IsNullOrEmpty(SelectedGenre) ? null : SelectedGenre.Replace(" / ", "|").Replace(", ", "|")); SelectedStudios = (string.IsNullOrEmpty(SelectedStudios) ? null : SelectedStudios.Replace(" / ", "|").Replace(", ", "|")); #endregion } catch (Exception ex) { logger.Error("GetSelectedItem: " + ex); } }
public static void GetCurrMusicPlayItem(ref string CurrentTrackTag, ref string CurrentAlbumTag, ref string CurrentGenreTag, ref string LastArtistTrack, ref string LastAlbumArtistTrack) { try { #region Fill current tags if (Utils.iActiveWindow == 730718) // MP Grooveshark { CurrentTrackTag = Utils.GetProperty("#mpgrooveshark.current.artist"); CurrentAlbumTag = Utils.GetProperty("#mpgrooveshark.current.album"); CurrentGenreTag = null; } else { CurrentTrackTag = string.Empty; // Common play var selAlbumArtist = Utils.GetProperty("#Play.Current.AlbumArtist").Trim(); var selArtist = Utils.GetProperty("#Play.Current.Artist").Trim(); var selTitle = Utils.GetProperty("#Play.Current.Title").Trim(); // Radio Time /* var tuneArtist = Utils.GetProperty("#RadioTime.Play.Artist"); var tuneAlbum = Utils.GetProperty("#RadioTime.Play.Album"); var tuneTrack = Utils.GetProperty("#RadioTime.Play.Song"); */ // mvCentral var mvcArtist = Utils.GetProperty("#Play.Current.mvArtist"); var mvcAlbum = Utils.GetProperty("#Play.Current.mvAlbum"); var mvcPlay = Utils.GetProperty("#mvCentral.isPlaying"); if (!string.IsNullOrEmpty(selArtist)) if (!string.IsNullOrEmpty(selAlbumArtist)) if (selArtist.Equals(selAlbumArtist, StringComparison.InvariantCultureIgnoreCase)) CurrentTrackTag = selArtist; else CurrentTrackTag = selArtist + '|' + selAlbumArtist; else CurrentTrackTag = selArtist; /* if (!string.IsNullOrEmpty(tuneArtist)) CurrentTrackTag = CurrentTrackTag + (string.IsNullOrEmpty(CurrentTrackTag) ? "" : "|") + tuneArtist; */ CurrentAlbumTag = Utils.GetProperty("#Play.Current.Album"); CurrentGenreTag = Utils.GetProperty("#Play.Current.Genre"); if (!string.IsNullOrEmpty(selArtist) && !string.IsNullOrEmpty(selTitle) && string.IsNullOrEmpty(CurrentAlbumTag)) { if (!LastArtistTrack.Equals(selArtist+"#"+selTitle, StringComparison.CurrentCulture)) { Scraper scraper = new Scraper(); CurrentAlbumTag = scraper.LastFMGetAlbum(selArtist, selTitle); scraper = null; LastArtistTrack = selArtist+"#"+selTitle; } } if (!string.IsNullOrEmpty(selAlbumArtist) && !string.IsNullOrEmpty(selTitle) && string.IsNullOrEmpty(CurrentAlbumTag)) { if (!LastAlbumArtistTrack.Equals(selAlbumArtist+"#"+selTitle, StringComparison.CurrentCulture)) { Scraper scraper = new Scraper(); CurrentAlbumTag = scraper.LastFMGetAlbum(selAlbumArtist, selTitle); scraper = null; LastAlbumArtistTrack = selAlbumArtist+"#"+selTitle; } } /* if (!string.IsNullOrEmpty(tuneArtist) && !string.IsNullOrEmpty(tuneTrack) && string.IsNullOrEmpty(tuneAlbum) && string.IsNullOrEmpty(CurrentAlbumTag)) { Scraper scraper = new Scraper(); CurrentAlbumTag = scraper.LastFMGetAlbum (tuneArtist, tuneTrack); scraper = null; } */ if (!string.IsNullOrEmpty(mvcPlay) && mvcPlay.Equals("true",StringComparison.CurrentCulture)) { if (!string.IsNullOrEmpty(mvcArtist)) CurrentTrackTag = CurrentTrackTag + (string.IsNullOrEmpty(CurrentTrackTag) ? "" : "|") + mvcArtist; if (string.IsNullOrEmpty(CurrentAlbumTag)) CurrentAlbumTag = string.Empty + mvcAlbum; } } #endregion } catch (Exception ex) { logger.Error("GetCurrMusicPlayItem: " + ex); } }