public static string AbsUrlOfArt(SpotiKatSpotify.Entity.Album album, string artist)
 {
     Lastfm.Services.Session session = new Lastfm.Services.Session("XXXXXX", "YYYYYY");
     Lastfm.Services.Artist  lArtist = new Lastfm.Services.Artist(artist, session);
     Lastfm.Services.Album   lAlbum  = new Lastfm.Services.Album(lArtist, album.Name, session);
     return(lAlbum.GetImageURL());
 }
        private string ApiSecret = ""; //signup for api secret at last.fm
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                session = new Lastfm.Services.Session(ApiKey, ApiSecret);
                session.Authenticate(Userbox.Text, Lastfm.Utilities.md5(Passbox.Password));
                if (SaveLoginCheck.IsChecked == true)
                {
                    var vault = new PasswordVault();

                    var cred = new PasswordCredential("Lastfmapp", Userbox.Text, Passbox.Password);

                    vault.Add(cred);
                }
                var    authuser = Lastfm.Services.AuthenticatedUser.GetUser(session);
                string toast    = $@"<toast>

         <visual>
       
           <binding template='ToastGeneric'>
        
              <text>Signed in</text>
           
                 <text>You are now signed in as {authuser.Name}</text>
              
                    <image placement='appLogoOverride' hint-crop='circle' src='{authuser.GetImageURL()}'/>
                     
                         </binding>
                     
                       </visual>
                     

                     </toast>";
                Windows.Data.Xml.Dom.XmlDocument doc = new Windows.Data.Xml.Dom.XmlDocument();
                doc.LoadXml(toast);
                var toastNotif = new ToastNotification(doc);


                // And send the notification
                ToastNotificationManager.CreateToastNotifier().Show(toastNotif);
            }
            catch
            {
                Windows.UI.Popups.MessageDialog messageDialog = new Windows.UI.Popups.MessageDialog("Couldn't log in");
                messageDialog.ShowAsync();
            }
        }
Beispiel #3
0
        public Connection(string clientID, string clientVersion, string username,
                          Lastfm.Services.Session authenticatedSession)
        {
            RequestParameters p = new RequestParameters();

            p["hs"] = "true";
            p["p"]  = "1.2.1";
            p["c"]  = clientID;
            p["v"]  = clientVersion;
            p["u"]  = username;
            string timestamp = Utilities.DateTimeToUTCTimestamp(DateTime.Now).ToString();

            p["t"]       = timestamp;
            p["api_key"] = authenticatedSession.APIKey;
            p["sk"]      = authenticatedSession.SessionKey;
            p["a"]       = Utilities.md5(authenticatedSession.APISecret + timestamp);

            this.handshakeParameters = p;

            ClientID = clientID;
        }
Beispiel #4
0
 private bool ConnectLastFM()
 {
     if (this.LastFM)
     {
         try
         {
             LFMSession = new Lastfm.Services.Session("3cb49ab221079da39a6fda69aa5ae556", "f93a2d205121f53a8b332f17061ba98f");
             LFMSession.Authenticate("mofortin", "c8906de3b634c32e5a1000cb2a5f6377");
         }
         catch (Exception e)
         {
             MessageBox.Show("ERROR : " + e.Message);
             return false;
         }
     }
     else
     {
         LFMSession = new Lastfm.Services.Session("", "");
     }
     return true;
 }