public static NavigationParameters CreateSongNavigation(AllJoinedTable song) { var navParams = new NavigationParameters(); navParams.Add("song", song); return(navParams); }
/// <summary> /// Called when [add to play list command] which adds the song to the current Preparation Playlist /// </summary> /// <param name="song">The song.</param> private void OnAddToPlayListCommand(AllJoinedTable song) { _eventAggregator.GetEvent <AddToPlaylistEvent>().Publish(new Dictionary <string, AllJoinedTable>() { { "Preparation Playlist", song } }); }
/// <summary> /// Called when [queue song]. Adds the song to the <see cref="IQueuedSongDataProvider" /> /// </summary> /// <param name="song">The search string.</param> /// <exception cref="NotImplementedException"></exception> protected virtual void OnQueueSong(AllJoinedTable song = null) { if (!_queuedSongDataProvider.QueueSongs.Any(x => x == song)) { _queuedSongDataProvider.QueueSongs.Add(song); Log($"Added song to queue.", Category.Debug); } }
private void OnSongItemSelected(AllJoinedTable songItem) { Log($"Selected song : {songItem.FileLocation}", Category.Debug); var navParams = new NavigationParameters(); navParams.Add("song", songItem); _regionManager.RequestNavigate(Regions.ContentRegion, ViewNames.SongSelectedView, navParams); _lastSelectedSong = songItem; }
public static string GetImageLocation(AllJoinedTable song) { if (!string.IsNullOrWhiteSpace(song.ImageLocation)) { return(song.ImageLocation); } else { return(string.Empty); } }
/// <summary> /// Called when [play]. /// </summary> /// <param name="song">All joined table.</param> /// <exception cref="NotImplementedException"></exception> protected virtual void OnPlay(AllJoinedTable song = null) { if (song != null) { Log($"Playing song: {song.FileLocation}"); _eventAggregator.GetEvent <OnMediaPlay <AllJoinedTable> >().Publish(song); return; } Log($"Song is null, failed to play", Category.Warn); }
public void OnNavigatedTo(NavigationContext navigationContext) { _journal = navigationContext.NavigationService.Journal; var songItem = navigationContext.Parameters["song"] as AllJoinedTable; if (songItem != null) { SelectedSong = songItem; } }
public async Task <bool> UpdatePlayedSong(AllJoinedTable selectedSong, int?rating = null) { if (rating != null && rating > 0) { _loggerFacade?.Log($"Changing song rating ID: {selectedSong.Id}, Rating: {rating}", Category.Debug, Priority.Medium); } else { _loggerFacade?.Log($"Updating played song: {selectedSong.Id}", Category.Debug, Priority.Medium); } return(await _horsifySongApi.UpdatePlayedSongAsync(selectedSong.Id, rating)); }
public bool Add(AllJoinedTable allJoinedTable) { if (!QueueSongs.Any(x => x == allJoinedTable)) { QueueSongs.Add(allJoinedTable); } else { return(false); } return(true); }
protected override void OnQueueSong(AllJoinedTable song = null) { if (song != null) { AllJoinedTable fullSong = null; Task.Run(async() => { fullSong = await GetSong(song); }).Wait(); Log($"Queueing song: {fullSong.FileLocation}"); base.QueueSong(fullSong); } }
protected override void OnPlay(AllJoinedTable song = null) { if (song != null) { AllJoinedTable fullSong = null; Task.Run(async() => { fullSong = await GetSong(song); }).Wait(); Log($"Playing song: {fullSong.FileLocation}"); _eventAggregator.GetEvent <OnMediaPlay <AllJoinedTable> >() .Publish(fullSong); } }
private void OnSongChangedLoaded(AllJoinedTable song) { Log($"MediaElement: Loading file: {song?.FileLocation}", Category.Info, Priority.Medium); try { var mediaFile = new Uri(song.FileLocation, UriKind.Absolute); if (!Directory.Exists(Path.GetDirectoryName(mediaFile.LocalPath))) { throw new DirectoryNotFoundException($"Song Directory not found: {mediaFile.LocalPath}"); } if (!System.IO.File.Exists(mediaFile.LocalPath)) { throw new FileNotFoundException($"Media file not found: {mediaFile.LocalPath}"); } MediaControlModel.SelectedSong = song; //_horsifyMediaController.SetMedia(song.FileLocation); _horsifyMediaController.SetMedia(mediaFile); //Update last played / rating if (_previousSong?.Id != MediaControlModel.SelectedSong?.Id) { UpdateFileTags(); } _previousSong = MediaControlModel.SelectedSong; _previousSongRating = _previousSong.Rating; MediaControlModel.IsPlaying = true; //Update Discord : TODO settings _discordRpcService.SetPrecense( $"Year: {_previousSong.Year} | Rated: {_previousSong.Rating} | Genre: {_previousSong.Genre} | Bpm:{_previousSong.Bpm} | Key: {_previousSong.MusicKey}", $"{_previousSong.Artist} - {_previousSong.Title}" , (int)MediaControlModel.CurrentSongTime.TotalSeconds); _discordRpcService.Update(); } catch (Exception ex) { Log($"Error loading file: {ex.Message}", Category.Exception); //MediaControlModel.SelectedSong = null; _eventAggregator.GetEvent <SkipQueueEvent>().Publish(); } }
public static NavigationParameters CreateSearchFilterNavigation(AllJoinedTable allJoinedTable, string searchType) { SearchType type = (SearchType)Enum.Parse(typeof(SearchType), searchType); string searchTerm = allJoinedTable.GetType().GetProperty(searchType).GetValue(allJoinedTable).ToString(); var filter = new SearchFilter { Filters = new List <Data.Model.Horsify.HorsifyFilter>() { new Data.Model.Horsify.HorsifyFilter { SearchType = type, SearchAndOrOption = SearchAndOrOption.Or, Filters = new List <string>() { searchTerm } } } }; var navParams = new NavigationParameters(); navParams.Add("search_filter", filter); return(navParams); }
private Task <AllJoinedTable> GetSong(AllJoinedTable allJoinedTable) { return(_songDataProvider.GetSongById(allJoinedTable.Id)); }
private Task <bool> UpdatePlayedSong(AllJoinedTable selectedSong, int?rating = null) { return(_songDataProvider.UpdatePlayedSong(selectedSong, rating)); //_loggerFacade?.Log($"Failed to update song. {filePath}", Category.Exception, Priority.Medium); }