Esempio n. 1
0
        public async Task <UpdatePlaylistPayload> RemoveSongFromPlaylistAsync
            (int playlistId, int songId, [Service] IPlaylistService playlistService)
        {
            var success = await playlistService.RemoveSongAsync(playlistId, songId);

            return(new UpdatePlaylistPayload(success));
        }
Esempio n. 2
0
 public PlaylistController(IPlaylistService playlistService, ILoggerFactory logger, ICacheManager cacheManager,
                           UserManager <ApplicationUser> userManager, IRoadieSettings roadieSettings)
     : base(cacheManager, roadieSettings, userManager)
 {
     this.Logger          = logger.CreateLogger("RoadieApi.Controllers.PlaylistController");
     this.PlaylistService = playlistService;
 }
Esempio n. 3
0
        // Playlists <-> Song Mutations

        public async Task <UpdatePlaylistPayload> AddSongToPlaylistAsync
            (int playlistId, AddSongInput songInput, [Service] IPlaylistService playlistService)
        {
            var success = await playlistService.AddSongAsync(playlistId, songInput);

            return(new UpdatePlaylistPayload(success));
        }
Esempio n. 4
0
 public PlaylistController(IPlaylistService playlistService, ILogger <PlaylistController> logger, ICacheManager cacheManager,
                           UserManager <User> userManager, IRoadieSettings roadieSettings)
     : base(cacheManager, roadieSettings, userManager)
 {
     Logger          = logger;
     PlaylistService = playlistService;
 }
 public PlaylistController(
     IMapper mapper,
     IPlaylistService playlistService)
 {
     _mapper = mapper;
     _playlistService = playlistService;
 }
Esempio n. 6
0
 public PlaylistsController(IPlaylist playlist, IErrorLoggingService logger, IPlaylistService playlistsService,
                            ICloudService cloudService, IPlaySettings playSettings, IAppSettings appSettings)
     : base(cloudService, playlist, logger, playSettings)
 {
     _appSettings      = appSettings;
     _playlistsService = playlistsService;
 }
        //ToanTXSE
        //Get playlist List by location ID
        public static List <Models.PlaylistDetailVM> GetPlaylistIdByBrandIdAndStatus()
        {
            IPlaylistService     playlistService     = DependencyUtils.Resolve <IPlaylistService>();
            IPlaylistItemService playlistItemService = DependencyUtils.Resolve <IPlaylistItemService>();
            IBrandService        brandService        = DependencyUtils.Resolve <IBrandService>();
            var mapper           = DependencyUtils.Resolve <IMapper>();
            var user             = Helper.GetCurrentUser();
            var playlistList     = playlistService.GetPlaylistIdByBrandId(user.BrandID);
            var playlistDetailVM = new List <Models.PlaylistDetailVM>();

            foreach (var item in playlistList)
            {
                if (item.isPublic == true)
                {
                    var m = new Models.PlaylistDetailVM
                    {
                        Title        = item.Title,
                        Description  = item.Description,
                        Id           = item.PlaylistID,
                        isPublic     = (bool)item.isPublic,
                        Duration     = playlistItemService.GetTotalDuration(item.PlaylistID),
                        VisualTypeID = item.VisualTypeID ?? 1,
                    };
                    playlistDetailVM.Add(m);
                }
            }
            //playlistDetailVM = playlistList.Select(mapper.Map<Playlist, Models.PlaylistDetailVM>).ToList();
            return(playlistDetailVM);
        }
        public CommonViewModelBase(IUnityContainer container) : base(container)
        {
            // UnityContainer
            this.container = container;

            // EventAggregator
            this.eventAggregator = container.Resolve <IEventAggregator>();

            // Services
            this.providerService   = container.Resolve <IProviderService>();
            this.indexingService   = container.Resolve <IIndexingService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.collectionService = container.Resolve <ICollectionService>();
            this.metadataService   = container.Resolve <IMetadataService>();
            this.i18nService       = container.Resolve <II18nService>();
            this.playlistService   = container.Resolve <IPlaylistService>();

            // Handlers
            this.providerService.SearchProvidersChanged += (_, __) => { this.GetSearchProvidersAsync(); };

            // Repositories
            this.trackRepository = container.Resolve <ITrackRepository>();

            // Initialize the search providers in the ContextMenu
            this.GetSearchProvidersAsync();

            // Initialize
            this.Initialize();
        }
        public PlaylistTabViewModel(IPlaylistService horsifyPlaylistService, IQueuedSongDataProvider queuedSongDataProvider, IRegionManager regionManager, IEventAggregator eventAggregator, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _horsifyPlaylistService = horsifyPlaylistService;
            _queuedSongDataProvider = queuedSongDataProvider;
            _eventAggregator        = eventAggregator;
            _regionManager          = regionManager;

            //Create playlist item collection and assign the ICollectionView
            PlayListItemViewModels = new ObservableCollection <PlaylistItemViewModel>();
            PlayListItems          = new ListCollectionView(PlayListItemViewModels);

            //Hook up to the add to Playlist event.
            //Only fires if the key of the dictionary is the same as this playlist name
            _eventAggregator.GetEvent <AddToPlaylistEvent>()
            .Subscribe(OnAddToPlayList, ThreadOption.PublisherThread, false,
                       x => x.ContainsKey(TabHeader));

            ClearItemsCommand   = new DelegateCommand(OnClearItemsCommand);
            SavePlaylistCommand = new DelegateCommand(OnSavePlaylistCommand);
            AddToQueueCommand   = new DelegateCommand <PlaylistItemViewModel>(OnAddToQueue);
            RemoveItemCommand   = new DelegateCommand <PlaylistItemViewModel>(OnRemoveItem);
            PlayItemCommand     = new DelegateCommand <PlaylistItemViewModel>(OnPlayItem);

            SelectSongCommand = new DelegateCommand <PlaylistItemViewModel>(OnShowSongInfo);
        }
Esempio n. 10
0
 public PlaylistManager(MenuView menuView, ISongService songService, IPlaylistService playlistService)
 {
     _menuView        = menuView;
     _playlistService = playlistService;
     _songService     = songService;
     helper           = new HelperMethods();
 }
Esempio n. 11
0
 public PlaylistViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService, IUserDialogs userDialogs, IMediaManager mediaManager, IPlaylistService playlistService)
     : base(logProvider, navigationService)
 {
     _userDialogs     = userDialogs ?? throw new ArgumentNullException(nameof(userDialogs));
     _mediaManager    = mediaManager ?? throw new ArgumentNullException(nameof(mediaManager));
     _playlistService = playlistService ?? throw new ArgumentNullException(nameof(playlistService));
 }
Esempio n. 12
0
 public PlaylistController(
     IPlaylistService playlistService,
     IDtoParseService dtoParseService)
 {
     _playlistService = playlistService;
     _dtoParseService = dtoParseService;
 }
Esempio n. 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlaylistViewModel" /> class.
        /// </summary>
        /// <param name="publicTransport">The public transport.</param>
        /// <param name="playlistService">The playlist service.</param>
        /// <param name="dispatcher">The dispatcher.</param>
        /// <param name="playerService">The audio player service.</param>
        /// <param name="fileInfoBuilder">The fileInfoBuilder.</param>
        /// <param name="configurationManager">The configuration manager.</param>
        /// <param name="globalHotkeyService">The global hotkey service.</param>
        /// <param name="windowManager">The window manager.</param>
        /// <param name="searchView">The search view.</param>
        public PlaylistViewModel(IPublicTransport publicTransport,
                                 IPlaylistService playlistService,
                                 IDispatcher dispatcher,
                                 IPlayerService playerService,
                                 IInfoBuilder <StorableTaggedFile> fileInfoBuilder,
                                 IConfigurationManager configurationManager,
                                 IGlobalHotkeyService globalHotkeyService,
                                 IWindowManager windowManager,
                                 ISearchView searchView)
        {
            this.publicTransport = Guard.IsNull(() => publicTransport);
            Guard.IsNull(() => configurationManager);
            this.dispatcher          = Guard.IsNull(() => dispatcher);
            this.fileInfoBuilder     = Guard.IsNull(() => fileInfoBuilder);
            this.globalHotkeyService = Guard.IsNull(() => globalHotkeyService);
            this.windowManager       = Guard.IsNull(() => windowManager);
            this.searchView          = Guard.IsNull(() => searchView);
            publicTransport.ApplicationEventBus.Subscribe <PlaylistUpdatedEvent>(OnPlaylistUpdated);
            publicTransport.ApplicationEventBus.Subscribe <TrackChangedEvent>(OnTrackChanged);
            searchHotkey = configurationManager.GetValue("Search", new HotkeyDescriptor(ModifierKeys.Control | ModifierKeys.Alt, Key.J),
                                                         KnownConfigSections.GlobalHotkeys);
            searchHotkey.ValueChanged += SearchHotkeyOnValueChanged;
            globalHotkeyService.RegisterHotkey(searchHotkey.Value, OnSearch);
            searchView.PlayFile += SearchViewOnPlayFile;
            Files = new List <FileItem>(playlistService.Files.Select(x => new FileItem(x)));
            var currenTrack = playerService.CurrentTrackAsReadonly;

            if (null == currenTrack)
            {
                return;
            }
            SetPlayingFile(playlistService.Files.Find(x => x.Filename == currenTrack.Name));
        }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ComponentBase" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="playlistService">The playlist service.</param>
 /// <param name="player">The player.</param>
 /// <param name="publicTransport">The public transport.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="hotkeyService">The hotkey service.</param>
 public NonManagingPlayerService(ILogger logger,
                                 IPlaylistService playlistService,
                                 IAudioPlayer player,
                                 IPublicTransport publicTransport,
                                 IConfigurationManager configurationManager,
                                 IGlobalHotkeyService hotkeyService)
     : base(logger)
 {
     playlistService.Guard("playlistService");
     player.Guard("player");
     publicTransport.Guard("publicTransport");
     configurationManager.Guard("configurationManager");
     state = PlayingState.Stopped;
     this.playlistService      = playlistService;
     this.player               = player;
     this.publicTransport      = publicTransport;
     this.configurationManager = configurationManager;
     this.hotkeyService        = hotkeyService;
     publicTransport.ApplicationEventBus.Subscribe <PlaylistUpdatedEvent>(OnPlaylistUpdated);
     publicTransport.ApplicationEventBus.Subscribe <ShuffleChangedEvent>(OnShuffleChanged);
     prebufferSongs                 = configurationManager.GetValue("PlayerService.PrebufferSongs", 2);
     PlayNextThreshold              = configurationManager.GetValue("PlayerService.PlayNextThreshnoldMs", 500d);
     TrackInterchangeCrossfadeTime  = configurationManager.GetValue("PlayerService.TrackInterchangeCrossfadeTimeMs", 500d);
     TrackInterchangeCrossFadeSteps = configurationManager.GetValue("PlayerService.TrackInterchangeCrossfadeSteps", 50);
     maxBackStack = configurationManager.GetValue("PlayerService.MaxBackStack", 2000);
     preBuffered  = new List <TrackContainer>(prebufferSongs.Value);
     backStack    = new List <TrackContainer>(maxBackStack.Value);
     RegisterHotkeys();
 }
Esempio n. 15
0
 public static SongQueueViewModel Instance(ISongService songService, IPlaylistService playlistService)
 {
     lock (Lock)
     {
         return(_instance ??= new SongQueueViewModel(songService, playlistService));
     }
 }
Esempio n. 16
0
        public ActionResult PlaylistConcrete(int playlistId)
        {
            PlaylistConcreteViewModel modelPlaylist = new PlaylistConcreteViewModel();

            using (IPlaylistService playlistService = ServiceCreator.CreatePlaylistService(Connection))
            {
                PlaylistDTO playlistDto = playlistService.GetById(playlistId);
                if (playlistDto != null)
                {
                    if (playlistDto.ApplicationUser.UserName != User.Identity.Name)
                    {
                        return(HttpNotFound());
                    }

                    modelPlaylist.Id          = playlistDto.Id;
                    modelPlaylist.Name        = playlistDto.Name;
                    modelPlaylist.Description = playlistDto.Description;
                    modelPlaylist.Videos      = playlistDto.Videos;
                }
            }

            if (modelPlaylist == null)
            {
                return(HttpNotFound());
            }

            return(View(modelPlaylist));
        }
        public CollectionPlaylistsViewModel(IContainerProvider container, IDialogService dialogService,
                                            IPlaybackService playbackService, IPlaylistService playlistService, IMetadataService metadataService,
                                            IFileService fileService, IEventAggregator eventAggregator) : base(container)
        {
            this.dialogService   = dialogService;
            this.playlistService = playlistService;
            this.playbackService = playbackService;
            this.fileService     = fileService;
            this.eventAggregator = eventAggregator;
            this.dialogService   = dialogService;
            this.metadataService = metadataService;
            this.container       = container;

            // Events
            this.playlistService.PlaylistFolderChanged += PlaylistService_PlaylistFolderChanged;
            this.playlistService.TracksAdded           += PlaylistService_TracksAdded;
            this.playlistService.TracksDeleted         += PlaylistService_TracksDeleted;

            this.metadataService.LoveChanged += async(_) => await this.GetTracksIfSmartPlaylistSelectedAsync();

            this.metadataService.RatingChanged += async(_) => await this.GetTracksIfSmartPlaylistSelectedAsync();

            this.metadataService.MetadataChanged += async(_) => await this.GetTracksIfSmartPlaylistSelectedAsync();

            this.playbackService.PlaybackCountersChanged += async(_) => await this.GetTracksIfSmartPlaylistSelectedAsync();

            // Commands
            this.EditSelectedPlaylistCommand    = new DelegateCommand(async() => await this.EditSelectedPlaylistAsync());
            this.DeletePlaylistCommand          = new DelegateCommand <PlaylistViewModel>(async(playlist) => await this.ConfirmDeletePlaylistAsync(playlist));
            this.ImportPlaylistsCommand         = new DelegateCommand(async() => await this.ImportPlaylistsAsync());
            this.AddPlaylistToNowPlayingCommand = new DelegateCommand(async() => await this.AddPlaylistToNowPlayingAsync());
            this.ShuffleSelectedPlaylistCommand = new DelegateCommand(async() => await this.ShuffleSelectedPlaylistAsync());
            this.NewPlaylistCommand             = new DelegateCommand(async() => await this.ConfirmCreateNewPlaylistAsync());
            this.RemoveSelectedTracksCommand    = new DelegateCommand(async() => await this.DeleteTracksFromPlaylistsAsync());

            this.DeleteSelectedPlaylistCommand = new DelegateCommand(async() =>
            {
                if (this.IsPlaylistSelected)
                {
                    await this.ConfirmDeletePlaylistAsync(this.SelectedPlaylist);
                }
            });

            // Settings changed
            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Behaviour", "EnableRating"))
                {
                    this.EnableRating = (bool)e.Entry.Value;
                }

                if (SettingsClient.IsSettingChanged(e, "Behaviour", "EnableLove"))
                {
                    this.EnableLove = (bool)e.Entry.Value;
                }
            };

            // Load settings
            this.LeftPaneWidthPercent = SettingsClient.Get <int>("ColumnWidths", "PlaylistsLeftPaneWidthPercent");
        }
Esempio n. 18
0
 /// <summary>
 /// </summary>
 /// <param name="playlistService">The playlist service.</param>
 /// <param name="player">The player.</param>
 /// <param name="publicTransport">The public transport.</param>
 /// <param name="configurationManager">The configuration manager.</param>
 /// <param name="hotkeyService">The hotkey service.</param>
 public NonManagingPlayerService(IPlaylistService playlistService,
                                 IAudioPlayer player,
                                 IPublicTransport publicTransport,
                                 IConfigurationManager configurationManager,
                                 IGlobalHotkeyService hotkeyService)
 {
     state = PlayingState.Stopped;
     this.playlistService      = Guard.IsNull(() => playlistService);
     this.player               = Guard.IsNull(() => player);
     this.publicTransport      = Guard.IsNull(() => publicTransport);
     this.configurationManager = Guard.IsNull(() => configurationManager);
     this.hotkeyService        = Guard.IsNull(() => hotkeyService);
     Subscribe();
     prebufferSongs                 = configurationManager.GetValue("PrebufferSongs", 2, "PlayerService");
     PlayNextThreshold              = configurationManager.GetValue("PlayNextThreshnoldMs", 500d, "PlayerService");
     TrackInterchangeCrossfadeTime  = configurationManager.GetValue("TrackInterchangeCrossfadeTimeMs", 500d, "PlayerService");
     TrackInterchangeCrossFadeSteps = configurationManager.GetValue("TrackInterchangeCrossfadeSteps", 50, "PlayerService");
     maxBackStack              = configurationManager.GetValue("MaxBackStack", 2000, "PlayerService");
     LastPlayed                = configurationManager.GetValue("PlayerService.LastPlayed", Guid.Empty, KnownConfigSections.Hidden);
     LastPlayedOffset          = configurationManager.GetValue("PlayerService.LastPlayedOffset", 0d, KnownConfigSections.Hidden);
     VolumeValue               = configurationManager.GetValue("PlayerService.Volume", 1f, KnownConfigSections.Hidden);
     preBuffered               = new List <TrackContainer>(prebufferSongs.Value);
     backStack                 = new List <TrackContainer>(maxBackStack.Value);
     VolumeValue.ValueChanged += VolumeValueOnValueChanged;
     RegisterHotkeys();
     LoadLastPlayed();
     UpdateState();
     SendProgress();
 }
Esempio n. 19
0
        public TracksViewModelBase(IUnityContainer container) : base(container)
        {
            // Dependency injection
            this.container         = container;
            this.trackRepository   = container.Resolve <ITrackRepository>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.collectionService = container.Resolve <ICollectionService>();
            this.i18nService       = container.Resolve <II18nService>();
            this.eventAggregator   = container.Resolve <IEventAggregator>();
            this.providerService   = container.Resolve <IProviderService>();
            this.playlistService   = container.Resolve <IPlaylistService>();

            // Commands
            this.ToggleTrackOrderCommand      = new DelegateCommand(() => this.ToggleTrackOrder());
            this.AddTracksToPlaylistCommand   = new DelegateCommand <string>(async(playlistName) => await this.AddTracksToPlaylistAsync(playlistName, this.SelectedTracks));
            this.PlayNextCommand              = new DelegateCommand(async() => await this.PlayNextAsync());
            this.AddTracksToNowPlayingCommand = new DelegateCommand(async() => await this.AddTracksToNowPlayingAsync());

            // PubSub Events
            this.eventAggregator.GetEvent <SettingShowRemoveFromDiskChanged>().Subscribe((_) => OnPropertyChanged(() => this.ShowRemoveFromDisk));

            // Events
            this.i18nService.LanguageChanged += (_, __) =>
            {
                OnPropertyChanged(() => this.TotalDurationInformation);
                OnPropertyChanged(() => this.TotalSizeInformation);
                this.RefreshLanguage();
            };

            this.playbackService.TrackStatisticsChanged += PlaybackService_TrackStatisticsChanged;
        }
        public PlaybackService(IFileService fileService, II18nService i18nService, ITrackRepository trackRepository,
                               IEqualizerService equalizerService, IQueuedTrackRepository queuedTrackRepository, IContainerProvider container, IPlaylistService playlistService)
        {
            this.fileService           = fileService;
            this.i18nService           = i18nService;
            this.trackRepository       = trackRepository;
            this.queuedTrackRepository = queuedTrackRepository;
            this.equalizerService      = equalizerService;
            this.playlistService       = playlistService;
            this.container             = container;

            this.context = SynchronizationContext.Current;

            this.queueManager = new QueueManager(this.trackRepository);

            // Event handlers
            this.fileService.ImportingTracks += (_, __) => this.canGetSavedQueuedTracks = false;
            this.fileService.TracksImported  += (tracks, track) => this.EnqueueFromFilesAsync(tracks, track);
            this.i18nService.LanguageChanged += (_, __) => this.UpdateQueueLanguageAsync();

            // Set up timers
            this.progressTimer.Interval = TimeSpan.FromSeconds(this.progressTimeoutSeconds).TotalMilliseconds;
            this.progressTimer.Elapsed += new ElapsedEventHandler(this.ProgressTimeoutHandler);

            this.saveQueuedTracksTimer.Interval = TimeSpan.FromSeconds(this.saveQueuedTracksTimeoutSeconds).TotalMilliseconds;
            this.saveQueuedTracksTimer.Elapsed += new ElapsedEventHandler(this.SaveQueuedTracksTimeoutHandler);

            this.savePlaybackCountersTimer.Interval = TimeSpan.FromSeconds(this.savePlaybackCountersTimeoutSeconds).TotalMilliseconds;
            this.savePlaybackCountersTimer.Elapsed += new ElapsedEventHandler(this.SavePlaybackCountersHandler);

            this.Initialize();
        }
Esempio n. 21
0
 public CreatePlaylist(
     IAuthenticationService authenticationService,
     IPlaylistService playlistService)
 {
     _authenticationService = authenticationService;
     _playlistService       = playlistService;
 }
        public ContextMenuViewModelBase(IContainerProvider container)
        {
            // Dependency injection
            this.providerService = container.Resolve <IProviderService>();
            this.playlistService = container.Resolve <IPlaylistService>();
            this.playbackService = container.Resolve <IPlaybackService>();
            this.dialogService   = container.Resolve <IDialogService>();

            // Commands
            this.SearchOnlineCommand = new DelegateCommand <string>((id) => this.SearchOnline(id));
            this.AddPlayingTrackToPlaylistCommand = new DelegateCommand <string>(
                async(playlistName) => await this.AddPlayingTrackToPlaylistAsync(playlistName), (_) => this.playbackService.HasCurrentTrack);

            // Events
            this.providerService.SearchProvidersChanged += (_, __) => { this.GetSearchProvidersAsync(); };
            this.playlistService.PlaylistAdded          += (_) => this.GetContextMenuPlaylistsAsync();
            this.playlistService.PlaylistDeleted        += (_) => this.GetContextMenuPlaylistsAsync();
            this.playbackService.PlaybackFailed         += (_, __) => this.AddPlayingTrackToPlaylistCommand.RaiseCanExecuteChanged();
            this.playbackService.PlaybackSuccess        += (_, __) => this.AddPlayingTrackToPlaylistCommand.RaiseCanExecuteChanged();
            this.playbackService.PlaybackStopped        += (_, __) => this.AddPlayingTrackToPlaylistCommand.RaiseCanExecuteChanged();
            this.playbackService.PlaybackPaused         += (_, __) => this.AddPlayingTrackToPlaylistCommand.RaiseCanExecuteChanged();
            this.playbackService.PlaybackResumed        += (_, __) => this.AddPlayingTrackToPlaylistCommand.RaiseCanExecuteChanged();
            this.playlistService.PlaylistRenamed        += (_, __) => this.GetContextMenuPlaylistsAsync();

            // Initialize the search providers in the ContextMenu
            this.GetSearchProvidersAsync();

            // Initialize the playlists in the ContextMenu
            this.GetContextMenuPlaylistsAsync();
        }
Esempio n. 23
0
 public PlaylistsController(IPlaylistService playlistService, IMapper mapper, IUserService userService, IVideoService videoService)
 {
     this.playlistService = playlistService;
     this.mapper          = mapper;
     this.userService     = userService;
     this.videoService    = videoService;
 }
 public PublicPlaylistsController(IPlaylistLikesService playlistLikesService, IUserService userService, IPlaylistService playlistService, IUserTracksService userTracksService)
 {
     _playlistLikesService = playlistLikesService;
     _userService = userService;
     _playlistService = playlistService;
     _userTracksService = userTracksService;
 }
        public JsonResult LoadPlaylistItemList(int playlistId)
        {
            IPlaylistItemService playlistItemService = DependencyUtils.Resolve <IPlaylistItemService>();
            IPlaylistService     playlistService     = DependencyUtils.Resolve <IPlaylistService>();
            var playlistItems    = playlistItemService.GetPlaylistItemByPlaylistId(playlistId).OrderBy(a => a.DisplayOrder);
            var playlistItemList = new List <DSS.Models.PlaylistItemScenarioVM>();

            if (playlistItems != null)
            {
                foreach (var item in playlistItems)
                {
                    var p = new DSS.Models.PlaylistItemScenarioVM
                    {
                        mediaSrcId   = item.MediaSrcID,
                        mediaType    = item.MediaSrc.TypeID,
                        URL          = item.MediaSrc.URL,
                        duration     = item.Duration,
                        displayOrder = item.DisplayOrder,
                    };
                    playlistItemList.Add(p);
                }
            }
            return(Json(new
            {
                PlaylistItemList = playlistItemList,
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 26
0
        public TracksViewModelBase(IContainerProvider container) : base(container)
        {
            // Dependency injection
            this.container         = container;
            this.trackRepository   = container.Resolve <ITrackRepository>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.collectionService = container.Resolve <ICollectionService>();
            this.i18nService       = container.Resolve <II18nService>();
            this.eventAggregator   = container.Resolve <IEventAggregator>();
            this.providerService   = container.Resolve <IProviderService>();
            this.playlistService   = container.Resolve <IPlaylistService>();
            this.metadataService   = container.Resolve <IMetadataService>();

            // Events
            this.metadataService.MetadataChanged += MetadataChangedHandlerAsync;

            // Commands
            this.ToggleTrackOrderCommand      = new DelegateCommand(() => this.ToggleTrackOrder());
            this.AddTracksToPlaylistCommand   = new DelegateCommand <string>(async(playlistName) => await this.AddTracksToPlaylistAsync(playlistName, this.SelectedTracks));
            this.PlaySelectedCommand          = new DelegateCommand(async() => await this.PlaySelectedAsync());
            this.PlayNextCommand              = new DelegateCommand(async() => await this.PlayNextAsync());
            this.AddTracksToNowPlayingCommand = new DelegateCommand(async() => await this.AddTracksToNowPlayingAsync());

            this.UpdateShowTrackArtCommand = new DelegateCommand <bool?>((showTrackArt) =>
            {
                SettingsClient.Set <bool>("Appearance", "ShowTrackArtOnPlaylists", showTrackArt.Value, true);
            });

            // Settings changed
            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Behaviour", "ShowRemoveFromDisk"))
                {
                    RaisePropertyChanged(nameof(this.ShowRemoveFromDisk));
                }


                if (SettingsClient.IsSettingChanged(e, "Appearance", "ShowTrackArtOnPlaylists"))
                {
                    this.ShowTrackArt = (bool)e.SettingValue;
                    this.UpdateShowTrackArtAsync();
                }
            };

            // Events
            this.i18nService.LanguageChanged += (_, __) =>
            {
                RaisePropertyChanged(nameof(this.TotalDurationInformation));
                RaisePropertyChanged(nameof(this.TotalSizeInformation));
                this.RefreshLanguage();
            };

            this.playbackService.PlaybackCountersChanged += PlaybackService_PlaybackCountersChanged;

            // Load settings
            this.ShowTrackArt = SettingsClient.Get <bool>("Appearance", "ShowTrackArtOnPlaylists");
        }
Esempio n. 27
0
 public PlaylistViewModel(IPlaylistService playlistService)
 {
     _playlistService = playlistService;
     _playlistService.CurrentPlaylist.CollectionChanged += OnCurrentPlaylistChanged;
     _playlistService.CurrentPlaylist.CurrentSongChanged += OnCurrentSongChanged;
     CurrentPlaylist = new ObservableCollection<SongViewModel>();
     UserPlaylists = _playlistService.Playlists;
 }
Esempio n. 28
0
 public UserUpdateReceiver(IPlaylistService playlistService, IOptions <RabbitMqConfiguration> rabbitMqOptions)
 {
     _hostname        = rabbitMqOptions.Value.Hostname;
     _username        = rabbitMqOptions.Value.UserName;
     _password        = rabbitMqOptions.Value.Password;
     _playlistService = playlistService;
     InitializeRabbitMqListener();
 }
 public PlaylistsController(IPlaylistService playlistService, IGenreService genreService, IBingMapsAPIService bingMapsAPIService,
                            UserManager <User> userManager)
 {
     _playlistService    = playlistService;
     _genreService       = genreService;
     _bingMapsAPIService = bingMapsAPIService;
     this._userManager   = userManager;
 }
        public CollectionPlaylistEditorViewModel(IPlaylistService playlistService, PlaylistViewModel playlistViewModel)
        {
            this.playlistService = playlistService;

            this.AddRuleCommand    = new DelegateCommand(() => this.AddRule());
            this.RemoveRuleCommand = new DelegateCommand <SmartPlaylistRuleViewModel>((rule) => this.RemoveRule(rule));
            this.InitializeAsync(playlistViewModel);
        }
Esempio n. 31
0
 public PlaylistController(ILogger <PlaylistController> logger,
                           IHostingEnvironment env,
                           IPlaylistService plls)
 {
     _logger          = logger;
     _env             = env;
     _playListService = plls;
 }
Esempio n. 32
0
        public PlaylistController(IPlaylistService playlistService, IUserService userService, IPlaylistFileService playlistFileService)
        {
            _playlistService = playlistService;
            _userService = userService;
            _playlistFileService = playlistFileService;

            ViewBag.IsAdmin = _userService.IsUserInRole("Admin");
        }
Esempio n. 33
0
 public PlaylistsController(IPlaylistService playlistService, IMapper mapper, IUserService userService,
                            IUserManagerWrapper userManagerWrapper)
 {
     _playlistService    = playlistService;
     _mapper             = mapper;
     _userService        = userService;
     _userManagerWrapper = userManagerWrapper;
 }
Esempio n. 34
0
 public PlaylistViewModel(IDialogService dialogService, IPlaylistService playlistService)
 {
     this.dialogService = dialogService;
     this.playlistService = playlistService;
 }
        public void PlaylistServiceTestFixtureSetup()
        {
            _playlistRepository = new Mock<IPlaylistRepository>();

            _playlistService = new PlaylistService(_playlistRepository.Object);
        }
Esempio n. 36
0
 public ShareController(IPlaylistService playlistService, IUserTracksService userTracksService)
 {
     _playlistService = playlistService;
     _userTracksService = userTracksService;
 }
 public PlaylistController(IPlaylistService service, ICacheManager cacheManager)
 {
     this.service = service.notNull();
     this.sessionCache = cacheManager.notNull();
 }
Esempio n. 38
0
 /// <summary>
 ///     Constructor
 /// </summary>
 public MainViewModel(IServiceManager serviceManager, IDialogService dialogService, IPlaylistService playlistService)
 {
     this.serviceManager = serviceManager;
     this.dialogService = dialogService;
     this.playlistService = playlistService;
 }
Esempio n. 39
0
 public PlayListController(
    IPlaylistService playlistService)
 {
     _playlistService = playlistService;
 }