修正點歌顯示,指令接收回傳
This commit is contained in:
parent
706daa0080
commit
4e6d6242fe
@ -64,8 +64,9 @@ namespace DBObj
|
||||
}
|
||||
public List<SongData> SearchSongsBySinger(string keyword)
|
||||
{
|
||||
Console.WriteLine("keyword : " + keyword);
|
||||
var keywordLower = keyword.ToLower();
|
||||
string query = $"SELECT * FROM song_library_cache WHERE artistA ='{keywordLower}' OR artistB='{keywordLower}'";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE artistA LIKE '%{keywordLower}%' OR artistB LIKE'%{keywordLower}%'";
|
||||
return PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
}
|
||||
public List<SongData> SearchSongsByName(string keyword)
|
||||
|
@ -31,12 +31,12 @@ namespace DualScreenDemo
|
||||
private static CancellationTokenSource _cts;
|
||||
private static Task _serverTask;
|
||||
private static string _baseDirectory = @"themes\superstar\_www"; // 根據實際情況設定
|
||||
private static SongListManager _songListManager;
|
||||
|
||||
private static TaskCompletionSource<string> _qrReadyTcs;
|
||||
|
||||
public static async Task StartServer(string baseDirectory, int port, SongListManager manager, CancellationToken token)
|
||||
{
|
||||
_songListManager = manager;
|
||||
songListManager = manager;
|
||||
string randomFolderName = CreateRandomFolderAndRedirectHTML(baseDirectory);
|
||||
randomFolderPath = randomFolderName;
|
||||
|
||||
@ -116,7 +116,7 @@ namespace DualScreenDemo
|
||||
|
||||
// ✅ 等 QR code 跑完
|
||||
_qrReadyTcs = new TaskCompletionSource<string>();
|
||||
_serverTask = StartServer(_baseDirectory, _port, _songListManager, _cts.Token);
|
||||
_serverTask = StartServer(_baseDirectory, _port, songListManager, _cts.Token);
|
||||
string readyFolder = await _qrReadyTcs.Task;
|
||||
|
||||
// ✅ 等 QR Code 圖片準備好之後再處理 UI 更新
|
||||
@ -344,7 +344,7 @@ namespace DualScreenDemo
|
||||
context.Response.StatusCode = 500;
|
||||
}
|
||||
}
|
||||
|
||||
// 點歌問題
|
||||
private static async Task HandleSearchRequest(HttpListenerContext context)
|
||||
{
|
||||
try
|
||||
@ -361,6 +361,7 @@ namespace DualScreenDemo
|
||||
searchResults = songListManager.SearchHotSongs();
|
||||
break;
|
||||
case "singer":
|
||||
Console.WriteLine("Query : " + searchRequest.Query);
|
||||
searchResults = songListManager.SearchSongsBySinger(searchRequest.Query);
|
||||
break;
|
||||
case "song":
|
||||
|
@ -200,6 +200,8 @@ namespace DualScreenDemo
|
||||
});
|
||||
|
||||
UpdateStateFile(stateFilePath, "CLOSE");
|
||||
byte[] okResponse = Encoding.UTF8.GetBytes("OK\n");
|
||||
stream.Write(okResponse, 0, okResponse.Length);
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -219,6 +221,8 @@ namespace DualScreenDemo
|
||||
VideoPlayerForm.Instance.PlayPublicPlaylist();
|
||||
UpdateStateFile(stateFilePath, "OPEN");
|
||||
|
||||
byte[] okResponse = Encoding.UTF8.GetBytes("OK\n");
|
||||
stream.Write(okResponse, 0, okResponse.Length);
|
||||
continue;
|
||||
}
|
||||
if (command.Trim().Equals("F", StringComparison.OrdinalIgnoreCase))
|
||||
@ -233,6 +237,8 @@ namespace DualScreenDemo
|
||||
|
||||
// 更新狀態檔案(可選,若你要記錄狀態)
|
||||
UpdateStateFile(stateFilePath, "PAUSE");
|
||||
byte[] okResponse = Encoding.UTF8.GetBytes("OK\n");
|
||||
stream.Write(okResponse, 0, okResponse.Length);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user