示例#1
0
 public InitialSynchronization(
     ILogManager logManager,
     IGoogleMusicSynchronizationService synchronizationService,
     ISongsCachingService songsCachingService,
     IAlbumArtCacheService albumArtCacheService)
 {
     this.dbContext = new DbContext();
     this.logger    = logManager.CreateLogger("InitialSynchronization");
     this.synchronizationService = synchronizationService;
     this.songsCachingService    = songsCachingService;
     this.albumArtCacheService   = albumArtCacheService;
 }
示例#2
0
        public CurrentSongPublisherService(
            ILogManager logManager,
            ISettingsService settingsService,
            IDependencyResolverContainer container,
            IAlbumArtCacheService albumArtCacheService)
        {
            this.settingsService      = settingsService;
            this.container            = container;
            this.albumArtCacheService = albumArtCacheService;
            this.logger = logManager.CreateLogger("CurrentSongPublisherService");

            this.delayPublishersHoldUp = this.settingsService.GetValue(DelayPublishersSettingsKey, defaultValue: 15000);
        }
示例#3
0
        public MusicLibrary(IMusicLibraryDbContext libraryDbContext, IDukeboxSettings settings,
                            IAlbumArtCacheService albumArtCache, AudioFileFormats audioFormats)
        {
            _dukeboxData = libraryDbContext;

            _settings      = settings;
            _audioFormats  = audioFormats;
            _albumArtCache = albumArtCache;

            RecentlyPlayed = new ObservableCollection <ITrack>();
            RecentlyPlayed.CollectionChanged += RecentlyPlayedChangedHander;

            _dbContextMutex = new SemaphoreSlim(1, 1);
            _searchService  = new MusicLibrarySearchService(libraryDbContext, this, _dbContextMutex);

            _allFilesCache = _dukeboxData.Songs.Select(s => s.FileName).ToList();
        }
        public PlaybackMonitorViewModel(IMediaPlayer mediaPlayer, IAudioPlaylist audioPlaylist,
                                        IGlobalMultimediaHotKeyService globalHotKeyService, IAlbumArtCacheService albumArtCache,
                                        ImageToImageSourceConverter imageToImageSourceConverter) : base()
        {
            _mediaPlayer                 = mediaPlayer;
            _audioPlaylist               = audioPlaylist;
            _globalHotKeyService         = globalHotKeyService;
            _albumArtCache               = albumArtCache;
            _imageToImageSourceConverter = imageToImageSourceConverter;

            UpdateAlbumArt(ImageResources.DefaultAlbumArtUri);
            PlayPauseImage = ImageResources.PlayImage;

            SetupAudioEventListeners();
            SetupPlaybackControlCommands();

            RegisterHotKeys();
        }
示例#5
0
 public SearchService(
     ILogManager logManager,
     IApplicationResources resources,
     INavigationService navigationService,
     IDispatcher dispatcher,
     IPlaylistsService playlistsService,
     ISongsRepository songsRepository,
     IUserPlaylistsRepository playlistsRepository,
     IAlbumArtCacheService albumArtCacheService)
 {
     this.logger               = logManager.CreateLogger("SearchService");
     this.resources            = resources;
     this.navigationService    = navigationService;
     this.dispatcher           = dispatcher;
     this.playlistsService     = playlistsService;
     this.songsRepository      = songsRepository;
     this.playlistsRepository  = playlistsRepository;
     this.albumArtCacheService = albumArtCacheService;
 }
示例#6
0
        private Image AddDummyImageToAlbumArtCache(IAlbumArtCacheService albumArtCache, long songId, long albumId)
        {
            var songToAdd  = new Song();
            var albumObj   = new Album();
            var metadata   = A.Fake <IAudioFileMetadata>();
            var blankImage = new Bitmap(128, 128, PixelFormat.Format32bppRgb);

            songToAdd.Id = songId;
            albumObj.Id  = albumId;

            A.CallTo(() => metadata.HasAlbumArt).Returns(true);
            A.CallTo(() => metadata.AlbumArt).Returns(blankImage);
            A.CallTo(() => metadata.GetAlbumArt(A <Action <Image> > .Ignored)).Invokes(e =>
            {
                var action = e.Arguments[0] as Action <Image>;
                action(blankImage);
            });

            albumArtCache.AddAlbumToCache(albumObj, metadata);

            return(blankImage);
        }
        public OfflineCacheViewPresenter(
            IApplicationStateService stateService,
            IAlbumArtCacheService albumArtCacheService,
            ISongsCachingService songsCachingService,
            OfflineCacheViewBindingModel bindingModel,
            ISongsCachingService cachingService,
            IGoogleMusicSessionService sessionService)
        {
            this.stateService         = stateService;
            this.albumArtCacheService = albumArtCacheService;
            this.songsCachingService  = songsCachingService;
            this.cachingService       = cachingService;
            this.sessionService       = sessionService;
            this.BindingModel         = bindingModel;

            this.BindingModel.IsLoading = true;

            this.ClearAlbumArtsCacheCommand = new DelegateCommand(this.ClearAlbumArtsCache, () => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading);
            this.ClearSongsCacheCommand     = new DelegateCommand(this.ClearSongsCache, () => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading);
            this.CancelTaskCommand          = new DelegateCommand(this.CancelTask, (e) => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading);
            this.StartDownloadCommand       = new DelegateCommand(this.StartDownload, () => this.sessionService.GetSession().IsAuthenticated&& !this.BindingModel.IsLoading && this.stateService.IsOnline() && !this.cachingService.IsDownloading() && !this.BindingModel.IsQueueEmpty);
        }
示例#8
0
        public SongsCachingService(
            ILogManager logManager,
            ISongsWebService songsWebService,
            ICachedSongsRepository songsCacheRepository,
            ISongsRepository songsRepository,
            IMediaStreamDownloadService mediaStreamDownloadService,
            IAlbumArtCacheService albumArtCacheService,
            IApplicationStateService stateService,
            IEventAggregator eventAggregator,
            IApplicationResources resources,
            INotificationService notificationService)
        {
            this.logger                     = logManager.CreateLogger("SongsCachingService");
            this.songsWebService            = songsWebService;
            this.songsCacheRepository       = songsCacheRepository;
            this.songsRepository            = songsRepository;
            this.mediaStreamDownloadService = mediaStreamDownloadService;
            this.albumArtCacheService       = albumArtCacheService;
            this.stateService               = stateService;
            this.eventAggregator            = eventAggregator;
            this.resources                  = resources;
            this.notificationService        = notificationService;

            this.eventAggregator.GetEvent <ApplicationStateChangeEvent>()
            .Subscribe(async(e) =>
            {
                if (e.CurrentState == ApplicationState.Offline)
                {
                    await this.CancelDownloadTaskAsync();
                }
                else if (e.CurrentState == ApplicationState.Online)
                {
                    this.StartDownloadTask();
                }
            });
        }
示例#9
0
 public Album(IAlbumArtCacheService albumArtCacheService)
 {
     _albumArtCacheService = albumArtCacheService;
 }