public static void Main(string[] args) { string username = args[0]; string password = args[1]; _listname = args[2]; InitAudio(); Console.OutputEncoding = System.Text.Encoding.UTF8; Spotify.Environment.UnhandledException += Environment_UnhandledException; Spotify.SessionConfig sessionConfig = new Spotify.SessionConfig(); sessionConfig.ApplicationKeyFile = @"c:\Temp\spotify_appkey.key"; sessionConfig.UserAgent = "jukebox-example"; _session = Spotify.Session.Create(sessionConfig); _session.LoggedIn += session_OnLoggedIn; _session.MusicDelivered += session_OnMusicDelivered; _session.MetadataUpdated += session_OnMetadataUpdated; _session.PlayTokenLost += session_OnPlayTokenLost; _session.LogMessage += session_OnLogMessage; _session.EndOfTrack += session_OnEndOfTrack; _session.LoginAsync(new Spotify.LoginParameters() { UserName = username, Password = password }, null); _session.ProcessEvents(); }
public static void Main(string[] args) { string username = args[0]; string password = args[1]; Console.OutputEncoding = System.Text.Encoding.UTF8; Spotify.Environment.UnhandledException += Environment_UnhandledException; var sessionConfig = new Spotify.SessionConfig(); // sessionConfig.ApplicationKey = myApplicationKey; // I'm using a file instead of the byte array. The spotify_appkey.key is NOT a text file. It's the bytes // of the application key in binary format. sessionConfig.ApplicationKeyFile = @"c:\Temp\spotify_appkey.key"; sessionConfig.UserAgent = "playground"; var session = Spotify.Session.Create(sessionConfig); session.LoggedIn += session_LoggedIn; session.MessageToUser += session_MessageToUser; session.LogMessage += session_LogMessage; session.CredentialsBlobUpdated += session_CredentialsBlobUpdated; GetArtistProtraits(session, username, password) .ContinueWith((continuation) => { session.Shutdown(); }); Console.WriteLine("Processing Events"); session.ProcessEvents(); }