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
+15 -6

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
</Info> </Info>
<!--Cover definitions when a category is missing a cover--> <!--Cover definitions when a category is missing a cover-->
<CoverGenerator1> <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> <Type>Default</Type>
<Text> <Text>
<!--<Text>: Text to be shown, %TEXT% will be replace by the category name--> <!--<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; return CCover.NoCover;
} }
public CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong)
{
return CCover.GenerateCover(text, type, firstSong);
}
} }
class CBdataBase : IDataBase class CBdataBase : IDataBase
+4 -1
View File
@@ -833,7 +833,9 @@ namespace Vocaluxe.Lib.Draw
public CTextureRef CopyTexture(CTextureRef textureRef) public CTextureRef CopyTexture(CTextureRef textureRef)
{ {
_EnsureMainThread(); // Lock to make sure the texture is not disposed while we are in this method
lock (_Textures)
{
TTextureType texture; TTextureType texture;
if (!_GetTexture(textureRef, out texture, false)) if (!_GetTexture(textureRef, out texture, false))
return null; return null;
@@ -851,6 +853,7 @@ namespace Vocaluxe.Lib.Draw
Debug.Assert(textureRef.OrigSize.Width > 0); Debug.Assert(textureRef.OrigSize.Width > 0);
return _GetTextureReference(textureRef.OrigSize, texture); return _GetTextureReference(textureRef.OrigSize, texture);
} }
}
/// <summary> /// <summary>
/// Removes a texture from the Vram /// Removes a texture from the Vram
+1
View File
@@ -283,6 +283,7 @@ namespace VocaluxeLib
public interface ICover public interface ICover
{ {
CTextureRef GetNoCover(); CTextureRef GetNoCover();
CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong);
} }
public interface IDataBase public interface IDataBase
+3 -4
View File
@@ -314,11 +314,10 @@ namespace VocaluxeLib.Songs
return; return;
if (CoverFileName != "") if (CoverFileName != "")
{ {
if (!CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize())) if (CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
_CoverTextureSmall = CBase.Cover.GetNoCover(); return;
} }
else _CoverTextureSmall = CBase.Cover.GenerateCover(Title, ECoverGeneratorType.Song, null);
_CoverTextureSmall = CBase.Cover.GetNoCover();
} }
private void _CheckFiles() private void _CheckFiles()
+1
View File
@@ -29,6 +29,7 @@ namespace VocaluxeLib
public enum ECoverGeneratorType public enum ECoverGeneratorType
{ {
Default, Default,
Song,
Folder, Folder,
Artist, Artist,
Letter, Letter,