public PlaylistController( ApplicationDbContext dbContext, IWebHostEnvironment appEnv) { _playlistRepo = new PlaylistRepository(dbContext); _appEnv = appEnv; }
public LocalMylistManager( PlaylistRepository playlistRepository, NicoVideoProvider nicoVideoProvider, Services.NotificationService notificationService ) { _playlistRepository = playlistRepository; _nicoVideoProvider = nicoVideoProvider; _notificationService = notificationService; MigrateLocalMylistToPlaylistRepository(_playlistRepository); var localPlaylistEntities = _playlistRepository.GetPlaylistsFromOrigin(Interfaces.PlaylistOrigin.Local); var localPlaylists = localPlaylistEntities.Select(x => new LocalPlaylist(x.Id, _playlistRepository) { Label = x.Label, Count = x.Count }).ToList(); _playlists = new ObservableCollection <LocalPlaylist>(localPlaylists); LocalPlaylists = new ReadOnlyObservableCollection <LocalPlaylist>(_playlists); localPlaylists.ForEach(HandleItemsChanged); foreach (var entity in localPlaylistEntities) { _playlistIdToEntity.Add(entity.Id, entity); } }
public void GetAllPlaylist() { var options = new DbContextOptionsBuilder <FlixContext>() .UseInMemoryDatabase(databaseName: "FlixUsersDatabase") .Options; // Insert seed data into the database using one instance of the context using (var context = new FlixContext(options)) { context.Playlists.Add(new Playlist { Id = 1, Title = "Mafia", UserId = 1 }); context.Playlists.Add(new Playlist { Id = 2, Title = "Comedy", UserId = 1 }); context.Playlists.Add(new Playlist { Id = 3, Title = "Action", UserId = 1 }); context.Playlists.Add(new Playlist { Id = 4, Title = "Action", UserId = 2 }); context.SaveChanges(); } // Use a clean instance of the context to run the test using (var context = new FlixContext(options)) { PlaylistRepository playlistRepo = new PlaylistRepository(context); var playlists = playlistRepo.GetAllPlaylists(); Assert.AreEqual(4, playlists.Count); context.Dispose(); } }
static void MigrateLocalMylistToPlaylistRepository(PlaylistRepository playlistRepository) { var groups = LocalMylistDb.GetLocalMylistGroups(); if (groups.Count > 0) { System.Diagnostics.Debug.WriteLine("start migrating LocalMylist."); foreach (var legacyLocalPlaylist in groups) { var newPlaylist = new PlaylistEntity() { Id = LiteDB.ObjectId.NewObjectId().ToString(), Label = legacyLocalPlaylist.Label, Count = legacyLocalPlaylist.Items.Count, PlaylistOrigin = Interfaces.PlaylistOrigin.Local }; playlistRepository.Upsert(newPlaylist); playlistRepository.AddItems(newPlaylist.Id, legacyLocalPlaylist.Items); LocalMylistDb.Remove(legacyLocalPlaylist); System.Diagnostics.Debug.WriteLine($"migrated: {newPlaylist.Label} ({newPlaylist.Count})"); } System.Diagnostics.Debug.WriteLine("migrating LocalMylist done."); } }
public IActionResult GetTheTracksInPlaylist() { var repo = new PlaylistRepository(); var playlist = repo.GetTheTracksInPlaylist(); return(Ok(playlist)); }
public IActionResult GetPlaylistAndTracks() { var repo = new PlaylistRepository(); var playlists = repo.GetPlaylistAndTracks(); return(Ok(playlists)); }
public RepositoryManager(ShuflContext context) { AlbumRepository = new AlbumRepository(context); AlbumArtistRepository = new AlbumArtistRepository(context); AlbumImageRepository = new AlbumImageRepository(context); ArtistRepository = new ArtistRepository(context); ArtistImageRepository = new ArtistImageRepository(context); ArtistGenreRepository = new ArtistGenreRepository(context); GenreRepository = new GenreRepository(context); GroupRepository = new GroupRepository(context); GroupAlbumRepository = new GroupAlbumRepository(context); GroupAlbumRatingRepository = new GroupAlbumRatingRepository(context); GroupInviteRepository = new GroupInviteRepository(context); GroupMemberRepository = new GroupMemberRepository(context); GroupPlaylistRepository = new GroupPlaylistRepository(context); GroupPlaylistRatingRepository = new GroupPlaylistRatingRepository(context); PasswordResetRepository = new PasswordResetRepository(context); PlaylistRepository = new PlaylistRepository(context); PlaylistImageRepository = new PlaylistImageRepository(context); TrackRepository = new TrackRepository(context); TrackArtistRepository = new TrackArtistRepository(context); UserRepository = new UserRepository(context); UserImageRepository = new UserImageRepository(context); UserVerificationRepository = new UserVerificationRepository(context); }
public SearchingViewModel(IPlaylistCollector searchCommand) { this.SearchCommand = searchCommand; _dispatcher = Dispatcher.FromThread(Thread.CurrentThread); _playListPersistence = new PlaylistRepository(SqlConnector.GetDefaultConnection()); _playlistItemRepository = new PlaylistItemRepository(SqlConnector.GetDefaultConnection()); }
public PlaylistViewModel() { PlaylistGroups = Enumerable.Empty <IGrouping <string, Playlist> >(); PlaylistSortItems = PlaylistRepository.GetPlaylistSortItems().Select(item => new SelectListItem { Text = item.Name, Value = item.Value.ToString() }); }
public SongListViewModel() { songRepository = new SongRepository(DependencyService.Get <ISQLiteDb>()); _pageService = new PageService(); playlistRepository = new PlaylistRepository(DependencyService.Get <ISQLiteDb>()); LoadSongsCommand = new Command(async() => await LoadSongs()); SelectSongCommand = new Command <SongViewModel>(async song => await SelectSong(song)); CreatePlaylistCommand = new Command(async() => await CreatePlaylist()); AddToPlaylistCommand = new Command <SongViewModel>(song => AddToPlaylist(song)); DeleteFromPlaylistCommand = new Command <SongViewModel>(song => DeleteFromPlaylist(song)); StartSongPresentationCommand = new Command <int>(async id => await StartPresentation(id)); MessagingCenter.Subscribe <SongAddAndDetailViewModel, Song> (this, Events.SongAdded, OnSongAdded); MessagingCenter.Subscribe <SongAddAndDetailViewModel, Song> (this, Events.SongUpdated, OnSongUpdated); MessagingCenter.Subscribe <SongAddAndDetailViewModel, Song> (this, Events.SongDeleted, OnSongDeleted); LoadSongsCommand.Execute(null); SetCheckBoxVisibility(false); }
internal LocalPlaylist(string id, PlaylistRepository playlistRepository) { Id = id; _playlistRepository = playlistRepository; ItemsAddCommand = new LocalPlaylistAddItemCommand(this); ItemsRemoveCommand = new LocalPlaylistRemoveItemCommand(this); }
public EditPlaylistViewModel(Playlist playlist, User user) { Playlist = playlist; User = user; _songRepo = new SongRepository(); _artRepo = new ArtRepository(); _playlistRepo = new PlaylistRepository(); _playlistRepo.Dispose(); Art = new ObservableCollection<string>(_artRepo.GetPlaylistArt()); AllSongs = new ObservableCollection<Song>(_songRepo.GetAllSongs()); PlaceholderSongs = CurrentSongs; Title = Playlist.Title; Image = Playlist.Image; PlaylistUserID = Playlist.UserID; SelectedImage = Playlist.Image; // COMMANDS AddSongToPlaylistCommand = new RelayCommand(new Action<object>(AddSongToPlaylist)); RemoveSongFromPlaylistCommand = new RelayCommand(new Action<object>(RemoveSongFromPlaylist)); CloseEditPlaylistViewCommand = new RelayCommand(new Action<object>(CloseEditPlaylistView)); SavePlaylistChangesCommand = new RelayCommand(new Action<object>(SavePlaylistChanges), Predicate => { if (TitleRule.TitleRegex.IsMatch(Title)) { return true; } else { return false; } }); }
public PlaylistService(PlaylistListQuery playlistListQuery, PlaylistRepository playlistRepository, UserRepository userRepository) { this.playlistListQuery = playlistListQuery; this.playlistRepository = playlistRepository; this.userRepository = userRepository; }
public EditPlaylistViewModel(Playlist playlist, User user) { Playlist = playlist; User = user; _songRepo = new SongRepository(); _artRepo = new ArtRepository(); _playlistRepo = new PlaylistRepository(); _playlistRepo.Dispose(); Art = new ObservableCollection <string>(_artRepo.GetPlaylistArt()); AllSongs = new ObservableCollection <Song>(_songRepo.GetAllSongs()); PlaceholderSongs = CurrentSongs; Title = Playlist.Title; Image = Playlist.Image; PlaylistUserID = Playlist.UserID; SelectedImage = Playlist.Image; // COMMANDS AddSongToPlaylistCommand = new RelayCommand(new Action <object>(AddSongToPlaylist)); RemoveSongFromPlaylistCommand = new RelayCommand(new Action <object>(RemoveSongFromPlaylist)); CloseEditPlaylistViewCommand = new RelayCommand(new Action <object>(CloseEditPlaylistView)); SavePlaylistChangesCommand = new RelayCommand(new Action <object>(SavePlaylistChanges), Predicate => { if (TitleRule.TitleRegex.IsMatch(Title)) { return(true); } else { return(false); } }); }
private async void SavePlaylist() { string coverPlaylist = ""; if (absolutePathCover != null) { coverPlaylist = Utils.Encoder.EncodeBase64(absolutePathCover); } Playlist playlist = new Playlist() { cover = coverPlaylist, idAccount = idAccount, idPlaylistType = 4, title = TextBox_title_playlist.Text, publicPlaylist = IsPublicPlaylist() }; try { var response = await PlaylistRepository.CreatePlaylistAsync(playlist); if (response) { MessageBox.Show("Playlist has been created"); Window.GetWindow(this).Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public string Get(int id) { PlaylistRepository repo = new PlaylistRepository(); Playlist playlist = repo.GetPlaylist(id); return(JsonConvert.SerializeObject(playlist)); }
public SonglistService(SonglistRepository songlistRepository, SonglistListQuery songlistListQuery, SongRepository songRepository, PlaylistRepository playlistRepository) { _songlistRepository = songlistRepository; _songlistListQuery = songlistListQuery; _songRepository = songRepository; _playlistRepository = playlistRepository; }
public string Get() { PlaylistRepository repo = new PlaylistRepository(); List <PlaylistDescriptor> playlists = repo.GetPlaylists(); return(JsonConvert.SerializeObject(playlists)); //return new string[] { "value1", "value2" }; }
public TestCustomer() { _ChinookEntities = new ChinookEntities(); _CustomerRepo = new CustomerRepository(_ChinookEntities); _TrackRepo = new TrackRepository(_ChinookEntities); _PlayListRepo = new PlaylistRepository(_ChinookEntities); }
public UnitofWork(MusicDBContext musicDBContext) { _musicDBContext = musicDBContext; OutletRepository = new OutletRepository(_musicDBContext); DeviceRepository = new DevicesRepository(_musicDBContext); PlaylistRepository = new PlaylistRepository(_musicDBContext); TrackRepository = new GenericRepository <Track>(_musicDBContext); }
public UserController() { userContext = new UserSQLContext(); userRepository = new UserRepository(userContext); playlistContext = new PlaylistSQLContext(); playlistRepository = new PlaylistRepository(playlistContext); }
public UnitOfWork() { ArticleRepo = new ArtisteRepository(_ChinookEntities); CustomerRepo = new CustomerRepository(_ChinookEntities); EmployeeRepo = new EmployeeRepository(_ChinookEntities); InvoiceRepo = new InvoiceRepository(_ChinookEntities); PlaylistRepo = new PlaylistRepository(_ChinookEntities); TrackRepo = new TrackRepository(_ChinookEntities); }
public string Post([FromBody] JsonElement updatePlaylist) { PlaylistRepository repo = new PlaylistRepository(); string json = System.Text.Json.JsonSerializer.Serialize(updatePlaylist); Playlist playlist = (Playlist)JsonConvert.DeserializeObject(json, typeof(Playlist)); int result = repo.SavePlaylist(playlist); return($"{{\"result\":{result}}}"); }
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) { var plr = new PlaylistRepository(SqlConnector.GetDefaultConnection()); var items = plr.GetItems(1, 10, "Name"); moduleCatalog.AddModule <SearchingModule.SearchingModule>() .AddModule <CommonControls.CommonControlsModule>() .AddModule <UserPlaylistModule.UserPlaylistModule>() .AddModule <DownloadModule.DownloadModule>(); }
public MusicController() { _userViewModel = new UserViewModel(); playlistContext = new PlaylistSQLContext(); userContext = new UserSQLContext(); playlistRepository = new PlaylistRepository(playlistContext); userRepository = new UserRepository(userContext); }
public void ImportLibrary_Playlist_ShouldReference_File() { var files = new List <MediaFile> { new MediaFile(-1, "https://google.ca", MediaFileType.IMAGE_TYPE, "f1", DateTime.Now, UniqueIdUtil.GenerateUniqueId()), new MediaFile(-1, "https://google.com", MediaFileType.IMAGE_TYPE, "f2", DateTime.Now, UniqueIdUtil.GenerateUniqueId()) }; var publishers = new List <ExportedPublisherSimpleDto> { }; var calendars = new List <Calendar> { }; var series = new List <ExportedSeriesSimpleDto> { }; var playlists = new List <ExportedPlaylistSimpleDto> { new ExportedPlaylistSimpleDto( new PlaylistDto(-1, "p1", "", -1, false, -1, DateTime.Now, UniqueIdUtil.GenerateUniqueId()), files[0].UniqueId ), new ExportedPlaylistSimpleDto( new PlaylistDto(-1, "p1", "", -1, false, -1, DateTime.Now, UniqueIdUtil.GenerateUniqueId()), null ) }; var dto = new ExportedLibraryDto( "lib", UniqueIdUtil.GenerateUniqueId(), null, new List <ExportedVideoSimpleDto>(), new List <ExportedCharacterSimpleDto>(), new List <ExportedCharacterSimpleDto>(), series, publishers, new List <ExportedLocationSimpleDto>(), calendars, playlists, new List <Ingvilt.Dto.Tags.Tag>(), new List <Ingvilt.Dto.Tags.Tag>(), files, new List <ExportedSeriesSequenceSimpleDto>(), new List <Ingvilt.Dto.Export.SeriesTagExportDto>(), new List <Ingvilt.Dto.Export.VideoTagExportDto>(), new List <Ingvilt.Dto.Export.FileTagExportDto>(), new List <Ingvilt.Dto.Export.CharacterTagExportDto>(), new List <Ingvilt.Dto.Export.VideoMediaFilesExportDto>(), new List <Ingvilt.Dto.Export.FileLocationExportDto>(), new List <Ingvilt.Dto.Export.CharacterMediaFilesExportDto>(), new List <Ingvilt.Dto.Export.VideosInSequencesExportDto>(), new List <Ingvilt.Dto.Export.VideosInSequencesExportDto>(), new List <Ingvilt.Dto.Export.VideoLocationExportDto>(), new List <Ingvilt.Dto.Export.VideoCharacterActorExportDto>(), new List <Ingvilt.Dto.Export.VideoCreatorExportDto>(), new LibrarySettings() ); new ImportLibraryService().ImportLibrary(dto); var libraryId = repository.GetLibraries(new InfinitePagination(), "").Result.Results[0].LibraryId; var sequencesList = new PlaylistRepository().GetPlaylistsInLibrary(libraryId, new InfinitePagination(), "").Result.Results; var retFiles = mediaFileRepository.GetMediaFiles(new InfinitePagination(), "f1").Result.Results; var expectedSequences = new List <PlaylistDto> { playlists[0].Details, playlists[1].Details }; expectedSequences[0].LibraryId = libraryId; expectedSequences[1].LibraryId = libraryId; expectedSequences[0].CoverFile = retFiles[0].MediaId; CollectionAssert.AreEquivalent(expectedSequences, sequencesList); }
public void DotMemoryUnitTest() { var repo = new PlaylistRepository(); repo.GetAll(); dotMemory.Check(memory => Assert.Equal(1, memory.GetObjects(where => where.Type.Is <Playlist>()).ObjectsCount)); GC.KeepAlive(repo); // prevent objects from GC if this is implied by test logic }
public UserPlaylistViewModel() { this.PathSelector = new PathSelector(); this.PathSelector.SetPath(path => this._currenItem.Path = path); _playListPersistence = new PlaylistRepository(SqlConnector.GetDefaultConnection()); _playListItemPersistence = new PlaylistItemRepository(SqlConnector.GetDefaultConnection()); _playlistCollection.Clear(); GetListsFromRepository(); AddItemCommand = new AddPlaylistCommand(this); RemovePlaylist = new RemovePlaylist(this); }
public Worker(ILogger <Worker> logger, Spotify spotify, Eksen eksen, JoyFm joyFm, JoyTurkRock joyTurkRock, RedFm redFm, Veronica veronica, VeronicaRock veronicaRock, PlaylistRepository playlistRepository, TrackRepository trackRepository) { _logger = logger; _spotify = spotify; _eksen = eksen; _joyFm = joyFm; _joyTurkRock = joyTurkRock; _redFm = redFm; _veronica = veronica; _veronicaRock = veronicaRock; _playlistRepository = playlistRepository; _trackRepository = trackRepository; }
public void GetOnePlaylist() { var options = new DbContextOptionsBuilder <BetterCalmContext>() .UseInMemoryDatabase(databaseName: "MSP.BetterCalmDatabase").Options; var context = new BetterCalmContext(options); listPlaylist.ForEach(cat => context.Add(cat)); context.SaveChanges(); repository = new PlaylistRepository(context); var playlist = repository.Get(listPlaylist[0].Id); context.Database.EnsureDeleted(); Assert.AreEqual(listPlaylist[0].Id, playlist.Id); }
private void InitRepositories() { libraryRepository = DependencyInjectionContainer.Container.Resolve <LibraryRepository>(); videoRepository = DependencyInjectionContainer.Container.Resolve <VideoRepository>(); characterRepository = DependencyInjectionContainer.Container.Resolve <CharacterRepository>(); seriesRepository = DependencyInjectionContainer.Container.Resolve <SeriesRepository>(); publisherRepository = DependencyInjectionContainer.Container.Resolve <PublisherRepository>(); calendarRepository = DependencyInjectionContainer.Container.Resolve <CalendarRepository>(); locationRepository = DependencyInjectionContainer.Container.Resolve <LocationRepository>(); playlistRepository = DependencyInjectionContainer.Container.Resolve <PlaylistRepository>(); tagRepository = DependencyInjectionContainer.Container.Resolve <TagRepository>(); mediaFileRepository = DependencyInjectionContainer.Container.Resolve <MediaFileRepository>(); seriesSequenceRepository = DependencyInjectionContainer.Container.Resolve <SeriesSequenceRepository>(); }
private void CreatePlaylist(Object obj) { PlaylistRepository tempRepo = new PlaylistRepository(); tempRepo.Dispose(); ObservableCollection<Song> tempSongs = new ObservableCollection<Song>(SelectedSongs); Playlist newPlaylist = new Playlist(); newPlaylist.Title = Name; newPlaylist.Image = PathHelper.GetRelativePath(SelectedImage, Directory.GetCurrentDirectory() + "\\"); newPlaylist.Songs = tempSongs; newPlaylist.UserID = PlaylistForAll ? 0 : User.ID; tempRepo.AddNewPlaylist(newPlaylist, newPlaylist.UserID); //Listened to by mainviewmodel Messenger.Default.Send<bool>(true, "CloseCreatePlaylistView"); }
public MainViewModel() { _viewModels = new ObservableCollection<ViewModelBase>(); _playlistRepository = new PlaylistRepository(); _songRepository = new SongRepository(); _userRepo = new UserRepository(); _playlistListViewModel = new PlaylistListViewModel(_playlistRepository); _songListViewModel = new SongListViewModel(_songRepository); _songViewModel = new SongViewModel(); _menuViewModel = new MenuViewModel(); _viewModels.Add(_playlistListViewModel); _viewModels.Add(_songListViewModel); _viewModels.Add(_songViewModel); _viewModels.Add(_menuViewModel); #region Registering for ViewModel Commands // Listens for a click in menuViewModel Messenger.Default.Register<bool>(this, SetCreatePlaylistViewModel, "CreatePlaylistView"); Messenger.Default.Register<bool>(this, CloseCreatePlaylistView, "CloseCreatePlaylistView"); // Listens for click in menuViewModel Messenger.Default.Register<bool>(this, SetLoginViewModel, "CreateLoginView"); // Listens for LoginUserViewModel to send this message Messenger.Default.Register<bool>(this, CloseLoginViewModel, "CloseLoginView"); // Listens for menuViewModel logout button click Messenger.Default.Register<bool>(this, LogoutUser, "LogoutUser"); // Listens for register button click in MenuViewModel Messenger.Default.Register<bool>(this, SetRegisterViewModel, "CreateRegisterView"); Messenger.Default.Register<bool>(this, CloseRegisterViewModel, "CloseRegisterView"); // Listens for menuviewModel AddNewSong button click Messenger.Default.Register<bool>(this, SetAddNewSongViewModel, "CreateAddNewSongView"); Messenger.Default.Register<bool>(this, CloseAddNewSongViewModel, "CloseAddNewSongView"); // Listenes for menuviewModel EditPlaylist button click Messenger.Default.Register<Playlist>(this, SetEditPlaylistViewModel, "CreateEditPlaylistView"); Messenger.Default.Register<bool>(this, CloseEditPlaylistView, "CloseEditPlaylistView"); // listens for menuviewmodel Edit Song button click Messenger.Default.Register<Song>(this, SetEditSongViewModel, "CreateEditSongView"); Messenger.Default.Register<bool>(this, CloseEditSongView, "CloseEditSongView"); // Listenes for menuvireModel Credits button Messenger.Default.Register<bool>(this, SetCreditTransactionViewModel, "CreateCreditTransactionView"); Messenger.Default.Register<bool>(this, CloseCreditTransactionView, "CloseCreditTransactionView"); // Listens for LoginViewModel successful login, or a RegisterViewModel sucessful registration Messenger.Default.Register<User>(this, LoginUser, "UserLogin"); // Listens for when song is selected, changed, etc Messenger.Default.Register<bool>(this, UserPlayedSong, "UserCreditCheck"); // Listens from MenuViewModel for delete commands Messenger.Default.Register<Playlist>(this, DeletePlaylist, "DeletePlaylist"); Messenger.Default.Register<Song>(this, DeleteSong, "DeleteSong"); #endregion User = new User(); }