Merge pull request #190 from Vocaluxe/SmallSonglistMods
Small songlist mods
This commit is contained in:
commit
b6b6f72f73
3 files changed
+44
-5
No files matched your search
@@ -163,6 +163,7 @@ namespace Vocaluxe.Base
|
|||||||
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerActive;
|
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerActive;
|
||||||
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerEncryption;
|
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerEncryption;
|
||||||
[DefaultValue(3000)] public int ServerPort;
|
[DefaultValue(3000)] public int ServerPort;
|
||||||
|
[DefaultValue(70)] public int SongCountCoverThreshold;
|
||||||
}
|
}
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
// ReSharper restore UnassignedField.Global
|
// ReSharper restore UnassignedField.Global
|
||||||
@@ -495,6 +496,8 @@ namespace Vocaluxe.Base
|
|||||||
return "Server Encryption On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
|
return "Server Encryption On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
|
||||||
case "ServerPort":
|
case "ServerPort":
|
||||||
return "Server Port (default: 3000) [1..65535]";
|
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":
|
case "Stretch":
|
||||||
return "Stretch view to full window size: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
|
return "Stretch view to full window size: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)));
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -624,11 +624,20 @@ namespace Vocaluxe.Base.Server
|
|||||||
return _GetSongInfo(song, true);
|
return _GetSongInfo(song, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static SSongInfo[] _SongInfoCache = null;
|
||||||
public static SSongInfo[] GetAllSongs()
|
public static SSongInfo[] GetAllSongs()
|
||||||
{
|
{
|
||||||
List<CSong> songs = CSongs.Songs;
|
bool sendCovers = CConfig.Config.Server.SongCountCoverThreshold == -1 || CConfig.Config.Server.SongCountCoverThreshold > CSongs.Songs.Count;
|
||||||
return (from s in songs
|
|
||||||
select _GetSongInfo(s, false)).ToArray<SSongInfo>();
|
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)
|
public static string GetMp3Path(int songId)
|
||||||
@@ -658,7 +667,17 @@ namespace Vocaluxe.Base.Server
|
|||||||
result.IsDuet = song.IsDuet;
|
result.IsDuet = song.IsDuet;
|
||||||
result.SongId = song.ID;
|
result.SongId = song.ID;
|
||||||
if (includeCover)
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -897,9 +897,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var id in allSongsCache) {
|
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')
|
.appendTo('#selectSongList')
|
||||||
.click(handleSelectSongLineClick);
|
.click(handleSelectSongLineClick);
|
||||||
|
|
||||||
|
if (currentCoverId !== "") {
|
||||||
|
imageLoader.delayedImageLoad($("#" + currentCoverId)[0], allSongsCache[id].Cover.imageId, "img/noCover.png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#selectSongList').listview('refresh');
|
$('#selectSongList').listview('refresh');
|
||||||
|
|||||||
Reference in new issue
Block a user