From 60ff5d008d8b4f2873faffe99a9e2999d70a5179 Mon Sep 17 00:00:00 2001 From: Stefan Date: Wed, 8 Jan 2020 21:48:28 +0100 Subject: [PATCH 1/9] Extended search functions on song list screen (develop) On the song list screen you can activate the search function by pressing F3 or CTRL+F, even in older Vocaluxe versions. In this commit I added special keywords for this search function to allow searching just for the artist or other items, like language or genre, which can't be searched in older Vocaluxe versions. (changed file CSongFilter.cs) Use following keywords to search for a special item: a: = artists t: = title g: = genre y: = year, you can also do y:1980-1989 to find songs from the 80s l: = language c: = creator e: = edition al: = album fi: = file name fo: = folder name **Examples:** a:abba y:1980-1989 y:1999 g:rock l:german **Additional notes:** - If using this keywords, the maximum search results are limited to 200 songs. - Changed the behavior if searching without keywords: Only title and artists will be searched, removed folder and file names. --- Vocaluxe/Base/CSongFilter.cs | 165 ++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 3 deletions(-) diff --git a/Vocaluxe/Base/CSongFilter.cs b/Vocaluxe/Base/CSongFilter.cs index 20596803..acc67d2f 100644 --- a/Vocaluxe/Base/CSongFilter.cs +++ b/Vocaluxe/Base/CSongFilter.cs @@ -1,4 +1,4 @@ -#region license +#region license // This file is part of Vocaluxe. // // Vocaluxe is free software: you can redistribute it and/or modify @@ -93,6 +93,89 @@ namespace Vocaluxe.Base if (_SearchString != "") searchStrings = _SearchString.ToUpper().Split(new char[] {' '}); + String searchForArtist = null; // a: + String searchForTitle = null; // t: + String searchForGenre = null; // g: + String searchForYear = null; // y: + String searchForLanguage = null; // l: + String searchForCreator = null; // c: + String searchForEdition = null; // e: + String searchForAlbum = null; // al: + String searchForFileName = null; // fi: + String searchForFolderName = null; // fo: + bool expertSearch = false; + + if (searchStrings != null) + { + foreach (String searchToken in searchStrings) + { + if (searchToken.Length < 3) + continue; + + String temp = searchToken.Substring(0, 2); + bool foundIt = true; + + switch (temp) + { + case "A:": + searchForArtist = searchToken.Substring(2); + break; + case "T:": + searchForTitle = searchToken.Substring(2); + break; + case "G:": + searchForGenre = searchToken.Substring(2); + break; + case "Y:": + searchForYear = searchToken.Substring(2); + break; + case "L:": + searchForLanguage = searchToken.Substring(2); + break; + case "C:": + searchForCreator = searchToken.Substring(2); + break; + case "E:": + searchForEdition = searchToken.Substring(2); + break; + default: + foundIt = false; + break; + } + + if (foundIt) + { + if (!expertSearch) expertSearch = true; + continue; + } + + if (searchToken.Length < 4) + continue; + + foundIt = true; + temp = searchToken.Substring(0, 3); + + switch (temp) + { + case "AL:": + searchForAlbum = searchToken.Substring(3); + break; + case "FI:": + searchForFileName = searchToken.Substring(3); + break; + case "FO:": + searchForFolderName = searchToken.Substring(3); + break; + default: + foundIt = false; + break; + } + + if (foundIt) + if (!expertSearch) expertSearch = true; + } + } + foreach (CSong song in CSongs.Songs) { if (_PlaylistID != -1 && !CBase.Playlist.ContainsSong(_PlaylistID, song.ID)) @@ -102,9 +185,85 @@ namespace Vocaluxe.Base { if (searchStrings == null) _FilteredSongs.Add(song); + else if (expertSearch) + { + // Stefan1200: Stop at a maximum of 200 search result to prevent performance issues + if (_FilteredSongs.Count >= 200) + break; + + if (searchForAlbum != null && song.Album.ToUpper().Contains(searchForAlbum)) + _FilteredSongs.Add(song); + if (searchForArtist != null && song.Artist.ToUpper().Contains(searchForArtist)) + _FilteredSongs.Add(song); + if (searchForTitle != null && song.Title.ToUpper().Contains(searchForTitle)) + _FilteredSongs.Add(song); + if (searchForCreator != null && song.Creator.ToUpper().Contains(searchForCreator)) + _FilteredSongs.Add(song); + if (searchForFileName != null && song.FileName.ToUpper().Contains(searchForFileName)) + _FilteredSongs.Add(song); + if (searchForFolderName != null && song.FolderName.ToUpper().Contains(searchForFolderName)) + _FilteredSongs.Add(song); + + if (searchForGenre != null) + { + foreach (String genre in song.Genres) + { + if (genre.ToUpper().Contains(searchForGenre)) + _FilteredSongs.Add(song); + } + } + + if (searchForLanguage != null) + { + foreach (String language in song.Languages) + { + if (language.ToUpper().Contains(searchForLanguage)) + _FilteredSongs.Add(song); + } + } + + if (searchForEdition != null) + { + foreach (String edition in song.Editions) + { + if (edition.ToUpper().Contains(searchForEdition)) + _FilteredSongs.Add(song); + } + } + + if (searchForYear != null) + { + int pos = searchForYear.IndexOf("-"); + if (pos == -1) + { + if (song.Year.Contains(searchForYear)) + _FilteredSongs.Add(song); + } + else if (searchForYear.Length == 9) + { + int yearStart = -1; + int yearEnd = -1; + if (!Int32.TryParse(searchForYear.Substring(0, pos), out yearStart)) + continue; + if (!Int32.TryParse(searchForYear.Substring(pos + 1), out yearEnd)) + continue; + + // Stefan1200: Prevent searches like 0000-9999, limit for a max distance of 100 years + if (yearEnd - yearStart > 100) + continue; + + int yearSearch = -1; + if (!Int32.TryParse(song.Year, out yearSearch)) + continue; + + if (yearSearch >= yearStart && yearSearch <= yearEnd) + _FilteredSongs.Add(song); + } + } + } else { - string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper(); + string search = song.Title.ToUpper() + " " + song.Artist.ToUpper(); if (searchStrings.All(search.Contains)) _FilteredSongs.Add(song); @@ -114,4 +273,4 @@ namespace Vocaluxe.Base _Changed = false; } } -} \ No newline at end of file +} From 2b8859b7067c0e10eb27bb6acfcb569d0fe411d7 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sat, 11 Jan 2020 08:52:21 +0100 Subject: [PATCH 2/9] Maximum extended search result count now at 500 --- Vocaluxe/Base/CSongFilter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Base/CSongFilter.cs b/Vocaluxe/Base/CSongFilter.cs index acc67d2f..d0a9a595 100644 --- a/Vocaluxe/Base/CSongFilter.cs +++ b/Vocaluxe/Base/CSongFilter.cs @@ -187,8 +187,8 @@ namespace Vocaluxe.Base _FilteredSongs.Add(song); else if (expertSearch) { - // Stefan1200: Stop at a maximum of 200 search result to prevent performance issues - if (_FilteredSongs.Count >= 200) + // Stefan1200: Stop at a maximum of 500 search result to prevent performance issues + if (_FilteredSongs.Count >= 500) break; if (searchForAlbum != null && song.Album.ToUpper().Contains(searchForAlbum)) From b78df16eea8e353c29e9ff1a065f727edbcb6863 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sat, 11 Jan 2020 09:28:40 +0100 Subject: [PATCH 3/9] Select random song for next round Make sure, that a random song will be picked after a song was sung while a all songs challenge is running. --- PartyModes/PartyModeChallenge/CPartyModeChallenge.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index 46260e8c..da556692 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -427,6 +427,7 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs(); _ScreenSongOptions.Sorting.FilterPlaylistID = -1; + _ScreenSongOptions.Selection.SongIndex = -1; _ScreenSongOptions.Selection.CategoryIndex = -1; _ScreenSongOptions.Selection.CategoryChangeAllowed = true; break; @@ -718,4 +719,4 @@ namespace VocaluxeLib.PartyModes.Challenge return result; } } -} \ No newline at end of file +} From 964336abcc6a5105c92b8d2a6298fba9cd49b6cc Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sat, 11 Jan 2020 10:43:10 +0100 Subject: [PATCH 4/9] Fix: Token of VocaluxeBuildBot for github access was revoked due to inactivity --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4774c28d..9b05da5d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ platform: clone_depth: 15 environment: GitHubKey: - secure: JSlN/em0JdspVn8jwaQ4IjugY6OQi0au4Qq0rhctJmcfGMaEGnUAOmDFULI48REW + secure: sGetWh2XUYs95VBT+QYNPtDW9Rh2/JBuxNNYXytpn7mMudUMcjSKDGErkCTum+ZE init: - git config --global core.autocrlf true install: From a0c49c14d7ba7e86e1b5e21161fa349e7a794d6a Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sat, 11 Jan 2020 10:57:16 +0100 Subject: [PATCH 5/9] Empty commit to test ci build From 405e41da6749e691481ce165b8bc1b3775ee90a5 Mon Sep 17 00:00:00 2001 From: daggeg Date: Sat, 11 Jan 2020 12:49:38 +0100 Subject: [PATCH 6/9] Update CPartyModeChallenge.cs --- PartyModes/PartyModeChallenge/CPartyModeChallenge.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index da556692..518f3817 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -428,7 +428,6 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Sorting.FilterPlaylistID = -1; _ScreenSongOptions.Selection.SongIndex = -1; - _ScreenSongOptions.Selection.CategoryIndex = -1; _ScreenSongOptions.Selection.CategoryChangeAllowed = true; break; From 281bed8db93e494454ea7971590d62c90f9cd117 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sat, 11 Jan 2020 14:34:45 +0100 Subject: [PATCH 7/9] Update CPartyModeChallenge.cs --- PartyModes/PartyModeChallenge/CPartyModeChallenge.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index 518f3817..da556692 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -428,6 +428,7 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Sorting.FilterPlaylistID = -1; _ScreenSongOptions.Selection.SongIndex = -1; + _ScreenSongOptions.Selection.CategoryIndex = -1; _ScreenSongOptions.Selection.CategoryChangeAllowed = true; break; From cb916defaff773db077dfaf0b5d4452300f673b1 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Sat, 11 Jan 2020 19:35:44 +0100 Subject: [PATCH 8/9] Fix: github deployments use the old and invalid token --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9b05da5d..25696802 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -135,7 +135,7 @@ deploy: release: $(APPVEYOR_REPO_TAG_NAME) description: $(APPVEYOR_REPO_COMMIT) auth_token: - secure: JSlN/em0JdspVn8jwaQ4IjugY6OQi0au4Qq0rhctJmcfGMaEGnUAOmDFULI48REW + secure: sGetWh2XUYs95VBT+QYNPtDW9Rh2/JBuxNNYXytpn7mMudUMcjSKDGErkCTum+ZE artifact: ReleaseZip prerelease: $(IS_BETA_RELEASE) on: @@ -147,7 +147,7 @@ deploy: release: Latest Nightly build description: $(APPVEYOR_REPO_COMMIT) auth_token: - secure: JSlN/em0JdspVn8jwaQ4IjugY6OQi0au4Qq0rhctJmcfGMaEGnUAOmDFULI48REW + secure: sGetWh2XUYs95VBT+QYNPtDW9Rh2/JBuxNNYXytpn7mMudUMcjSKDGErkCTum+ZE artifact: ReleaseZip prerelease: true on: From e076f0ce08a05062cf97e0c6ed992f03d340cd33 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sat, 11 Jan 2020 20:14:56 +0100 Subject: [PATCH 9/9] Small code update --- Vocaluxe/Base/CSongFilter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vocaluxe/Base/CSongFilter.cs b/Vocaluxe/Base/CSongFilter.cs index d0a9a595..6d9870e6 100644 --- a/Vocaluxe/Base/CSongFilter.cs +++ b/Vocaluxe/Base/CSongFilter.cs @@ -171,8 +171,8 @@ namespace Vocaluxe.Base break; } - if (foundIt) - if (!expertSearch) expertSearch = true; + if (foundIt && !expertSearch) + expertSearch = true; } }