private void UpdateForUser(string username) { if (username == last_user) { return; } last_user = username; while (main_box.Children.Length != 0) { main_box.Remove(main_box.Children[0]); } recently_loved = new NumberedList(lastfm, Catalog.GetString("Recently Loved Tracks")); recently_played = new NumberedList(lastfm, Catalog.GetString("Recently Played Tracks")); top_artists = new NumberedList(lastfm, Catalog.GetString("My Top Artists")); //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists")); main_box.PackStart(recently_loved, false, false, 0); main_box.PackStart(new HSeparator(), false, false, 5); main_box.PackStart(recently_played, false, false, 0); main_box.PackStart(new HSeparator(), false, false, 5); main_box.PackStart(top_artists, false, false, 0); //PackStart (recommended_artists, true, true, 0); user = new LastfmUserData(username); recently_loved.SetList(user.RecentLovedTracks); recently_played.SetList(user.RecentTracks); top_artists.SetList(user.GetTopArtists(TopType.Overall)); ShowAll(); }
public static void Main(string [] args) { DataCore.CachePath = "test_lastfm_cache"; DataCore.UserAgent = "Lastfm.dll test"; string username = "******"; LastfmUserData user = new LastfmUserData (username); ProfileEntry prof = user.Profile; //Console.WriteLine ("data url: {0}", prof.DataUrl); Console.WriteLine ("profile url: {0}", user.Profile.Url); Console.WriteLine ("real name: {0}", user.Profile.RealName); Console.WriteLine ("play count: {0}", prof.PlayCount); Console.WriteLine ("gender: {0}", prof.Gender); Console.WriteLine ("age: {0}", prof.Age); Console.WriteLine ("country: {0}", prof.Country); Console.WriteLine ("registered: {0}", prof.Registered); Console.WriteLine ("profile url: {0}", user.Profile.Url); LastfmData<UserTopArtist> top_artists = user.GetTopArtists (TopType.Overall); Console.WriteLine ("\nTop Artists ({0})", top_artists.Count); foreach (UserTopArtist artist in top_artists) { Console.WriteLine ("Artist: {0}\nPlays: {1}", artist.Name, artist.PlayCount); } foreach (TopTag tag in user.TopTags) { Console.WriteLine ("top tag: {0}", tag.Name); } user.TopTags.Refresh (); System.IO.Directory.Delete ("test_lastfm_cache", true); }
/// <summary> /// Query Lastfm for UserTopArtists /// </summary> /// <remarks>Executed via Kernel Scheduler</remarks> public static void QueryLastfm() { Account account = LastfmCore.Account; if (string.IsNullOrEmpty(account.UserName) || !ServiceManager.Get <Network>().Connected) { return; } LastfmUserData userData = new LastfmUserData(account.UserName); LastfmData <UserTopArtist> topArtists = userData.GetTopArtists(TopType.Overall); Log.Debug("RandomByLastfmUserTopArtists: Searching for present artists"); Dictionary <int, int> artists = GetPresentArtists(topArtists); Log.Debug(String.Format("RandomByLastfmUserTopArtists: Found {0} of {1} Artists", artists.Count, topArtists.Count)); foreach (int cArtistId in artists.Keys) { weightedRandom.Add(cArtistId, artists[cArtistId]); } }
private void UpdateForUser(string username) { if (username == last_user) { return; } last_user = username; while (main_box.Children.Length != 0) { main_box.Remove(main_box.Children[0]); } recently_loved = new NumberedList(lastfm, Catalog.GetString("Recently Loved Tracks")); recently_played = new NumberedList(lastfm, Catalog.GetString("Recently Played Tracks")); top_artists = new NumberedList(lastfm, Catalog.GetString("My Top Artists")); //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists")); main_box.PackStart(recently_loved, false, false, 0); main_box.PackStart(new HSeparator(), false, false, 5); main_box.PackStart(recently_played, false, false, 0); main_box.PackStart(new HSeparator(), false, false, 5); main_box.PackStart(top_artists, false, false, 0); //PackStart (recommended_artists, true, true, 0); try { user = new LastfmUserData(username); recently_loved.SetList(user.RecentLovedTracks); recently_played.SetList(user.RecentTracks); top_artists.SetList(user.GetTopArtists(TopType.Overall)); } catch (Exception e) { lastfm.SetStatus("Failed to get information from your Last.fm profile", true, ConnectionState.InvalidAccount); Log.Exception(String.Format("LastfmUserData query failed for {0}", username), e); } ShowAll(); }
public static void Main(string [] args) { DataCore.CachePath = "test_lastfm_cache"; DataCore.UserAgent = "Lastfm.dll test"; string username = "******"; LastfmUserData user = new LastfmUserData(username); ProfileEntry prof = user.Profile; //Console.WriteLine ("data url: {0}", prof.DataUrl); Console.WriteLine("profile url: {0}", user.Profile.Url); Console.WriteLine("real name: {0}", user.Profile.RealName); Console.WriteLine("play count: {0}", prof.PlayCount); Console.WriteLine("gender: {0}", prof.Gender); Console.WriteLine("age: {0}", prof.Age); Console.WriteLine("country: {0}", prof.Country); Console.WriteLine("registered: {0}", prof.Registered); Console.WriteLine("profile url: {0}", user.Profile.Url); LastfmData <UserTopArtist> top_artists = user.GetTopArtists(TopType.Overall); Console.WriteLine("\nTop Artists ({0})", top_artists.Count); foreach (UserTopArtist artist in top_artists) { Console.WriteLine("Artist: {0}\nPlays: {1}", artist.Name, artist.PlayCount); } foreach (TopTag tag in user.TopTags) { Console.WriteLine("top tag: {0}", tag.Name); } user.TopTags.Refresh(); System.IO.Directory.Delete("test_lastfm_cache", true); }
private void UpdateForUser (string username) { if (username == last_user) { return; } last_user = username; while (main_box.Children.Length != 0) { main_box.Remove (main_box.Children[0]); } recently_loved = new NumberedList (lastfm, Catalog.GetString ("Recently Loved Tracks")); recently_played = new NumberedList (lastfm, Catalog.GetString ("Recently Played Tracks")); top_artists = new NumberedList (lastfm, Catalog.GetString ("My Top Artists")); //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists")); main_box.PackStart (recently_loved, false, false, 0); main_box.PackStart (new HSeparator (), false, false, 5); main_box.PackStart (recently_played, false, false, 0); main_box.PackStart (new HSeparator (), false, false, 5); main_box.PackStart (top_artists, false, false, 0); //PackStart (recommended_artists, true, true, 0); user = new LastfmUserData (username); recently_loved.SetList (user.RecentLovedTracks); recently_played.SetList (user.RecentTracks); top_artists.SetList (user.GetTopArtists (TopType.Overall)); ShowAll (); }
/// <summary> /// Query Lastfm for UserTopArtists /// </summary> /// <remarks>Executed via Kernel Scheduler</remarks> public static void QueryLastfm() { Account account = LastfmCore.Account; if(string.IsNullOrEmpty(account.UserName) || !ServiceManager.Get<Network>().Connected) return; LastfmUserData userData = new LastfmUserData (account.UserName); LastfmData<UserTopArtist> topArtists = userData.GetTopArtists (TopType.Overall); Log.Debug ("RandomByLastfmUserTopArtists: Searching for present artists"); Dictionary<int, int> artists = GetPresentArtists (topArtists); Log.Debug (String.Format ("RandomByLastfmUserTopArtists: Found {0} of {1} Artists", artists.Count, topArtists.Count)); foreach (int cArtistId in artists.Keys) { weightedRandom.Add (cArtistId, artists[cArtistId]); } }
private void UpdateForUser (string username) { if (username == last_user) { return; } last_user = username; while (main_box.Children.Length != 0) { main_box.Remove (main_box.Children[0]); } recently_loved = new NumberedList (lastfm, Catalog.GetString ("Recently Loved Tracks")); recently_played = new NumberedList (lastfm, Catalog.GetString ("Recently Played Tracks")); top_artists = new NumberedList (lastfm, Catalog.GetString ("My Top Artists")); //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists")); main_box.PackStart (recently_loved, false, false, 0); main_box.PackStart (new HSeparator (), false, false, 5); main_box.PackStart (recently_played, false, false, 0); main_box.PackStart (new HSeparator (), false, false, 5); main_box.PackStart (top_artists, false, false, 0); //PackStart (recommended_artists, true, true, 0); try { user = new LastfmUserData (username); recently_loved.SetList (user.RecentLovedTracks); recently_played.SetList (user.RecentTracks); top_artists.SetList (user.GetTopArtists (TopType.Overall)); } catch (Exception e) { lastfm.SetStatus ("Failed to get information from your Last.fm profile", true, ConnectionState.InvalidAccount); Log.Exception (String.Format ("LastfmUserData query failed for {0}", username), e); } ShowAll (); }