Merge pull request #190 from Vocaluxe/SmallSonglistMods

Small songlist mods
This commit is contained in:
Florian Küpper committed 2016-02-03 09:53:33 +01:00
commit b6b6f72f73
3 files changed
+44 -5

No files matched your search

+3
View File
@@ -163,6 +163,7 @@ namespace Vocaluxe.Base
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerActive;
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerEncryption;
[DefaultValue(3000)] public int ServerPort;
[DefaultValue(70)] public int SongCountCoverThreshold;
}
#pragma warning restore 649
// ReSharper restore UnassignedField.Global
@@ -495,6 +496,8 @@ namespace Vocaluxe.Base
return "Server Encryption On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
case "ServerPort":
return "Server Port (default: 3000) [1..65535]";
case "SongCountCoverThreshold":
return "Threshold of songs for that covers will not longer be included in get-all-songs-requests (e.g. song list) (default: 70) [-1..65535] -1 => always deliver covers";
case "Stretch":
return "Stretch view to full window size: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
default:
+23 -4
View File
@@ -624,11 +624,20 @@ namespace Vocaluxe.Base.Server
return _GetSongInfo(song, true);
}
private static SSongInfo[] _SongInfoCache = null;
public static SSongInfo[] GetAllSongs()
{
List<CSong> songs = CSongs.Songs;
return (from s in songs
select _GetSongInfo(s, false)).ToArray<SSongInfo>();
bool sendCovers = CConfig.Config.Server.SongCountCoverThreshold == -1 || CConfig.Config.Server.SongCountCoverThreshold > CSongs.Songs.Count;
if (_SongInfoCache == null)
{
List<CSong> songs = CSongs.Songs;
_SongInfoCache = (from s in songs
select _GetSongInfo(s, sendCovers)).AsParallel().ToArray<SSongInfo>();
}
return _SongInfoCache;
}
public static string GetMp3Path(int songId)
@@ -658,7 +667,17 @@ namespace Vocaluxe.Base.Server
result.IsDuet = song.IsDuet;
result.SongId = song.ID;
if (includeCover)
result.Cover = new CBase64Image(_CreateDelayedImage(song.Folder + "\\" + song.CoverFileName));
{
if (song.CoverFileName == "")
{
result.Cover = new CBase64Image(_CreateDelayedImage("Website\\img\\noCover.png"));
}
else
{
result.Cover = new CBase64Image(_CreateDelayedImage(song.Folder + "\\" + song.CoverFileName));
}
}
}
return result;
}
+18 -1
View File
@@ -897,9 +897,26 @@
}
for (var id in allSongsCache) {
$('<li id="selectSongLine_' + allSongsCache[id].SongId + '"> <a href="#"> '/*+'<img src="' + ((data[profile].Avatar && data[profile].Avatar.base64Data) ? data[id].Avatar.base64Data : "img/profile.png") + '"> '*/ + ' <h2>' + allSongsCache[id].Artist + '</h2> <p>' + allSongsCache[id].Title + '</p> </a> </li>')
var coverString = "";
var currentCoverId = "";
if (allSongsCache[id].Cover !== null) {
if (allSongsCache[id].Cover.base64Data !== "") {
coverString = '<img src="' + allSongsCache[id].Cover.base64Data + '">';
}
else if (allSongsCache[id].Cover.imageId !== "") {
currentCoverId = "songListCoverId_" + id;
coverString = '<img id="' + currentCoverId + '" src="">';
}
}
$('<li id="selectSongLine_' + allSongsCache[id].SongId + '"> <a href="#"> ' + coverString + ' <h2>' + allSongsCache[id].Artist + '</h2> <p>' + allSongsCache[id].Title + '</p> </a> </li>')
.appendTo('#selectSongList')
.click(handleSelectSongLineClick);
if (currentCoverId !== "") {
imageLoader.delayedImageLoad($("#" + currentCoverId)[0], allSongsCache[id].Cover.imageId, "img/noCover.png");
}
}
$('#selectSongList').listview('refresh');