Added TODO's for checking if Cover art already exists. Added functionality in DirectoryManager to switch to the CoverArt path when explicitly request, otherwise defaults to the music root path. Added skeleton function for CoverArtRepository in the CoverArtRepository and SongManager
This commit is contained in:
@@ -160,9 +160,17 @@ namespace Icarus.Controllers.Managers
|
|||||||
return songPath;
|
return songPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialize()
|
private void Initialize(DirectoryTypes dirTypes = DirectoryTypes.Music)
|
||||||
{
|
{
|
||||||
_rootSongDirectory = _config.GetValue<string>("RootMusicPath");
|
switch (dirTypes)
|
||||||
|
{
|
||||||
|
case DirectoryTypes.Music:
|
||||||
|
_rootSongDirectory = _config.GetValue<string>("RootMusicPath");
|
||||||
|
break;
|
||||||
|
case DirectoryTypes.CoverArt:
|
||||||
|
_rootSongDirectory = _config.GetValue<string>("CoverArtPath");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsDirectoryEmpty(string path)
|
private bool IsDirectoryEmpty(string path)
|
||||||
@@ -201,5 +209,14 @@ namespace Icarus.Controllers.Managers
|
|||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region enums
|
||||||
|
private enum DirectoryTypes
|
||||||
|
{
|
||||||
|
Music = 0,
|
||||||
|
CoverArt
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,7 +341,8 @@ namespace Icarus.Controllers.Managers
|
|||||||
}
|
}
|
||||||
public async Task SaveSongToFileSystem(IFormFile songFile, SongRepository songStore,
|
public async Task SaveSongToFileSystem(IFormFile songFile, SongRepository songStore,
|
||||||
AlbumRepository albumStore, ArtistRepository artistStore,
|
AlbumRepository albumStore, ArtistRepository artistStore,
|
||||||
GenreRepository genreStore, YearRepository yearStore)
|
GenreRepository genreStore, YearRepository yearStore,
|
||||||
|
CoverArtRepository coverStore)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ namespace Icarus.Controllers.V1
|
|||||||
YearRepository yearStore = HttpContext.RequestServices
|
YearRepository yearStore = HttpContext.RequestServices
|
||||||
.GetService(typeof(YearRepository)) as YearRepository;
|
.GetService(typeof(YearRepository)) as YearRepository;
|
||||||
|
|
||||||
|
CoverArtRepository CoverArtRepository = HttpContext
|
||||||
|
.RequestServices
|
||||||
|
.GetService
|
||||||
|
(typeof(CoverArtRepository)) as CoverArtRepository;
|
||||||
|
|
||||||
Console.WriteLine("Uploading song...");
|
Console.WriteLine("Uploading song...");
|
||||||
_logger.LogInformation("Uploading song...");
|
_logger.LogInformation("Uploading song...");
|
||||||
|
|
||||||
@@ -92,7 +97,7 @@ namespace Icarus.Controllers.V1
|
|||||||
|
|
||||||
await _songMgr.SaveSongToFileSystem(sng, songRepository,
|
await _songMgr.SaveSongToFileSystem(sng, songRepository,
|
||||||
albumStoreContext, artistStoreContext,
|
albumStoreContext, artistStoreContext,
|
||||||
genreStore, yearStore);
|
genreStore, yearStore, CoverArtRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -75,6 +75,33 @@ namespace Icarus.Database.Repositories
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DoesCoverArtExist(CoverArt cover)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// TODO: Implement this
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var msg = ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public bool DoesCoverArtExist(Song song)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// TODO: Implement this
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var msg = ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveCoverArt(CoverArt coverArt)
|
public void SaveCoverArt(CoverArt coverArt)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user