Exemplo n.º 1
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            _authService = new SpotifyAuthService(_httpFactory, _configuration);
            var token = await _authService.GetAccessToken();

            request.Headers.Authorization = new AuthenticationHeaderValue(ApiConstants.Bearer, token);

            return(await base.SendAsync(request, cancellationToken));
        }
Exemplo n.º 2
0
 public SpotifyService(ILogger <SpotifyService> logger,
                       ISpotifyAuthService authService,
                       ISpotifySongService songService,
                       IPartyService partyService)
 {
     Logger       = logger;
     AuthService  = authService;
     SongService  = songService;
     PartyService = partyService;
 }
Exemplo n.º 3
0
 public AdminController(ISpotifyAuthService spotifyAuthService, IStorageService storageService)
 {
     _spotifyAuthService = spotifyAuthService;
     _storageService     = storageService;
     _usernames          = new Dictionary <string, string>
     {
         { "karnage11i", "Alex Karney" },
         { "magsatire", "Jack McGrath" },
         { "1232101260", "Chris Quigley" },
         { "1238290776", "Joshua Landy" },
         { "1233033915", "Alex Barker" },
         { "1244598275", "Dan Hornblower" },
         { "0o061owch3c4i23oxchbq5tll", "Josh Anderson" }
     };
 }
Exemplo n.º 4
0
        private static void FetchTrackAndAdd(ISpotifyAuthService spotifyAuthService, IStorageService storageService)
        {
            while (true && spotifyAuthService.IsListening)
            {
                var api = new SpotifyWebApi.SpotifyWebApi(spotifyAuthService.GetToken());
                var currentlyPlayingContext = api.Player.GetCurrentlyPlayingContext().Result;
                if (currentlyPlayingContext != null)
                {
                    var track = CurrentlyPlayingContextToTrackEntity.Map(currentlyPlayingContext);
                    storageService.AddTrack(track);

                    Thread.Sleep(currentlyPlayingContext.Item.DurationMs - currentlyPlayingContext.ProgressMs.Value + 2000);
                }
                else
                {
                    Thread.Sleep(30 * 1000);
                }
            }
        }
Exemplo n.º 5
0
 public HomeController(IStorageService storageService, ISpotifyAuthService spotifyAuthService)
 {
     _storageService     = storageService;
     _spotifyAuthService = spotifyAuthService;
     _usernames          = new Dictionary <string, UsernameModel>
     {
         { "karnage11i", new UsernameModel("Alex Karney", "ak") },
         { "magsatire", new UsernameModel("Jack McGrath", "jm") },
         { "1232101260", new UsernameModel("Chris Quigley", "cq") },
         { "1238290776", new UsernameModel("Joshua Landy", "jl") },
         { "1233033915", new UsernameModel("Alex Barker", "ab") },
         { "1244598275", new UsernameModel("Dan Hornblower", "dh") },
         { "genjamon1234", new UsernameModel("Josh Anderson", "ja") },
         { "12138108557", new UsernameModel("Veashka Rojas", "vr") },
         { "gardenbed", new UsernameModel("Georgia Robinson", "gr") },
         { "billysakalis", new UsernameModel("Billy Sakalis", "bs") },
         { "braeden.wilson", new UsernameModel("Braeden Wilson", "bw") },
         { "1278556031", new UsernameModel("Matt Knightbridge", "mk") },
         { "griffkyn22", new UsernameModel("Griffyn Heels", "gh") }
     };
 }
Exemplo n.º 6
0
 public AdminController(ISpotifyAuthService spotifyAuthService, IStorageService storageService)
 {
     _spotifyAuthService = spotifyAuthService;
     _storageService     = storageService;
     _usernames          = new Dictionary <string, string>
     {
         { "karnage11i", "Alex Karney" },
         { "magsatire", "Jack McGrath" },
         { "1232101260", "Chris Quigley" },
         { "1238290776", "Joshua Landy" },
         { "1233033915", "Alex Barker" },
         { "1244598275", "Dan Hornblower" },
         { "genjamon1234", "Josh Anderson" },
         { "12138108557", "Veashka Rojas" },
         { "gardenbed", "Georgia Robinson" },
         { "billysakalis", "Billy Sakalis" },
         { "braeden.wilson", "Braeden Wilson" },
         { "1278556031", "Matt Knightbridge" },
         { "griffkyn22", "Griffyn Heels" }
     };
 }
Exemplo n.º 7
0
 public PlaylistService(ISpotifyAuthService spotifyAuthService)
 {
     SpotifyAuthService = spotifyAuthService ?? throw new ArgumentNullException(nameof(spotifyAuthService));;
 }
 public SpotifyLibraryService(IConfiguration config, ISpotifyAuthService spotifyAuth)
 {
     _config             = config;
     _spotifyAuth        = spotifyAuth;
     _tracksWithFeatures = new AsyncLazy <List <UserTrackWithFeaturesDto> >(async() => await loadSpotifyTracks());
 }
Exemplo n.º 9
0
 public SpotifyAuthController(IConfiguration config, ISpotifyAuthService spotifyAuth) : base()
 {
     _config      = config;
     _spotifyAuth = spotifyAuth;
 }
 public PlaylistController(ISpotifyAuthService spotifyAuthService)
 {
     _spotifyAuthService = spotifyAuthService;
 }
 public CallbackController(ISpotifyAuthService spotifyAuthService)
 {
     _spotifyAuthService = spotifyAuthService;
 }
Exemplo n.º 12
0
 public SearchService(ISpotifyAuthService spotifyAuthService)
 {
     SpotifyAuthService = spotifyAuthService ?? throw new ArgumentNullException(nameof(spotifyAuthService));
 }