Beispiel #1
0
 public PlaylistService(
     ISongkickService songkickService,
     ISpotifyService spotifyService)
 {
     _songkickService = songkickService;
     _spotifyService  = spotifyService;
 }
Beispiel #2
0
        public SpotifyServiceTests()
        {
            var webApiLibraryService       = new Mock <IWebApiService>();
            var webApiAuthorizationService = new Mock <IWebApiAuthorizationService>();

            _spotifyService = new SpotifyService(webApiLibraryService.Object, webApiAuthorizationService.Object);
        }
Beispiel #3
0
        public async static void AddMusicFileSpotify(string trackID)
        {
            if (String.IsNullOrWhiteSpace(trackID))
            {
                throw new ArgumentException($"Cannot add new music file, since its ID is null or empty.", nameof(trackID));
            }

            try
            {
                ISpotifyService             spotifyService = DependencyInjector.GetService <ISpotifyService>();
                Dictionary <string, string> tagData        = await spotifyService.GetTrackData(trackID);

                MetaData trackData = UtilityHelper.FormatMetaDataSpotify(tagData, out string trackURI);

                TrackVirtual track = new TrackVirtual(trackData, false);
                track.SpotifyID  = trackID;
                track.SpotifyURI = trackURI;
                SpotifyTracks.Add(track);
                FilteredSpotifyTracks.Add(track);
            }
            catch (Exception) // TODO: more polished exception handling
            {
                UtilityHelper.ShowExceptionDialog(
                    "Track parsing error",
                    "Track parsing error happened while trying to parse a music file from Spotify. This file will be omitted from Playzone!",
                    $"Track URI: {trackID}");
            }
        }
Beispiel #4
0
        public UserModule(IRestClientWrapper restClientWrapper, ISpotifyService spotifyService)
        {
            Get["/user", true] = async(parameters, ct) =>
            {
                string name          = this.Request.Query["Name"];
                string contry        = this.Request.Query["Contry"];
                string spotifyUserId = this.Request.Query["SpotifyUserId"];

                var user = new User {
                    Country = contry, Name = name, SpotifyUserId = spotifyUserId
                };

                var userResult = await restClientWrapper.PostAsync <UserResult>(user, "User");

                return(userResult);
            };
            Get["/spotifyUser", true] = async(parameters, ct) =>
            {
                string token = this.Request.Query["token"];

                var user = await spotifyService.GetUser(token);


                return(user);
            };
        }
Beispiel #5
0
 public SpotifyArtistViewModel(ISpotifyService service, IScrobblerService scrobbler, SettingViewModel settingViewModel)
 {
     _service               = service;
     _scrobbler             = scrobbler;
     _songClickRelayCommand = new Command <ItemClickEventArgs>(SongClickExecute);
     SettingViewModel       = settingViewModel;
 }
Beispiel #6
0
 public HomeController(ILogger <HomeController> logger, ISpotifyAccountService spotifyAccountService, IConfiguration configuration, ISpotifyService spotifyService)
 {
     _logger = logger;
     _spotifyAccountService = spotifyAccountService;
     _configuration         = configuration;
     _spotifyService        = spotifyService;
 }
Beispiel #7
0
        public PlayzoneViewModel() : base()
        {
            spotifyService = DependencyInjector.GetService <ISpotifyService>();
            foobarService  = DependencyInjector.GetService <IFoobarService>();

            player = new PlayzoneBackgroundWorker();

            localSelectedArtist = null;
            localSelectedAlbum  = null;
            localSelectedGenre  = null;

            onlineSelectedArtist = null;
            onlineSelectedAlbum  = null;
            onlineSelectedGenre  = null;

            LocalSupportedPlayers  = GetLocalSupportedPlayers();
            OnlineSupportedPlayers = GetOnlineSupportedPlayers();
            MixList = new ObservableCollection <TrackBase>();

            LocalSelectAllCommand     = new RelayCommand <object>(exe => ExecuteLocalSelectAll(), can => CanExecuteLocalSelectAll);
            LocalSelectReverseCommand = new RelayCommand <object>(exe => ExecuteLocalSelectReverse(), can => CanExecuteLocalSelectReverse);
            LocalManageFiltersCommand = new RelayCommand <object>(exe => ExecuteLocalManageFilters(), can => CanExecuteLocalManageFilters);
            LocalAddToMixCommand      = new RelayCommand <object>(exe => ExecuteLocalAddToMix(), can => CanExecuteLocalAddToMix);

            OnlineSelectAllCommand     = new RelayCommand <object>(exe => ExecuteOnlineSelectAll(), can => CanExecuteOnlineSelectAll);
            OnlineSelectReverseCommand = new RelayCommand <object>(exe => ExecuteOnlineSelectReverse(), can => CanExecuteOnlineSelectReverse);
            OnlineManageFiltersCommand = new RelayCommand <object>(exe => ExecuteOnlineManageFilters(), can => CanExecuteOnlineManageFilters);
            OnlineAddToMixCommand      = new RelayCommand <object>(exe => ExecuteOnlineAddToMix(), can => CanExecuteOnlineAddToMix);

            PlayCommand   = new RelayCommand <object>(exe => ExecutePlay(), can => CanExecutePlay);
            PauseCommand  = new RelayCommand <object>(exe => ExecutePause(), can => CanExecutePause);
            RemoveCommand = new RelayCommand <object>(exe => ExecuteRemove(), can => CanExecuteRemove);
        }
Beispiel #8
0
 public async Task Invoke(HttpContext context, ISpotifyService spotifyService)
 {
     if (context.User.Identity.IsAuthenticated)
     {
         spotifyService.AccessToken = context.User.Claims.FirstOrDefault(c => c.Type == "spotifyAccessToken")?.Value;
     }
     await _next(context);
 }
 public HomeController(IOptions <SetlistConfig> config, ILogger <HomeController> log, ISetlistBuilder setlistBuilder, ISpotifyService spotifyService, IRequestLogger requestLogger)
 {
     _config         = config;
     _log            = log;
     _setlistBuilder = setlistBuilder;
     _spotifyService = spotifyService;
     _requestLogger  = requestLogger;
 }
Beispiel #10
0
        public MusicViewModel(ISpotifyService spotifyService)
        {
            SpotifyService = spotifyService;

            PreviousCommand       = new RelayCommand(async() => await SpotifyService.PreviousTrackAsync());
            TogglePlaybackCommand = new RelayCommand(async() => await TogglePlaybackAsync());
            NextCommand           = new RelayCommand(async() => await SpotifyService.NextTrackAsync());
        }
        public SpotifyLoginPageViewModel(INavigationService ns, IWebAuthService was, ISpotifyService ss)
        {
            _navigationService = ns;
            _webAuthService    = was;
            _spotifyService    = ss;

            OpenAuthenticationPageCommand = new DelegateCommand(async() => await OpenAuthenticationPage());
        }
Beispiel #12
0
        public ListenSessionService(ISpotifyService spotifyService, CloudTableClient client)
        {
            this.spotifyService = spotifyService;
            this.client         = client;

            this.table = client.GetTableReference(TableName);
            table.CreateIfNotExistsAsync().Wait();
        }
Beispiel #13
0
 public SpotifyAuthCallback(ISpotifyService spotifyService, IUserService userService,
                            ICommandService commandService, ITelegramBotClient telegramBotClient)
 {
     this.spotifyService    = spotifyService;
     this.userService       = userService;
     this.commandService    = commandService;
     this.telegramBotClient = telegramBotClient;
 }
 public SpotifyController(
     ISpotifyAccountService spotifyAccountService,
     ISpotifyService spotifyService,
     IConfiguration configuration)
 {
     _spotifyAccountService = spotifyAccountService;
     _spotifyService        = spotifyService;
     _configuration         = configuration;
 }
Beispiel #15
0
        public App(ISpotifyService spotifyService, IAudioRecordingService recordingService, ISongWriter songWriter, IID3TagService id3TagService)
        {
            this._spotifyService = spotifyService;
            this._recordingService = recordingService;
            this._songWriter = songWriter;
            this._id3TagService = id3TagService;

            this._recordedSongs = new List<Song>();
        }
Beispiel #16
0
 public TopTracksCommand(
     ILastfmService lastfmService,
     ILastfmUsernameService lastfmUsernameService,
     ISpotifyService spotifyService)
 {
     this.lastfmService         = lastfmService;
     this.lastfmUsernameService = lastfmUsernameService;
     this.spotifyService        = spotifyService;
 }
Beispiel #17
0
 public NowPlayingCommand(
     ILastfmService lastfmService,
     ISpotifyService spotifyService,
     ILastfmUsernameService lastfmUsernameService)
 {
     this.lastfmService         = lastfmService;
     this.spotifyService        = spotifyService;
     this.lastfmUsernameService = lastfmUsernameService;
 }
 public SpotkickApiController(
     IArtistService artistService,
     IUserService userService,
     ISpotifyService spotifyService)
 {
     _artistService  = artistService;
     _userService    = userService;
     _spotifyService = spotifyService;
 }
Beispiel #19
0
 public HomeController(
     ISpotifyAccountService spotifyAccountService,
     IConfiguration configuration,
     ISpotifyService spotifyService)
 {
     _spotifyAccountService = spotifyAccountService;
     _configuration         = configuration;
     _spotifyService        = spotifyService;
 }
 public AlbumService(IBoomkatFeedItemService boomkatBoomkatFeedItemService,
                     ISpotifyService spotifyService, ISbwrFeedItemService sbwrFeedItemService,
                     INewRelicTransactionManager newRelicTransactionManager)
 {
     _boomkatBoomkatFeedItemService = boomkatBoomkatFeedItemService;
     _spotifyService             = spotifyService;
     _sbwrFeedItemService        = sbwrFeedItemService;
     _newRelicTransactionManager = newRelicTransactionManager;
 }
Beispiel #21
0
 public WantlistController(UserManager <ApplicationUser> userManager, IVinylRepository vinylRepo,
                           Func <string, IListRepository> listRepositoryAccessor, IUserService userService, ISpotifyService spotifyService)
 {
     _userManager            = userManager;
     _vinylRepo              = vinylRepo;
     _listRepositoryAccessor = listRepositoryAccessor;
     _userService            = userService;
     _spotifyService         = spotifyService;
 }
        public SpotifyAlbumViewModel(ISpotifyService service)
        {
            SongClickRelayCommand = new RelayCommand<ItemClickEventArgs>(SongClickExecute);
            _service = service;

            MessengerInstance.Register<GenericMessage<string>>(this, "spotify-album-detail", ReceivedId);

            if (IsInDesignMode)
                LoadData("");
        }
 public LastAlbumService(IBoomkatFeedItemService boomkatFeedItemService,
                         ISbwrFeedItemService sbwrFeedItemService, ISpotifyService spotifyService,
                         ISbwrConfiguration sbwrConfiguration, INewRelicTransactionManager newRelicTransactionManager)
 {
     _boomkatFeedItemService     = boomkatFeedItemService;
     _spotifyService             = spotifyService;
     _sbwrConfiguration          = sbwrConfiguration;
     _newRelicTransactionManager = newRelicTransactionManager;
     _sbwrFeedItemService        = sbwrFeedItemService;
 }
Beispiel #24
0
 public SpotifyAlbumViewModel(ISpotifyService spotify,
                              IScrobblerService service,
                              IMiscellaneousService misc,
                              CollectionCommandHelper commands)
 {
     _service  = service;
     _misc     = misc;
     _commands = commands;
     _songClickRelayCommand = new Command <ItemClickEventArgs>(SongClickExecute);
 }
        public RecommendationService(IUserService userService,
                                     IWeatherMapsService weatherMapsService,
                                     ISpotifyService spotifyService)
        {
            _userService        = userService;
            _weatherMapsService = weatherMapsService;
            _spotifyService     = spotifyService;

            InstantiateRecommendations();
        }
Beispiel #26
0
        public PlaylistTrackingService(IPersistenceService persistenceService, IPlaylistService playlistService, ISpotifyService spotifyService)
        {
            _persistenceService = persistenceService;
            _playlistService    = playlistService;
            _spotifyService     = spotifyService;

            _initLock = new SemaphoreSlim(1, 1);
            _lastBangerPlayedIndex = -1;
            _lastFillerPlayedIndex = -1;
        }
Beispiel #27
0
 public ModeProvider(ISpotifyService spotifyService,
                     IPlaylistService playlistService,
                     IPlaylistTrackingService trackingService,
                     IPersistenceService persistenceService)
 {
     _spotifyService     = spotifyService;
     _playlistService    = playlistService;
     _persistenceService = persistenceService;
     _componentPlaylistTrackingService = trackingService;
 }
Beispiel #28
0
        public PlaylistService(ISpotifyService spotifyService, IOptions <SpotifyOptions> options)
        {
            _spotifyService       = spotifyService;
            _bangerPlaylistId     = options.Value.BangerPlaylistId;
            _fillerPlaylistId     = options.Value.FillerPlaylistId;
            _endOfNightPlaylistId = options.Value.EndOfNightPlaylistId;
            _playbackPlaylistId   = options.Value.PlaybackPlaylistId;

            _initLock = new SemaphoreSlim(1, 1);
        }
Beispiel #29
0
 public RingoBotCommands(
     IAuthService authService,
     IRingoService ringoService,
     ISpotifyService spotifyService,
     ILogger <RingoBotCommands> logger)
 {
     _authService    = authService;
     _ringoService   = ringoService;
     _spotifyService = spotifyService;
     _logger         = logger;
 }
Beispiel #30
0
        public QueueProvider(IPlaylistService playlistService,
                             IPlaylistTrackingService playlistTrackingService,
                             ISpotifyService spotifyService,
                             IOptions <SpotifyOptions> options)
        {
            _playlistService         = playlistService;
            _playlistTrackingService = playlistTrackingService;
            _spotifyService          = spotifyService;

            _specialSongMap = options.Value.SpecialSongs;
        }
Beispiel #31
0
 public SpotkickController(
     ISpotifyService spotifyService,
     IArtistService artistService,
     UserManager <User> userManager,
     SignInManager <User> signInManager)
 {
     _spotifyService = spotifyService;
     _artistService  = artistService;
     _userManager    = userManager;
     _signInManager  = signInManager;
 }
Beispiel #32
0
        public SpotifyAlbumViewModel(ISpotifyService service)
        {
            SongClickRelayCommand = new RelayCommand <ItemClickEventArgs>(SongClickExecute);
            _service = service;

            MessengerInstance.Register <GenericMessage <string> >(this, "spotify-album-detail", ReceivedId);

            if (IsInDesignMode)
            {
                LoadData("");
            }
        }
Beispiel #33
0
        /// <summary>
        ///     Initializes a new instance of the MainViewModel class.
        /// </summary>
        /// <param name="collectionService">
        ///     The collection service.
        /// </param>
        /// <param name="service">
        ///     The service.
        /// </param>
        /// <param name="spotify">
        ///     The spotify.
        /// </param>
        /// <param name="audioticaService">
        ///     The audiotica service.
        /// </param>
        /// <param name="audioPlayer">
        ///     The audio player.
        /// </param>
        /// <param name="playerViewModel"></param>
        public MainViewModel(
            ICollectionService collectionService,
            IScrobblerService service,
            ISpotifyService spotify,
            IAudioticaService audioticaService,
            AudioPlayerHelper audioPlayer,
            PlayerViewModel playerViewModel)
        {
            PlayerViewModel = playerViewModel;
            _collectionService = collectionService;
            _service = service;
            _spotify = spotify;
            _audioticaService = audioticaService;
            _audioPlayer = audioPlayer;
            _collectionService.LibraryLoaded += CollectionServiceOnLibraryLoaded;
            _audioPlayer.TrackChanged += CollectionServiceOnLibraryLoaded;

            // Load data automatically
            LoadChartDataAsync();
        }