Webserver: Added a threshold to the config which decides at how many song we stop sending covers on get-all-songs requests.

This commit is contained in:
lukeIam committed 2015-12-20 17:58:58 +01:00
1 parent 871a7227fc
commit df311b2916
2 files changed
+6 -1

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:
+3 -1
View File
@@ -628,11 +628,13 @@ namespace Vocaluxe.Base.Server
private static SSongInfo[] songInfoCache = null;
public static SSongInfo[] GetAllSongs()
{
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, false)).AsParallel().ToArray<SSongInfo>();
select _GetSongInfo(s, sendCovers)).AsParallel().ToArray<SSongInfo>();
}
return songInfoCache;