Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using SpotifyAPI.Web;
  8. using SpotifyAPI.Web.Auth;
  9. using SpotifyAPI.Web.Enums;
  10. using SpotifyAPI.Web.Models;
  11.  
  12. namespace SpotifyLocalAPI
  13. {
  14.     class Program
  15.     {
  16.         private static SpotifyWebAPI _spotify = null;
  17.         private static async void RunAuthentication()
  18.         {
  19.             WebAPIFactory webApiFactory = new WebAPIFactory(
  20.                 "http://localhost",
  21.                 8000,
  22.                 "YOUR_APPLICATION_SECRET_KEY_KEY_HERE",
  23.                 Scope.UserReadPrivate | Scope.UserReadEmail | Scope.PlaylistReadPrivate | Scope.UserLibraryRead |
  24.                 Scope.UserReadPrivate | Scope.UserFollowRead | Scope.UserReadBirthdate | Scope.UserTopRead | Scope.PlaylistReadCollaborative |
  25.                 Scope.UserReadRecentlyPlayed | Scope.UserReadPlaybackState | Scope.UserModifyPlaybackState);
  26.  
  27.             try
  28.             {
  29.                 _spotify = await webApiFactory.GetWebApi();
  30.             }
  31.             catch (Exception ex)
  32.             {
  33.                 Console.WriteLine(ex.Message);
  34.             }
  35.            
  36.         }
  37.  
  38.         static void Main(string[] args)
  39.         {
  40.             Task.Run(() => RunAuthentication()).Wait();
  41.             Console.WriteLine("Hello");
  42.  
  43.             _spotify.PausePlayback();
  44.             Thread.Sleep(2000);
  45.             _spotify.ResumePlayback();
  46.             var g = _spotify.GetPlayback();
  47.            
  48.  
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement