diff --git a/DBObj/SQLManager.cs b/DBObj/SQLManager.cs index e49218a..250dcaa 100644 --- a/DBObj/SQLManager.cs +++ b/DBObj/SQLManager.cs @@ -54,12 +54,12 @@ namespace DBObj */ public List 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 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 SearchSongsBySinger(string keyword) diff --git a/DBObj/SongList.cs b/DBObj/SongList.cs index 9931b2a..547480b 100644 --- a/DBObj/SongList.cs +++ b/DBObj/SongList.cs @@ -129,12 +129,26 @@ 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() { - + isWelcome = true; not_played.Clear(); played.Clear(); } + } } diff --git a/OverlayFormObj/OverlayForm.cs b/OverlayFormObj/OverlayForm.cs index cacbe49..fcee082 100644 --- a/OverlayFormObj/OverlayForm.cs +++ b/OverlayFormObj/OverlayForm.cs @@ -1303,11 +1303,11 @@ private void DisplayArtists(List 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 { diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs index 63299d7..941fdc6 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs @@ -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); diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs index db20f16..43e9516 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSongMandarinNew.cs @@ -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; diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs index 53078df..a989e32 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSongTaiwaneseNew.cs @@ -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; diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs index 0029ac9..c0c451b 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs @@ -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; diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs index 0a91832..fb752cb 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs @@ -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; } diff --git a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs index 2c1b4e7..e8b3f9e 100644 --- a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs +++ b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs @@ -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); diff --git a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.EnglishSearch.cs b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.EnglishSearch.cs index 07a8b61..d67433e 100644 --- a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.EnglishSearch.cs +++ b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.EnglishSearch.cs @@ -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); diff --git a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.HandwritingSearch.cs b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.HandwritingSearch.cs index 6b68699..674487c 100644 --- a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.HandwritingSearch.cs +++ b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.HandwritingSearch.cs @@ -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); diff --git a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.PinyinSearch.cs b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.PinyinSearch.cs index 8f60de5..66677da 100644 --- a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.PinyinSearch.cs +++ b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.PinyinSearch.cs @@ -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}%' "; diff --git a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs index 30f1968..840ab96 100644 --- a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs +++ b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs @@ -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; diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs index 5c351a5..15a1e1d 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs @@ -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); diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs index 41bc125..b852c13 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs @@ -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); diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs index 6891b03..5356241 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.HandwritingSearch.cs @@ -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;"; diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs index 114724a..a990820 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.PinyinSearch.cs @@ -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); // 重置分頁 diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs index 81167c1..865c0db 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs @@ -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); diff --git a/Program.cs b/Program.cs index f852673..6994ccb 100644 --- a/Program.cs +++ b/Program.cs @@ -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() diff --git a/PublicSongChecker.cs b/PublicSongChecker.cs index ea8fdd0..c7662da 100644 --- a/PublicSongChecker.cs +++ b/PublicSongChecker.cs @@ -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( diff --git a/Room.cs b/Room.cs index da070b5..2f76870 100644 --- a/Room.cs +++ b/Room.cs @@ -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("status"); - if (State.Equals("maintai")) { State = "active"; } + startedAt=ParseTime(db.Field("started_at")); + endedAt=ParseTime(db.Field("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");