Generate Covers for songs

This commit is contained in:
Flamefire committed 2014-10-23 17:05:57 +02:00
1 parent 0a48c6b74b
commit fe07a2f926
6 files changed
+27 -18

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
</Info>
<!--Cover definitions when a category is missing a cover-->
<CoverGenerator1>
<!--Possible types are: Default, Artist, Letter, Edition, Genre, Language, Year, Decade, Date -->
<!--Possible types are: Default, Song, Artist, Letter, Edition, Genre, Language, Year, Decade, Date -->
<Type>Default</Type>
<Text>
<!--<Text>: Text to be shown, %TEXT% will be replace by the category name-->
+5
View File
@@ -871,6 +871,11 @@ namespace Vocaluxe.Base
{
return CCover.NoCover;
}
public CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong)
{
return CCover.GenerateCover(text, type, firstSong);
}
}
class CBdataBase : IDataBase
+16 -13
View File
@@ -833,23 +833,26 @@ namespace Vocaluxe.Lib.Draw
public CTextureRef CopyTexture(CTextureRef textureRef)
{
_EnsureMainThread();
TTextureType texture;
if (!_GetTexture(textureRef, out texture, false))
return null;
// If bitmap is not yet loaded, wait for it
if (!String.IsNullOrEmpty(texture.TexturePath))
// Lock to make sure the texture is not disposed while we are in this method
lock (_Textures)
{
Task<Size> loader;
lock (_BitmapsLoading)
TTextureType texture;
if (!_GetTexture(textureRef, out texture, false))
return null;
// If bitmap is not yet loaded, wait for it
if (!String.IsNullOrEmpty(texture.TexturePath))
{
_BitmapsLoading.TryGetValue(texture.TexturePath, out loader);
Task<Size> loader;
lock (_BitmapsLoading)
{
_BitmapsLoading.TryGetValue(texture.TexturePath, out loader);
}
if (loader != null)
textureRef.OrigSize = loader.Result;
}
if (loader != null)
textureRef.OrigSize = loader.Result;
Debug.Assert(textureRef.OrigSize.Width > 0);
return _GetTextureReference(textureRef.OrigSize, texture);
}
Debug.Assert(textureRef.OrigSize.Width > 0);
return _GetTextureReference(textureRef.OrigSize, texture);
}
/// <summary>
+1
View File
@@ -283,6 +283,7 @@ namespace VocaluxeLib
public interface ICover
{
CTextureRef GetNoCover();
CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong);
}
public interface IDataBase
+3 -4
View File
@@ -314,11 +314,10 @@ namespace VocaluxeLib.Songs
return;
if (CoverFileName != "")
{
if (!CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
_CoverTextureSmall = CBase.Cover.GetNoCover();
if (CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
return;
}
else
_CoverTextureSmall = CBase.Cover.GetNoCover();
_CoverTextureSmall = CBase.Cover.GenerateCover(Title, ECoverGeneratorType.Song, null);
}
private void _CheckFiles()
+1
View File
@@ -29,6 +29,7 @@ namespace VocaluxeLib
public enum ECoverGeneratorType
{
Default,
Song,
Folder,
Artist,
Letter,