public SpotifyDownloader() { if (!Directory.Exists(_tmpPath)) { Directory.CreateDirectory(_tmpPath); } if (!Directory.Exists(_downloadPath)) { Directory.CreateDirectory(_downloadPath); } var config = new SpotifySessionConfig() { ApiVersion = 12, CacheLocation = _tmpPath, SettingsLocation = _tmpPath, ApplicationKey = File.ReadAllBytes("spotify_appkey.key"), UserAgent = "downtify", Listener = this }; _syncContext = SynchronizationContext.Current; _session = SpotifySession.Create(config); }
public SpotifyDownloader() { if (!Directory.Exists(tmpPath)) { Directory.CreateDirectory(tmpPath); } if (!Directory.Exists(downloadPath)) { Directory.CreateDirectory(downloadPath); } var config = new SpotifySessionConfig() { ApiVersion = 12, CacheLocation = tmpPath, SettingsLocation = tmpPath, ApplicationKey = File.ReadAllBytes("spotify_appkey.key"), UserAgent = "downtify", Listener = this }; syncContext = SynchronizationContext.Current; session = SpotifySession.Create(config); Task.Factory.StartNew(() => InvokeProcessEvents()); }
public SpotifyDownloader() { tmpPath = Downtify.GUI.frmMain.configuration.GetConfiguration("cache", "cache/"); downloadPath = Downtify.GUI.frmMain.configuration.GetConfiguration("download", "download/"); if (!Directory.Exists(tmpPath)) { Directory.CreateDirectory(tmpPath); } if (!Directory.Exists(downloadPath)) { Directory.CreateDirectory(downloadPath); } var config = new SpotifySessionConfig() { ApiVersion = 12, CacheLocation = tmpPath, SettingsLocation = tmpPath, ApplicationKey = File.ReadAllBytes("spotify_appkey.key"), UserAgent = "downtify", Listener = this }; syncContext = SynchronizationContext.Current; session = SpotifySession.Create(config); }
public ISpotifySession Create() { var config = new SpotifySessionConfig { ApiVersion = ApiVersion, ApplicationKey = ApplicationKey, CacheLocation = "Temp", SettingsLocation = "Temp", UserAgent = "HeadlessPlayer", Listener = new SpotifySessionListenerToEventAdapter(_bus, _soundOutput, _spotifyLogProcessor) }; return(SpotifySession.Create(config)); }
private void Setup() { var cachePath = Properties.Settings.Default.CacheDirectory; if (!Directory.Exists(cachePath)) { Directory.CreateDirectory(cachePath); } var config = new SpotifySessionConfig() { ApiVersion = 12, CacheLocation = cachePath, SettingsLocation = cachePath, ApplicationKey = Properties.Resources.spotify_appkey, UserAgent = "Loadify", Listener = this }; _Synchronization = SynchronizationContext.Current; _Session = SpotifySession.Create(config); }
public SpotifySessionListenerWrapper(String username, String password) { _username = username; _password = password; _backgroundThread = new Thread(RunBackgroundThread); _backgroundThread.IsBackground = true; _notifyHandle = new EventWaitHandle(false, EventResetMode.AutoReset); _exitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); _loggedInHandle = new EventWaitHandle(false, EventResetMode.ManualReset); SpotifySessionConfig config = new SpotifySessionConfig(); config.ApiVersion = 12; config.CacheLocation = "tmp"; config.SettingsLocation = "tmp"; config.ApplicationKey = APIKey; config.UserAgent = "SAMI"; config.Listener = this; _session = SpotifySession.Create(config); _backgroundThread.Start(); }
public static extern Error sp_session_create(ref SpotifySessionConfig config, out IntPtr sessionPtr);
public SpShell(AutoResetEvent aSpotifyEvent, string aUsername, string aPassword, string aBlob, bool aSelftest, ConsoleReader aReader, byte[] aAppKey) { iReader = aReader; iSpotifyEvent = aSpotifyEvent; SpotifySessionConfig config = new SpotifySessionConfig(); config.ApiVersion = 12; config.CacheLocation = aSelftest ? "" : "tmp"; config.SettingsLocation = aSelftest ? "" : "tmp"; config.ApplicationKey = aAppKey; config.UserAgent = "spshell#"; config.Listener = this; try { iSession = SpotifySession.Create(config); } catch (SpotifyException e) { Console.Error.WriteLine("Failed to create session: {0}", e.Message); throw; } iBrowser = new Browser(iSession, this, aReader); iSearcher = new Searcher(iSession, aReader); iTopLister = new TopLister(iSession, aReader); iMessaging = new Messaging(iSession, aReader, iBrowser); iStarManager = new StarManager(iSession, aReader, iBrowser); iPlaylistManager = new PlaylistManager(iSession, aReader, iBrowser); iCommands = new ConsoleCommandDictionary(CmdDone) { { "log", CmdLog, "Enable/Disable logging to console (default off)" }, { "logout", CmdLogout, "Logout and exit app" }, { "exit", CmdLogout, "Logout and exit app" }, { "quit", CmdLogout, "Logout and exit app" }, { "browse", iBrowser.CmdBrowse, "Browse a Spotify URL" }, { "search", iSearcher.CmdSearch, "Search" }, { "whatsnew", iSearcher.CmdWhatsNew, "List new albums" }, { "toplist", iTopLister.CmdTopList, "Browse toplists" }, { "post", iMessaging.CmdPost, "Post track to a user's inbox" }, { "inbox", iMessaging.CmdInbox, "View inbox" }, { "star", iStarManager.CmdStar, "Star a track" }, { "unstar", iStarManager.CmdUnstar, "Unstar a track" }, { "starred", iStarManager.CmdStarred, "List all starred tracks" }, { "playlists", iPlaylistManager.CmdPlaylists, "List playlists" }, { "playlist", iPlaylistManager.CmdPlaylist, "List playlist contents" }, { "set_autolink", iPlaylistManager.CmdSetAutolink, "Set autolinking state" }, { "add_folder", iPlaylistManager.CmdAddFolder, "Add playlist folder" }, { "update_subscriptions", iPlaylistManager.CmdUpdateSubscriptions, "Update playlist subscription info" }, { "add", iPlaylistManager.CmdAddTrack, "Add track to playlist" }, { "offline", iPlaylistManager.CmdPlaylistOffline, "Set offline mode for a playlist" }, }; iCommands.Add("help", iCommands.CmdHelp, "This help"); try { if (aUsername == null) { iSession.Relogin(); var reloginname = iSession.RememberedUser(); Console.Error.WriteLine("Trying to relogin as user {0}", reloginname); } else { iSession.Login(aUsername, aPassword, true, aBlob); } } catch (SpotifyException e) { if (e.Error == SpotifyError.NoCredentials) { Console.Error.WriteLine("No stored credentials"); throw; } } }