From 5389194830eefc5d4fd8661f2b796d8884b3114a Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sat, 14 Aug 2021 00:35:06 -0500 Subject: [PATCH] add new functionality Signed-off-by: Matt Bruce --- BillboardPlaylistUpdater/App.config | 4 +- .../BillboardPlaylistUpdater.csproj | 8 +- BillboardPlaylistUpdater/Program.cs | 5 +- BillboardPlaylistUpdater/packages.config | 2 +- CdgLib/CdgLib.csproj | 1 + FirebaseKaraoke/FirebaseKaraoke.csproj | 3 +- FirebaseKaraoke/app.config | 14 +-- Herse.Models/Herse.Models.csproj | 3 +- Herse.Models/Song.cs | 7 +- KaraokePlayer/App.config | 22 ++-- KaraokePlayer/KaraokePlayer.csproj | 3 +- .../Properties/Resources.Designer.cs | 2 +- KaraokePlayer/Properties/Settings.Designer.cs | 22 ++-- SingsALot/App.config | 4 +- SingsALot/Properties/Resources.Designer.cs | 44 +++----- SingsALot/Properties/Settings.Designer.cs | 22 ++-- SingsALot/SingsALot.csproj | 3 +- SongCrawler/App.config | 14 +-- SongCrawler/Program.cs | 105 +++++++++++++++--- SongCrawler/SongCrawler.csproj | 3 +- 20 files changed, 180 insertions(+), 111 deletions(-) diff --git a/BillboardPlaylistUpdater/App.config b/BillboardPlaylistUpdater/App.config index 5ea4469..42ad02f 100644 --- a/BillboardPlaylistUpdater/App.config +++ b/BillboardPlaylistUpdater/App.config @@ -5,7 +5,7 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/BillboardPlaylistUpdater/BillboardPlaylistUpdater.csproj b/BillboardPlaylistUpdater/BillboardPlaylistUpdater.csproj index 7eecdb5..d314854 100644 --- a/BillboardPlaylistUpdater/BillboardPlaylistUpdater.csproj +++ b/BillboardPlaylistUpdater/BillboardPlaylistUpdater.csproj @@ -9,11 +9,12 @@ Properties BillboardPlaylistUpdater BillboardPlaylistUpdater - v4.5.2 + v4.7.2 512 true + AnyCPU @@ -42,9 +43,8 @@ ..\packages\AngleSharp.0.9.9\lib\net45\AngleSharp.dll True - - ..\packages\DuoVia.FuzzyStrings.1.0.1\lib\net40\DuoVia.FuzzyStrings.dll - True + + ..\packages\DuoVia.FuzzyStrings.2.1.0\lib\net462\DuoVia.FuzzyStrings.dll ..\packages\FireSharp.2.0.4\lib\portable-net45+sl5+wp8+win8\FireSharp.dll diff --git a/BillboardPlaylistUpdater/Program.cs b/BillboardPlaylistUpdater/Program.cs index a37c398..de4da01 100644 --- a/BillboardPlaylistUpdater/Program.cs +++ b/BillboardPlaylistUpdater/Program.cs @@ -24,7 +24,7 @@ namespace BillboardPlaylistUpdater static void Main(string[] args) { - //args = new string[] { "mbrucedogs" }; + //args = new string[] { "mbrucedogstest" }; if (args.Length != 1) { Console.WriteLine("usage: songcrawler partyid songspath"); @@ -55,6 +55,7 @@ namespace BillboardPlaylistUpdater client.Set(firepath, songList); //update Controller Charts for Local Search and save + client.Set(string.Format("controllers/{0}/songList", controller), songList); UpdateSearchLists(); client.Set(string.Format("controllers/{0}/songList", controller), songList); } @@ -155,7 +156,7 @@ namespace BillboardPlaylistUpdater { if (primary.Contains(toMatch) || toMatch.Contains(primary)) { return true; } int diff = primary.LevenshteinDistance(toMatch); - int distance = 4; + int distance = 3; if (toMatch.Length < 6) { distance = 2; } return diff < distance; } diff --git a/BillboardPlaylistUpdater/packages.config b/BillboardPlaylistUpdater/packages.config index d5161bc..2264cd7 100644 --- a/BillboardPlaylistUpdater/packages.config +++ b/BillboardPlaylistUpdater/packages.config @@ -1,7 +1,7 @@  - + diff --git a/CdgLib/CdgLib.csproj b/CdgLib/CdgLib.csproj index 82e7198..e96f347 100644 --- a/CdgLib/CdgLib.csproj +++ b/CdgLib/CdgLib.csproj @@ -11,6 +11,7 @@ CdgLib v4.6 512 + true diff --git a/FirebaseKaraoke/FirebaseKaraoke.csproj b/FirebaseKaraoke/FirebaseKaraoke.csproj index 566d3f1..56a8496 100644 --- a/FirebaseKaraoke/FirebaseKaraoke.csproj +++ b/FirebaseKaraoke/FirebaseKaraoke.csproj @@ -9,10 +9,11 @@ Properties FirebaseKaraoke FirebaseKaraoke - v4.5.2 + v4.7.2 512 + true diff --git a/FirebaseKaraoke/app.config b/FirebaseKaraoke/app.config index 5ea4469..f27eec6 100644 --- a/FirebaseKaraoke/app.config +++ b/FirebaseKaraoke/app.config @@ -1,18 +1,18 @@ - + - - + + - + - - + + - \ No newline at end of file + diff --git a/Herse.Models/Herse.Models.csproj b/Herse.Models/Herse.Models.csproj index c8ec87a..62ca060 100644 --- a/Herse.Models/Herse.Models.csproj +++ b/Herse.Models/Herse.Models.csproj @@ -9,8 +9,9 @@ Properties Herse.Models Herse.Models - v4.5.2 + v4.7.2 512 + true diff --git a/Herse.Models/Song.cs b/Herse.Models/Song.cs index 4192664..61d27fa 100644 --- a/Herse.Models/Song.cs +++ b/Herse.Models/Song.cs @@ -18,9 +18,6 @@ namespace Herse.Models [JsonProperty("genre")] public string Genre { get; set; } - [JsonProperty("year")] - public int Year { get; set; } - [JsonProperty("path")] public string Path { get; set; } @@ -29,6 +26,10 @@ namespace Herse.Models public bool Disabled { get; set; } = false; + [JsonProperty("favorite")] + public bool Favorite { get; set; } = false; + + [JsonIgnore] public FileType FileType { diff --git a/KaraokePlayer/App.config b/KaraokePlayer/App.config index 8d05ae3..44fc4a3 100644 --- a/KaraokePlayer/App.config +++ b/KaraokePlayer/App.config @@ -1,34 +1,34 @@ - + -
+
- - - + + + - + - + - + - - + + - \ No newline at end of file + diff --git a/KaraokePlayer/KaraokePlayer.csproj b/KaraokePlayer/KaraokePlayer.csproj index c51e998..15d90f2 100644 --- a/KaraokePlayer/KaraokePlayer.csproj +++ b/KaraokePlayer/KaraokePlayer.csproj @@ -9,7 +9,7 @@ Properties KaraokePlayer KaraokePlayer - v4.6 + v4.7.2 512 true publish\ @@ -29,6 +29,7 @@ true + AnyCPU diff --git a/KaraokePlayer/Properties/Resources.Designer.cs b/KaraokePlayer/Properties/Resources.Designer.cs index 04ac24a..0149e58 100644 --- a/KaraokePlayer/Properties/Resources.Designer.cs +++ b/KaraokePlayer/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace KaraokePlayer.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/KaraokePlayer/Properties/Settings.Designer.cs b/KaraokePlayer/Properties/Settings.Designer.cs index 52f878f..0d46719 100644 --- a/KaraokePlayer/Properties/Settings.Designer.cs +++ b/KaraokePlayer/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace KaraokePlayer.Properties -{ - - +namespace KaraokePlayer.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/SingsALot/App.config b/SingsALot/App.config index eb51eb6..450238c 100644 --- a/SingsALot/App.config +++ b/SingsALot/App.config @@ -1,7 +1,7 @@  - + @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/SingsALot/Properties/Resources.Designer.cs b/SingsALot/Properties/Resources.Designer.cs index 77647f9..bcf4303 100644 --- a/SingsALot/Properties/Resources.Designer.cs +++ b/SingsALot/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace SingsALot.Properties -{ - - +namespace SingsALot.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace SingsALot.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SingsALot.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/SingsALot/Properties/Settings.Designer.cs b/SingsALot/Properties/Settings.Designer.cs index e71744d..0092d3a 100644 --- a/SingsALot/Properties/Settings.Designer.cs +++ b/SingsALot/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace SingsALot.Properties -{ - - +namespace SingsALot.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/SingsALot/SingsALot.csproj b/SingsALot/SingsALot.csproj index 20d4ef6..29d2fd0 100644 --- a/SingsALot/SingsALot.csproj +++ b/SingsALot/SingsALot.csproj @@ -8,7 +8,7 @@ WinExe SingsALot SingsALot - v4.6.1 + v4.7.2 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 @@ -30,6 +30,7 @@ 1.0.0.%2a false true + AnyCPU diff --git a/SongCrawler/App.config b/SongCrawler/App.config index 1a93cb3..6d71e5a 100644 --- a/SongCrawler/App.config +++ b/SongCrawler/App.config @@ -1,18 +1,18 @@ - + - - + + - + - - + + - \ No newline at end of file + diff --git a/SongCrawler/Program.cs b/SongCrawler/Program.cs index 62942c7..12d2214 100644 --- a/SongCrawler/Program.cs +++ b/SongCrawler/Program.cs @@ -31,7 +31,7 @@ namespace SongCrawler private static void CrawlSongs(string[] args) { - //string [] test = { "mbrucedogs", "z:\\" }; + //string [] test = { "mbrucedogstest", "z:\\" }; //args = test; if (args.Length != 2) { @@ -46,14 +46,39 @@ namespace SongCrawler BasePath = ConfigurationManager.AppSettings["Firebase.Path"] }; FireSharp.FirebaseClient client = new FireSharp.FirebaseClient(config); - string firepath = string.Format("controllers/{0}/songs", controller); + string songsPath = string.Format("controllers/{0}/songs", controller); + string favoritesPath = string.Format("controllers/{0}/favorites", controller); + string disabledPath = string.Format("controllers/{0}/disabled", controller); Console.WriteLine("Loading current library"); - List songs = client.Get(firepath).ResultAs>(); - if (songs != null) - Console.WriteLine(string.Format("{0} songs loaded", songs.Count)); - else + + List songs = null; // client.Get(songsPath).ResultAs>(); + List disabled = null; + List favorited = null; + try + { + disabled = client.Get(disabledPath).ResultAs>(); + } + catch + { + disabled = convertToList(client.Get(disabledPath).Body); + } + + try + { + favorited = client.Get(favoritesPath).ResultAs>(); + } + catch + { + favorited = convertToList(client.Get(favoritesPath).Body); + } + + //if (songs != null) + // Console.WriteLine(string.Format("{0} songs loaded", songs.Count)); + //else songs = new List(); + client.Set(songsPath, songs); + List files = new List(); files.AddRange(FindFiles("mp4", songpath)); files.AddRange(FindFiles("mp3", songpath)); @@ -68,26 +93,82 @@ namespace SongCrawler { song = MakeSong(filepath); Console.WriteLine(string.Format("{0:000000}/{1} - {2} - {3}", i, files.Count, song.Artist, song.Title)); - if (!songs.Any(s => s.Path.ToLower() == song.Path.ToLower())) songs.Add(song); + songs.Add(song); } catch (Exception ex) { Console.WriteLine(ex.Message); } } - client.Set(firepath, songs); + + //sync all favorite, history, disabled + if (favorited != null && favorited.Count > 0) + { + favorited.ForEach(s => + { + if (s != null) + { + var found = songs.Find(ls => s.Path.ToLower() == ls.Path.ToLower()); + if (found != null) + { + found.Favorite = true; + } + } + }); + } + + if (disabled != null && disabled.Count > 0) + { + disabled.ForEach(s => + { + if (s != null) + { + var found = songs.Find(ls => s.Path.ToLower() == ls.Path.ToLower()); + if (found != null) + { + found.Disabled = true; + } + } + }); + } + + client.Set(songsPath, songs); List created = new List(); foreach (Song s in songs) { created.Add(new CreatedSong(File.GetCreationTime(s.Path), s)); } + var first200 = created.Where(s => s.created != null).OrderByDescending(s => s.created).Take(200); - var added = first200.Select(s => s.song).ToList(); + var added = first200.Select(s => new PathOnly(path: s.song.Path)).ToList(); string newSongs = string.Format("controllers/{0}/newSongs", controller); - client.Set(newSongs, added); + client.Set(newSongs, first200); } + private class PathOnly + { + [JsonProperty("path")] + public String Path { get; set; } + public PathOnly(string path) + { + this.Path = path; + } + } + + private static List convertToList(dynamic json) + { + dynamic data = JsonConvert.DeserializeObject(json); + var list = new List(); + foreach (var itemDynamic in data) + { + var fjson = itemDynamic.Value.ToString(); + var f = JsonConvert.DeserializeObject(fjson); + list.Add(f); + } + return list; + } + private static void DeleteSongs(string[] args) { if (args.Length != 3) @@ -334,10 +415,6 @@ namespace SongCrawler if (tagFile.Tag.FirstGenre != null) { song.Genre = tagFile.Tag.FirstGenre.Trim(); } - if (tagFile.Tag.Year > 0) - { - song.Year = (int)tagFile.Tag.Year; - } } catch { diff --git a/SongCrawler/SongCrawler.csproj b/SongCrawler/SongCrawler.csproj index cc7e434..2439c41 100644 --- a/SongCrawler/SongCrawler.csproj +++ b/SongCrawler/SongCrawler.csproj @@ -9,11 +9,12 @@ Properties SongCrawler SongCrawler - v4.5.2 + v4.7.2 512 true + AnyCPU