202508041108

闗包帳 不卡歌
全筆數改為1000 筆
This commit is contained in:
jasonchenwork 2025-08-04 11:08:40 +08:00
parent 39b7257db1
commit 7a1db74896
21 changed files with 59 additions and 37 deletions

View File

@ -54,12 +54,12 @@ namespace DBObj
*/
public List<SongData> SearchNewSongs()
{
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {Utils.Env.GetInt("NewSongLimit", 100)};";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT 1000;";
return select_Mysql(query);
}
public List<SongData> SearchHotSongs()
{
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT 1000;";
return select_Mysql(query);
}
public List<SongData> SearchSongsBySinger(string keyword)

View File

@ -129,6 +129,19 @@ namespace DBObj
}
}
public static void roomClose()
{
SongData song;
while (not_played.Count > 0)
{
song = not_played[0];
not_played.RemoveAt(0);
song.SetState(PlayState.Skipped);
played.Add(song);
}
Add(close);
}
public static void clearSong()
{
@ -136,5 +149,6 @@ namespace DBObj
not_played.Clear();
played.Clear();
}
}
}

View File

@ -1303,11 +1303,11 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
if (category == Category.NewSongs)
{
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY add_date DESC LIMIT {Utils.Env.GetInt("NewSongLimit", 100)};";
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY add_date DESC LIMIT 1000;";
}
else if (category == Category.HotSongs)
{
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY song_counts DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY song_counts DESC LIMIT 1000;";
}
else
{

View File

@ -62,7 +62,7 @@ namespace DualScreenDemo
isOnOrderedSongsPage = false;
/* 清空搜尋欄 */
ResetinputBox();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_counts` DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_counts` DESC LIMIT 1000;";
var guoYuSongs = SearchSongs_Mysql(query);
UpdateSongList(guoYuSongs);
@ -90,7 +90,7 @@ namespace DualScreenDemo
{
UpdateHotSongButtons(activeButton, activeBackground);
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY `song_counts` DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY `song_counts` DESC LIMIT 1000;";
var selectedSongs = SearchSongs_Mysql(query);
UpdateSongList(selectedSongs);

View File

@ -7,7 +7,7 @@ namespace DualScreenDemo
// 重置其他按钮背景
UpdateHotSongButtons(guoYuNewSongButtonHotSong, guoYuNewSongHotSongActiveBackground);
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT 1000;";
var selectedSongs = PrimaryForm.Instance.SearchSongs_Mysql(query);
currentPage = 0;

View File

@ -7,7 +7,7 @@ namespace DualScreenDemo
// 重置其他按钮背景
UpdateHotSongButtons(taiYuNewSongButtonHotSong, taiYuNewSongHotSongActiveBackground);
string query = $"SELECT * FROM song_library_cache WHERE language_name = '台語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '台語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT 1000;";
var selectedSongs = SearchSongs_Mysql(query);
currentPage = 0;

View File

@ -75,7 +75,7 @@ namespace DualScreenDemo
/* 清空搜尋欄 */
ResetinputBox();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT 100";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT 1000";
var guoYuSongs = SearchSongs_Mysql(query);
currentPage = 0;
totalPages = (int)Math.Ceiling((double)guoYuSongs.Count / itemsPerPage);
@ -120,7 +120,7 @@ namespace DualScreenDemo
activeButton.BackgroundImage = activeBackground;
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY song_counts DESC LIMIT 100";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY song_counts DESC LIMIT 1000";
var selectedSongs = SearchSongs_Mysql(query);
currentPage = 0;

View File

@ -82,10 +82,6 @@ namespace DualScreenDemo
/* 清空搜尋欄 */
ResetinputBox();
/*guoYuSongs2 = allSongs.Where(song => song.Category == "國語")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();*/
string query = setQueryforNewSong("國語");
var guoYuSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
@ -219,7 +215,7 @@ namespace DualScreenDemo
}
private string setQueryforNewSong(string category){
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT {Utils.Env.GetInt("NewSongLimit", 100)};";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT 1000;";
return query;
}

View File

@ -524,7 +524,7 @@ namespace DualScreenDemo
private void FindZhuYiSingers(){
string searchText = inputBoxZhuYinSingers.Text;
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM artists LIMIT 50;"
? "SELECT * FROM artists LIMIT 1000;"
: $"SELECT * FROM artists WHERE `phonetic_abbr` LIKE '{searchText}%';";
//string query = $"SELECT * FROM ArtistLibrary WHERE `歌手注音` LIKE '{searchText}%' ";
var searchResults = SearchSingers_Mysql(query);

View File

@ -274,7 +274,7 @@ namespace DualScreenDemo
private void FindEnglishSingers(){
string searchText = inputBoxEnglishSingers.Text;
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM artists LIMIT 50;"
? "SELECT * FROM artists LIMIT 1000;"
: $"SELECT * FROM artists WHERE `name` LIKE '%{searchText}%';";
//string query = $"SELECT * FROM ArtistLibrary WHERE `歌手姓名` LIKE '{searchText}%' ";
var searchResults = SearchSingers_Mysql(query);

View File

@ -290,7 +290,7 @@ namespace DualScreenDemo
private void FindHandwritingSingers(){
string searchText = handwritingInputBoxForSingers.Text;
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM artists LIMIT 50;"
? "SELECT * FROM artists LIMIT 1000;"
: $"SELECT * FROM artists WHERE `name` LIKE '{searchText}%';";
//string query = $"SELECT * FROM ArtistLibrary WHERE `歌手姓名` LIKE '{searchText}%' ";
var searchResults = SearchSingers_Mysql(query);

View File

@ -176,7 +176,7 @@ namespace DualScreenDemo
// 在這裡添加搜尋歌曲的邏輯
// 例如:根據輸入框的內容搜尋歌曲
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM artists; LIMIT 50"
? "SELECT * FROM artists; LIMIT 1000"
: $"SELECT * FROM artists WHERE `pinyin_abbr` LIKE '{searchText}%';";
//string query = $"SELECT * FROM SongLibrary WHERE `歌星A拼音` LIKE '{searchText}%' OR `歌星B拼音` LIKE '{searchText}%' ";

View File

@ -37,7 +37,7 @@ namespace DualScreenDemo
isOnOrderedSongsPage = false;
/* 清空搜尋欄 */
ResetinputBox();
string query = $"SELECT * FROM artists WHERE category = '男' LIMIT 100 ;";
string query = $"SELECT * FROM artists WHERE category = '男' LIMIT 1000 ;";
var searchResult = SearchSingers_Mysql(query);
currentPage = 0;
currentArtistList = searchResult;

View File

@ -311,7 +311,7 @@ namespace DualScreenDemo
// 例如:根據輸入框的內容搜尋歌曲
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM song_library_cache ORDER BY `song_id` DESC LIMIT 200;"
? "SELECT * FROM song_library_cache ORDER BY `song_id` DESC LIMIT 1000;"
: $"SELECT * FROM song_library_cache WHERE `phonetic_abbr` LIKE '{searchText}%' ORDER BY `song_id`;";
var searchResults = SearchSongs_Mysql(query);

View File

@ -230,7 +230,7 @@ namespace DualScreenDemo
string searchText = inputBoxEnglishSongs.Text;
// 檢查是否為空字串或空白字元
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 200;"
? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 1000;"
: $"SELECT * FROM song_library_cache WHERE song_name LIKE '{searchText}%' ORDER BY song_id DESC;";
var searchResults = SearchSongs_Mysql(query);

View File

@ -287,7 +287,7 @@ namespace DualScreenDemo
// 在這裡添加搜尋歌曲的邏輯
// 例如:根據輸入框的內容搜尋歌曲
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 200;"
? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 1000;"
: $"SELECT * FROM song_library_cache WHERE song_name LIKE '{searchText}%' ORDER BY song_id DESC;";

View File

@ -266,7 +266,7 @@ namespace DualScreenDemo
// 在這裡添加搜尋歌曲的邏輯
// 例如:根據輸入框的內容搜尋歌曲
string query = string.IsNullOrWhiteSpace(searchText)
? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 200;"
? "SELECT * FROM song_library_cache ORDER BY song_id DESC LIMIT 1000;"
: $"SELECT * FROM song_library_cache WHERE pinyin_abbr LIKE '{searchText}%' ORDER BY `song_id` DESC;";
var searchResults = SearchSongs_Mysql(query);
// 重置分頁

View File

@ -49,7 +49,7 @@ namespace DualScreenDemo
isOnOrderedSongsPage = false;
ResetinputBox();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' LIMIT 100;";
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' LIMIT 1000;";
var searchResult = SearchSongs_Mysql(query);
currentPage = 0;
totalPages = (int)Math.Ceiling((double)searchResult.Count / itemsPerPage);

View File

@ -13,7 +13,7 @@ namespace DualScreenDemo
private static PrimaryForm primaryForm; // 儲存實例的參考
public static Room room = new Room();
public static string verSion = "Server V2.6 202508011600";
public static string verSion = "Server V2.7 202508041108";
[STAThread]
static void Main()

View File

@ -57,7 +57,7 @@ namespace DataCheck
if (fileName == "welcome") {
DBObj.SongList.welcome=new SongData("0", "歡迎光臨", @"D:\video\welcome.mpg", 1 ,true);
} else if (fileName == "CLOSE") {
DBObj.SongList.close =new SongData("0", "結束播放", @"D:\video\CLOSE.MPG", 1 ,true);
DBObj.SongList.close =new SongData("0", "謝謝光臨", @"D:\video\CLOSE.MPG", 1 ,true);
} else {
//Console.WriteLine($"{fileName} {Path.Combine(localPath, serverFile.Key)}");
publicList.Add(new SongData(

30
Room.cs
View File

@ -11,12 +11,14 @@ namespace DualScreenDemo
public string hostName;
private string State = "error";
private DateTime? startedAt;
private DateTime? endedAt;
public Room()
{
hostName = System.Net.Dns.GetHostName();
branch_id =getBranchId();
State =getDB();
Console.WriteLine($"hostname status: {hostName},{State}");
branch_id = getBranchId();
State = getDB();
Console.WriteLine($"hostname status: {hostName},{State},{startedAt},{endedAt}");
}
private int getBranchId()
{
@ -40,7 +42,9 @@ namespace DualScreenDemo
if (db.open(query, parameters) && db.found())
{
State = db.Field<string>("status");
if (State.Equals("maintai")) { State = "active"; }
startedAt=ParseTime(db.Field<string>("started_at"));
endedAt=ParseTime(db.Field<string>("ended_at"));
if (State.Equals("maintain")) { State = "active"; }
return State;
}
}
@ -61,16 +65,18 @@ namespace DualScreenDemo
}
public void set(string value)
{
State =getDB();
Console.WriteLine($"hostname status: {hostName},{State},{startedAt},{endedAt}");
string marqueeMessage = "歡迎使用超級巨星歡唱,與你共度美好時光。";
Color c = Color.White;
if (value.Equals("fire"))
if (State.Equals("fire"))
{
PrimaryForm.Instance.ShowSendOffScreen();
VideoPlayerForm.Instance.Pause();
marqueeMessage = "發生火災,請跟隨引導至逃生出口!!!";
c = Color.Red;
}
else if (value.Equals("active"))
else if (State.Equals("active"))
{
DBObj.SongList.clearSong();
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
@ -78,7 +84,7 @@ namespace DualScreenDemo
}
else
{
DBObj.SongList.clearSong();
DBObj.SongList.roomClose();
PrimaryForm.Instance.pictureBoxQRCode.Visible = false;
PrimaryForm.Instance.closeQRCodeButton.Visible = false;
PrimaryForm.Instance.ShowSendOffScreen();
@ -86,14 +92,20 @@ namespace DualScreenDemo
OverlayForm.MainForm.topLeftLabel.Visible = false;
VideoPlayerForm.Instance.PlayNextSong();
//VideoPlayerForm.Instance.PlayNextSong();
PrimaryForm.Instance.logout();
}
State =getDB();
OverlayForm.MainForm.UpdateMarqueeText(marqueeMessage, OverlayForm.MarqueeStartPosition.Middle, c);
}
private DateTime? ParseTime(string value)
{
if (DateTime.TryParse(value, out var dt))
return dt;
return null;
}
public bool IsClose()
{
return State.Equals("closed");