|
|
|
@ -0,0 +1,557 @@
|
|
|
|
|
namespace Model.Stub;
|
|
|
|
|
|
|
|
|
|
public class StubManager : IDataManager
|
|
|
|
|
{
|
|
|
|
|
// Stubs
|
|
|
|
|
|
|
|
|
|
public StubAlbum StubAlbum
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return stubAlbum;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly StubAlbum stubAlbum;
|
|
|
|
|
|
|
|
|
|
public StubArtist StubArtist
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return stubArtist;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly StubArtist stubArtist;
|
|
|
|
|
|
|
|
|
|
public StubCustomTitle StubCustomTitle
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return stubCustomTitle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly StubCustomTitle stubCustomTitle;
|
|
|
|
|
|
|
|
|
|
public StubInfoTitle StubInfoTitle
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return stubInfoTitle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly StubInfoTitle stubInfoTitle;
|
|
|
|
|
|
|
|
|
|
public StubPlaylist StubPlaylist
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return stubPlaylist;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly StubPlaylist stubPlaylist;
|
|
|
|
|
|
|
|
|
|
public StubManager()
|
|
|
|
|
{
|
|
|
|
|
stubAlbum = new StubAlbum();
|
|
|
|
|
stubArtist = new StubArtist();
|
|
|
|
|
stubCustomTitle = new StubCustomTitle();
|
|
|
|
|
stubInfoTitle = new StubInfoTitle();
|
|
|
|
|
stubPlaylist = new StubPlaylist();
|
|
|
|
|
StubPlaylist.Playlists.First().AddTitle(StubCustomTitle.CustomTitles.First());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Album> GetAlbums()
|
|
|
|
|
{
|
|
|
|
|
return StubAlbum.GetAlbums();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Artist> GetArtists()
|
|
|
|
|
{
|
|
|
|
|
return StubArtist.GetArtists();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Playlist> GetPlaylists()
|
|
|
|
|
{
|
|
|
|
|
return StubPlaylist.GetPlaylists();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<CustomTitle> GetCustomTitles()
|
|
|
|
|
{
|
|
|
|
|
return StubCustomTitle.GetCustomTitles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<InfoTitle> GetInfoTitles()
|
|
|
|
|
{
|
|
|
|
|
return StubInfoTitle.GetInfoTitles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddAlbum(Album album)
|
|
|
|
|
{
|
|
|
|
|
StubAlbum.AddAlbum(album);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddCustomTitle(CustomTitle title)
|
|
|
|
|
{
|
|
|
|
|
StubCustomTitle.AddCustomTitle(title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddInfoTitle(InfoTitle title)
|
|
|
|
|
{
|
|
|
|
|
StubInfoTitle.AddInfoTitle(title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void AddFeat(InfoTitle infoTitle, Artist artist)
|
|
|
|
|
{
|
|
|
|
|
StubInfoTitle.AddFeat(infoTitle, artist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddPlaylist(Playlist playlist)
|
|
|
|
|
{
|
|
|
|
|
StubPlaylist.AddPlaylist(playlist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddArtist(Artist artist)
|
|
|
|
|
{
|
|
|
|
|
StubArtist.AddArtist(artist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void RemoveAlbum(Album album)
|
|
|
|
|
{
|
|
|
|
|
StubAlbum.RemoveAlbum(album);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveCustomTitle(CustomTitle title)
|
|
|
|
|
{
|
|
|
|
|
StubCustomTitle.RemoveCustomTitle(title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveInfoTitle(InfoTitle title)
|
|
|
|
|
{
|
|
|
|
|
StubInfoTitle.RemoveInfoTitle(title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemovePlaylist(Playlist playlist)
|
|
|
|
|
{
|
|
|
|
|
StubPlaylist.RemovePlaylist(playlist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveArtist(Artist artist)
|
|
|
|
|
{
|
|
|
|
|
StubArtist.RemoveArtist(artist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadSerialization()
|
|
|
|
|
{
|
|
|
|
|
// Doesn't do anything because it's Stubs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SaveSerialization()
|
|
|
|
|
{
|
|
|
|
|
// Doesn't do anything because it's Stubs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CustomTitle? GetCustomTitleByUrl(string custom)
|
|
|
|
|
{
|
|
|
|
|
foreach (CustomTitle customTitle in StubCustomTitle.GetCustomTitles())
|
|
|
|
|
{
|
|
|
|
|
if (customTitle.Name == custom)
|
|
|
|
|
{
|
|
|
|
|
return customTitle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public InfoTitle? GetInfoTitleByUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Album? GetAlbumByUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Artist? GetArtistByName(string name)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddAlbums(List<Album> albumsList)
|
|
|
|
|
{
|
|
|
|
|
foreach (Album a in albumsList)
|
|
|
|
|
{
|
|
|
|
|
StubAlbum.AddAlbum(a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddArtists(List<Artist> artistsList)
|
|
|
|
|
{
|
|
|
|
|
foreach (Artist a in artistsList)
|
|
|
|
|
{
|
|
|
|
|
StubArtist.AddArtist(a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddPlaylists(List<Playlist> playlistsList)
|
|
|
|
|
{
|
|
|
|
|
foreach (Playlist p in playlistsList)
|
|
|
|
|
{
|
|
|
|
|
StubPlaylist.AddPlaylist(p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddCustomTitles(List<CustomTitle> customTitlesList)
|
|
|
|
|
{
|
|
|
|
|
foreach (CustomTitle ct in customTitlesList)
|
|
|
|
|
{
|
|
|
|
|
StubCustomTitle.AddCustomTitle(ct);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddInfoTitles(List<InfoTitle> infoTitlesList)
|
|
|
|
|
{
|
|
|
|
|
foreach (InfoTitle it in infoTitlesList)
|
|
|
|
|
{
|
|
|
|
|
StubInfoTitle.AddInfoTitle(it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Playlist? GetPlaylistByUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
foreach (Playlist p in StubPlaylist.Playlists)
|
|
|
|
|
{
|
|
|
|
|
if (p.ImageURL == url)
|
|
|
|
|
{
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateCustomTitle(CustomTitle title, string name, string url, string info, string path)
|
|
|
|
|
{
|
|
|
|
|
title.Name = name;
|
|
|
|
|
title.ImageURL = url;
|
|
|
|
|
title.Information = info;
|
|
|
|
|
title.Path = path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateCustomTitleByUrl(string url, string name, string newUrl, string info, string path)
|
|
|
|
|
{
|
|
|
|
|
CustomTitle? title = GetCustomTitleByUrl(url);
|
|
|
|
|
if (title != null)
|
|
|
|
|
{
|
|
|
|
|
title.Name = name;
|
|
|
|
|
title.ImageURL = newUrl;
|
|
|
|
|
title.Information = info;
|
|
|
|
|
title.Path = path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateInfoTitle(InfoTitle title, string name, string url, string info, Artist artist, string description, Genre genre)
|
|
|
|
|
{
|
|
|
|
|
title.Name = name;
|
|
|
|
|
title.ImageURL = url;
|
|
|
|
|
title.Information = info;
|
|
|
|
|
title.Artist = artist;
|
|
|
|
|
title.Description = description;
|
|
|
|
|
title.Genre = genre;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateInfoTitleByName(string url, string name, string newUrl, string info, Artist artist, string description, Genre genre)
|
|
|
|
|
{
|
|
|
|
|
InfoTitle? title = GetInfoTitleByUrl(url);
|
|
|
|
|
if (title != null)
|
|
|
|
|
{
|
|
|
|
|
title.Name = name;
|
|
|
|
|
title.ImageURL = newUrl;
|
|
|
|
|
title.Information = info;
|
|
|
|
|
title.Artist = artist;
|
|
|
|
|
title.Description = description;
|
|
|
|
|
title.Genre = genre;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateInfoTitleByArtistName(InfoTitle title, string name, string url, string info, string artist, string description, Genre genre)
|
|
|
|
|
{
|
|
|
|
|
title.Name = name;
|
|
|
|
|
title.ImageURL = url;
|
|
|
|
|
title.Information = info;
|
|
|
|
|
Artist? artist2 = GetArtistByName(artist);
|
|
|
|
|
if (artist2 != null)
|
|
|
|
|
{
|
|
|
|
|
title.Artist = artist2;
|
|
|
|
|
}
|
|
|
|
|
title.Description = description;
|
|
|
|
|
title.Genre = genre;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateInfoTitleByNameByArtistName(string url, string name, string newUrl, string info, string artist, string description, Genre genre)
|
|
|
|
|
{
|
|
|
|
|
InfoTitle? title = GetInfoTitleByUrl(url);
|
|
|
|
|
if (title != null)
|
|
|
|
|
{
|
|
|
|
|
title.Name = name;
|
|
|
|
|
title.ImageURL = newUrl;
|
|
|
|
|
title.Information = info;
|
|
|
|
|
Artist? artist2 = GetArtistByName(artist);
|
|
|
|
|
if (artist2 != null)
|
|
|
|
|
{
|
|
|
|
|
title.Artist = artist2;
|
|
|
|
|
}
|
|
|
|
|
title.Description = description;
|
|
|
|
|
title.Genre = genre;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateAlbum(Album album, string name, string url, Artist artist, string description, string info)
|
|
|
|
|
{
|
|
|
|
|
album.Name = name;
|
|
|
|
|
album.ImageURL = url;
|
|
|
|
|
album.Artist = artist;
|
|
|
|
|
album.Description = description;
|
|
|
|
|
album.Information = info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateAlbumByUrl(string url, string name, string newUrl, Artist artist, string description, string info)
|
|
|
|
|
{
|
|
|
|
|
Album? album = GetAlbumByUrl(url);
|
|
|
|
|
if (album != null)
|
|
|
|
|
{
|
|
|
|
|
album.Name = name;
|
|
|
|
|
album.ImageURL = newUrl;
|
|
|
|
|
album.Artist = artist;
|
|
|
|
|
album.Description = description;
|
|
|
|
|
album.Information = info;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateAlbumByArtistName(Album album, string name, string url, string artist, string description, string info)
|
|
|
|
|
{
|
|
|
|
|
album.Name = name;
|
|
|
|
|
album.ImageURL = url;
|
|
|
|
|
Artist? artist2 = GetArtistByName(artist);
|
|
|
|
|
if (artist2 != null)
|
|
|
|
|
{
|
|
|
|
|
album.Artist = artist2;
|
|
|
|
|
}
|
|
|
|
|
album.Description = description;
|
|
|
|
|
album.Information = info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateAlbumByUrlByArtistName(string url, string name, string newUrl, string artist, string description, string info)
|
|
|
|
|
{
|
|
|
|
|
Album? album = GetAlbumByUrl(url);
|
|
|
|
|
if (album != null)
|
|
|
|
|
{
|
|
|
|
|
album.Name = name;
|
|
|
|
|
album.ImageURL = newUrl;
|
|
|
|
|
Artist? artist2 = GetArtistByName(artist);
|
|
|
|
|
if (artist2 != null)
|
|
|
|
|
{
|
|
|
|
|
album.Artist = artist2;
|
|
|
|
|
}
|
|
|
|
|
album.Description = description;
|
|
|
|
|
album.Information = info;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdatePlaylist(Playlist playlist, string name, string description, string url)
|
|
|
|
|
{
|
|
|
|
|
playlist.Name = name;
|
|
|
|
|
playlist.Description = description;
|
|
|
|
|
playlist.ImageURL = url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdatePlaylistByUrl(string url, string name, string description, string newUrl)
|
|
|
|
|
{
|
|
|
|
|
Playlist? playlist = GetPlaylistByUrl(url);
|
|
|
|
|
if (playlist != null)
|
|
|
|
|
{
|
|
|
|
|
playlist.Name = name;
|
|
|
|
|
playlist.Description = description;
|
|
|
|
|
playlist.ImageURL = newUrl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateArtist(Artist artist, string name)
|
|
|
|
|
{
|
|
|
|
|
artist.Name = name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateArtistByName(string name, string newName)
|
|
|
|
|
{
|
|
|
|
|
Artist? artist = GetArtistByName(newName);
|
|
|
|
|
if (artist != null)
|
|
|
|
|
{
|
|
|
|
|
artist.Name = newName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveAlbums(List<Album> albumsList)
|
|
|
|
|
{
|
|
|
|
|
foreach (Album album in albumsList)
|
|
|
|
|
{
|
|
|
|
|
StubAlbum.RemoveAlbum(album);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveArtists(List<Artist> artistsList)
|
|
|
|
|
{
|
|
|
|
|
foreach (Artist artist in artistsList)
|
|
|
|
|
{
|
|
|
|
|
StubArtist.RemoveArtist(artist);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemovePlaylists(List<Playlist> playlistsList)
|
|
|
|
|
{
|
|
|
|
|
foreach (Playlist playlist in playlistsList)
|
|
|
|
|
{
|
|
|
|
|
StubPlaylist.RemovePlaylist(playlist);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveCustomTitles(List<CustomTitle> customTitlesList)
|
|
|
|
|
{
|
|
|
|
|
foreach (CustomTitle customTitle in customTitlesList)
|
|
|
|
|
{
|
|
|
|
|
StubCustomTitle.RemoveCustomTitle(customTitle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveInfoTitles(List<InfoTitle> infoTitlesList)
|
|
|
|
|
{
|
|
|
|
|
foreach (InfoTitle infoTitle in infoTitlesList)
|
|
|
|
|
{
|
|
|
|
|
StubInfoTitle.RemoveInfoTitle(infoTitle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsPlaylist(Playlist playlist)
|
|
|
|
|
{
|
|
|
|
|
foreach (Playlist p in StubPlaylist.Playlists)
|
|
|
|
|
{
|
|
|
|
|
if (p == playlist)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsPlaylistByUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
foreach (Playlist p in StubPlaylist.Playlists)
|
|
|
|
|
{
|
|
|
|
|
if (p.ImageURL == url)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsAlbum(Album album)
|
|
|
|
|
{
|
|
|
|
|
foreach (Album a in StubAlbum.Albums)
|
|
|
|
|
{
|
|
|
|
|
if (a == album)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsAlbumByUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
foreach (Album a in StubAlbum.Albums)
|
|
|
|
|
{
|
|
|
|
|
if (a.ImageURL == url)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsArtist(Artist artist)
|
|
|
|
|
{
|
|
|
|
|
foreach (Artist a in StubArtist.Artists)
|
|
|
|
|
{
|
|
|
|
|
if (a == artist)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsArtistByName(string name)
|
|
|
|
|
{
|
|
|
|
|
foreach (Artist a in StubArtist.Artists)
|
|
|
|
|
{
|
|
|
|
|
if (a.Name == name)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsCustomTitle(CustomTitle title)
|
|
|
|
|
{
|
|
|
|
|
foreach (CustomTitle ct in StubCustomTitle.CustomTitles)
|
|
|
|
|
{
|
|
|
|
|
if (title == ct)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsCustomTitleByUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
foreach (CustomTitle ct in StubCustomTitle.CustomTitles)
|
|
|
|
|
{
|
|
|
|
|
if (ct.ImageURL == url)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsInfoTitle(InfoTitle title)
|
|
|
|
|
{
|
|
|
|
|
foreach (InfoTitle it in StubInfoTitle.InfoTitles)
|
|
|
|
|
{
|
|
|
|
|
if (it == title)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool ExistsInfoTitleByUrl(string url)
|
|
|
|
|
{
|
|
|
|
|
foreach (InfoTitle it in StubInfoTitle.InfoTitles)
|
|
|
|
|
{
|
|
|
|
|
if (it.ImageURL == url)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|