修正SQL問題,修正遙控器
This commit is contained in:
parent
4466c457fd
commit
af1a18550b
@ -305,6 +305,7 @@ namespace DualScreenDemo
|
||||
|
||||
// 輸入歌曲
|
||||
string songNumber = OverlayForm.ReadSongNumber();
|
||||
Console.WriteLine("輸入A " + songNumber + " readyForSongListInput : " + readyForSongListInput);
|
||||
var song = songListManager.SearchSongByNumber(songNumber);
|
||||
|
||||
|
||||
@ -316,11 +317,13 @@ namespace DualScreenDemo
|
||||
{
|
||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
||||
{
|
||||
Console.WriteLine("F sign for input :" + input);
|
||||
OverlayForm.MainForm.OnUserInput(input);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("A sign for input :" + input);
|
||||
OverlayForm.MainForm.OnUserInput(input);
|
||||
}
|
||||
}
|
||||
@ -420,11 +423,13 @@ namespace DualScreenDemo
|
||||
{
|
||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
||||
{
|
||||
Console.WriteLine("B sign for input :" + input);
|
||||
OverlayForm.MainForm.OnUserInput(input);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("C sign for input :" + input);
|
||||
OverlayForm.MainForm.OnUserInput(input);
|
||||
}
|
||||
}
|
||||
@ -951,11 +956,13 @@ namespace DualScreenDemo
|
||||
{
|
||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
||||
{
|
||||
Console.WriteLine("D sign for number :" + number);
|
||||
OverlayForm.MainForm.OnUserInput(number);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("E sign for number :" + number);
|
||||
OverlayForm.MainForm.OnUserInput(number);
|
||||
}
|
||||
|
||||
|
@ -17,14 +17,14 @@ namespace DBObj
|
||||
{
|
||||
if (category == "全部")
|
||||
{
|
||||
string query = $"SELECT * FROM artists WHERE strokes_abbr >= {minStrokes} AND strokes_abbr <={maxStrokes}";
|
||||
string query = $"SELECT * FROM artists WHERE strokes_abbr >= {minStrokes} AND strokes_abbr <={maxStrokes};";
|
||||
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
||||
return searchResults;
|
||||
//return AllArtists.Where(artist => artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
string query = $"SELECT * FROM artists WHERE category = '{category}' AND strokes_abbr >= {minStrokes} AND strokes_abbr <={maxStrokes}";
|
||||
string query = $"SELECT * FROM artists WHERE category = '{category}' AND strokes_abbr >= {minStrokes} AND strokes_abbr <={maxStrokes};";
|
||||
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
||||
return searchResults;
|
||||
//return AllArtists.Where(artist => artist.Category == category && artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
||||
|
@ -51,28 +51,28 @@ namespace DBObj
|
||||
}
|
||||
*/
|
||||
public List<SongData> SearchNewSongs(){
|
||||
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadNewSongLimit()}";
|
||||
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadNewSongLimit()};";
|
||||
return PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
}
|
||||
public List<SongData> SearchHotSongs(){
|
||||
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_conts DESC LIMIT {PrimaryForm.ReadHotSongLimit()}";
|
||||
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_conts DESC LIMIT {PrimaryForm.ReadHotSongLimit()};";
|
||||
return PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
}
|
||||
public List<SongData> SearchSongsBySinger(string keyword)
|
||||
{
|
||||
Console.WriteLine("keyword : " + keyword);
|
||||
var keywordLower = keyword.ToLower();
|
||||
string query = $"SELECT * FROM song_library_cache WHERE artistA LIKE '%{keywordLower}%' OR artistB LIKE'%{keywordLower}% ORDER BY song_counts DESC;'";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE artistA LIKE '%{keywordLower}%' OR artistB LIKE'%{keywordLower}%'ORDER BY song_counts DESC;";
|
||||
return PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
}
|
||||
public List<SongData> SearchSongsByName(string keyword)
|
||||
{
|
||||
string query = $"SELECT * FROM song_library_cache WHERE LOWER(song_name) LIKE CONCAT('%', LOWER('{keyword}'), '%')";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE LOWER(song_name) LIKE CONCAT('%', LOWER('{keyword}'), '%');";
|
||||
return PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
}
|
||||
public SongData SearchSongByNumber(string songNumber)
|
||||
{
|
||||
string query = $"SELECT * FROM song_library_cache WHERE song_id = {songNumber}";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE song_id = '{songNumber}';";
|
||||
var searchResults =PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
return searchResults.FirstOrDefault();
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
||||
case UIState.SelectingArtist:
|
||||
case UIState.PlayHistory:
|
||||
SetUIState(UIState.Initial);
|
||||
await HandleTimeout("操作逾時,已返回主畫面");
|
||||
await HandleTimeout("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -799,7 +799,6 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
||||
|
||||
public static string ReadSongNumber()
|
||||
{
|
||||
|
||||
string songNumber = MainForm.displayLabel.Text;
|
||||
MainForm.nextSongLabel.Visible = false;
|
||||
return songNumber;
|
||||
@ -1005,7 +1004,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
||||
if (songIndex >= 0 && songIndex < totalSongs)
|
||||
{
|
||||
selectedSong = LanguageSongList[songIndex];
|
||||
Console.WriteLine("Adding song to playlist A: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1);
|
||||
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1);
|
||||
|
||||
|
||||
// DisplayActionWithSong(currentPage, songIndex, "點播");
|
||||
@ -1037,7 +1036,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
||||
if (songIndex < totalSongs)
|
||||
{
|
||||
selectedSong = LanguageSongList[songIndex];
|
||||
Console.WriteLine("Adding song to playlist B: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1 );
|
||||
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1 );
|
||||
|
||||
|
||||
// DisplayActionWithSong(currentPage, songIndex, "插播");
|
||||
@ -1124,8 +1123,8 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
||||
Console.WriteLine("Adding song to playlist C: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1);
|
||||
|
||||
|
||||
// DisplaySongsWithArrows(currentPage, songIndex);
|
||||
AddSongToPlaylist(selectedSong);
|
||||
DisplaySongsWithArrows(currentPage, songIndex);
|
||||
//AddSongToPlaylist(selectedSong);
|
||||
|
||||
|
||||
}
|
||||
@ -1496,11 +1495,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 {PrimaryForm.ReadNewSongLimit()}";
|
||||
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadNewSongLimit()};";
|
||||
}
|
||||
else if (category == Category.HotSongs)
|
||||
{
|
||||
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY song_counts DESC LIMIT {PrimaryForm.ReadHotSongLimit()}";
|
||||
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY song_counts DESC LIMIT {PrimaryForm.ReadHotSongLimit()};";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ namespace DualScreenDemo
|
||||
}
|
||||
|
||||
private string SetQueryforSQL(string contains){
|
||||
string query = $"SELECT * FROM song_library_cache WHERE song_category LIKE '%{contains}%' ORDER BY `song_id` DESC";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE song_category LIKE '%{contains}%' ORDER BY `song_id` DESC;";
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace DualScreenDemo
|
||||
/*guoYuSongs = allSongs.Where(song => song.Category == "國語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團"))
|
||||
.OrderByDescending(song => song.Plays)
|
||||
.ToList();*/
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '國語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '國語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC;";
|
||||
var guoYuSongs = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = guoYuSongs;
|
||||
|
@ -14,7 +14,7 @@ namespace DualScreenDemo
|
||||
/*hanYuSongs = allSongs.Where(song => song.Category == "韓語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團"))
|
||||
.OrderByDescending(song => song.Plays)
|
||||
.ToList();*/
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '韓語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '韓語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC;";
|
||||
var hanYuSongs = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = hanYuSongs;
|
||||
|
@ -15,7 +15,7 @@ namespace DualScreenDemo
|
||||
.OrderByDescending(song => song.Plays)
|
||||
.ToList();*/
|
||||
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '日語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '日語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC;";
|
||||
var riYuSongs = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = riYuSongs;
|
||||
|
@ -14,7 +14,7 @@ namespace DualScreenDemo
|
||||
/*taiYuSongs = allSongs.Where(song => song.Category == "台語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團"))
|
||||
.OrderByDescending(song => song.Plays)
|
||||
.ToList();*/
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '台語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '台語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC;";
|
||||
var taiYuSongs = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = taiYuSongs;
|
||||
|
@ -14,7 +14,7 @@ namespace DualScreenDemo
|
||||
/*yingWenSongs = allSongs.Where(song => song.Category == "英語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團"))
|
||||
.OrderByDescending(song => song.Plays)
|
||||
.ToList();*/
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '英語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '英語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC;";
|
||||
var yingWenSongs = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = yingWenSongs;
|
||||
|
@ -15,7 +15,7 @@ namespace DualScreenDemo
|
||||
.OrderByDescending(song => song.Plays)
|
||||
.ToList();*/
|
||||
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '粵語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '粵語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC;";
|
||||
var yueYuSongs = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = yueYuSongs;
|
||||
|
@ -133,7 +133,7 @@ namespace DualScreenDemo
|
||||
.ToList();*/
|
||||
/* 清空搜尋欄 */
|
||||
ResetinputBox();
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '國語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
|
||||
string query = "SELECT * FROM song_library_cache WHERE language_name = '國語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC;";
|
||||
var guoYuSongs = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = guoYuSongs;
|
||||
|
@ -63,7 +63,7 @@ namespace DualScreenDemo
|
||||
/* 清空搜尋欄 */
|
||||
ResetinputBox();
|
||||
int songLimit = ReadHotSongLimit();
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_counts` DESC LIMIT {songLimit}";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_counts` DESC LIMIT {songLimit};";
|
||||
var guoYuSongs = SearchSongs_Mysql(query);
|
||||
UpdateSongList(guoYuSongs);
|
||||
|
||||
@ -92,7 +92,7 @@ namespace DualScreenDemo
|
||||
UpdateHotSongButtons(activeButton, activeBackground);
|
||||
|
||||
int songLimit = ReadHotSongLimit();
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY `song_counts` DESC LIMIT {songLimit}";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY `song_counts` DESC LIMIT {songLimit};";
|
||||
var selectedSongs = SearchSongs_Mysql(query);
|
||||
|
||||
UpdateSongList(selectedSongs);
|
||||
|
@ -8,7 +8,7 @@ namespace DualScreenDemo
|
||||
UpdateHotSongButtons(guoYuNewSongButtonHotSong, guoYuNewSongHotSongActiveBackground);
|
||||
|
||||
int songLimit = ReadHotSongLimit();
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {songLimit}";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {songLimit};";
|
||||
var selectedSongs = PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
|
||||
currentPage = 0;
|
||||
|
@ -9,7 +9,7 @@ namespace DualScreenDemo
|
||||
|
||||
int songLimit = ReadHotSongLimit();
|
||||
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '台語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {songLimit}";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '台語' ORDER BY `add_date` DESC, `song_counts` DESC LIMIT {songLimit};";
|
||||
var selectedSongs = SearchSongs_Mysql(query);
|
||||
|
||||
currentPage = 0;
|
||||
|
@ -252,7 +252,7 @@ namespace DualScreenDemo
|
||||
return 100;
|
||||
}
|
||||
private string setQueryforNewSong(string category){
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT {ReadNewSongLimit()}";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT {ReadNewSongLimit()};";
|
||||
|
||||
return query;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ namespace DualScreenDemo{
|
||||
{
|
||||
connection.Open();
|
||||
Console.WriteLine("MyDB 連線成功!");
|
||||
string query = $"SELECT COUNT(*) FROM FavoriteSongs WHERE userPhone = '{phonenumber}'";
|
||||
string query = $"SELECT COUNT(*) FROM FavoriteSongs WHERE userPhone = '{phonenumber}';";
|
||||
using (var command = new MySqlCommand(query, connection))
|
||||
{
|
||||
int count = Convert.ToInt32(command.ExecuteScalar());
|
||||
|
@ -133,7 +133,7 @@ namespace DualScreenDemo
|
||||
private void AlbumButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string name = currentSelectedSong.ArtistA;
|
||||
string query = $"SELECT * FROM song_library_cache WHERE artistA = '{name}' ORDER BY add_date DESC";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE artistA = '{name}' ORDER BY add_date DESC;";
|
||||
var selectedSongs = SearchSongs_Mysql(query);
|
||||
/*var selectedSongs = allSongs.Where(song => song.ArtistA == currentSelectedSong.ArtistA)
|
||||
.OrderByDescending(song => song.AddedTime)
|
||||
|
@ -177,7 +177,7 @@ namespace DualScreenDemo
|
||||
// 例如:根據輸入框的內容搜尋歌曲
|
||||
string query = string.IsNullOrWhiteSpace(searchText)
|
||||
? "SELECT * FROM artists; LIMIT 50"
|
||||
: $"SELECT * FROM artists WHERE `pinyin_abbr` LIKE '{searchText}%' ";
|
||||
: $"SELECT * FROM artists WHERE `pinyin_abbr` LIKE '{searchText}%';";
|
||||
//string query = $"SELECT * FROM SongLibrary WHERE `歌星A拼音` LIKE '{searchText}%' OR `歌星B拼音` LIKE '{searchText}%' ";
|
||||
|
||||
var searchResults = SearchSingers_Mysql(query);
|
||||
|
@ -541,7 +541,7 @@ namespace DualScreenDemo
|
||||
if (int.TryParse(searchText, out int length))
|
||||
{
|
||||
//var searchResults = allArtists.Where(artist => artist.Name.Length == length).ToList();
|
||||
string query = $"SELECT * FROM artists WHERE CHAR_LENGTH(name) = {length} ";
|
||||
string query = $"SELECT * FROM artists WHERE CHAR_LENGTH(name) = {length} ;";
|
||||
var searchResults = SearchSingers_Mysql(query);
|
||||
// 設定當前頁數為 0,並加載搜索結果
|
||||
currentPage = 0;
|
||||
|
@ -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 100 ;";
|
||||
var searchResult = SearchSingers_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentArtistList = searchResult;
|
||||
|
@ -550,7 +550,7 @@ namespace DualScreenDemo
|
||||
// 如果輸入框為空,則不進行搜尋
|
||||
return;
|
||||
}
|
||||
string query = $"SELECT * FROM song_library_cache WHERE `song_id` = '{searchText}' ";
|
||||
string query = $"SELECT * FROM song_library_cache WHERE `song_id` = '{searchText}';";
|
||||
|
||||
var searchResults = SearchSongs_Mysql(query);
|
||||
// 重置分頁
|
||||
|
@ -477,7 +477,7 @@ namespace DualScreenDemo
|
||||
string query;
|
||||
if (int.TryParse(searchText, out int length))
|
||||
{
|
||||
query = $"SELECT * FROM song_library_cache WHERE CHAR_LENGTH(song_name) = {length} ";
|
||||
query = $"SELECT * FROM song_library_cache WHERE CHAR_LENGTH(song_name) = {length} ;";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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 100;";
|
||||
var searchResult = SearchSongs_Mysql(query);
|
||||
currentPage = 0;
|
||||
currentSongList = searchResult;
|
||||
|
Loading…
x
Reference in New Issue
Block a user