add new functionality

Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
Matt Bruce 2021-08-14 00:35:06 -05:00
parent a90f23f704
commit 5389194830
20 changed files with 180 additions and 111 deletions

View File

@ -5,7 +5,7 @@
<add key="Firebase.Path" value="https://herse.firebaseio.com/" /> <add key="Firebase.Path" value="https://herse.firebaseio.com/" />
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -15,4 +15,4 @@
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

View File

@ -9,11 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BillboardPlaylistUpdater</RootNamespace> <RootNamespace>BillboardPlaylistUpdater</RootNamespace>
<AssemblyName>BillboardPlaylistUpdater</AssemblyName> <AssemblyName>BillboardPlaylistUpdater</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -42,9 +43,8 @@
<HintPath>..\packages\AngleSharp.0.9.9\lib\net45\AngleSharp.dll</HintPath> <HintPath>..\packages\AngleSharp.0.9.9\lib\net45\AngleSharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="DuoVia.FuzzyStrings, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="DuoVia.FuzzyStrings, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DuoVia.FuzzyStrings.1.0.1\lib\net40\DuoVia.FuzzyStrings.dll</HintPath> <HintPath>..\packages\DuoVia.FuzzyStrings.2.1.0\lib\net462\DuoVia.FuzzyStrings.dll</HintPath>
<Private>True</Private>
</Reference> </Reference>
<Reference Include="FireSharp, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="FireSharp, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\FireSharp.2.0.4\lib\portable-net45+sl5+wp8+win8\FireSharp.dll</HintPath> <HintPath>..\packages\FireSharp.2.0.4\lib\portable-net45+sl5+wp8+win8\FireSharp.dll</HintPath>

View File

@ -24,7 +24,7 @@ namespace BillboardPlaylistUpdater
static void Main(string[] args) static void Main(string[] args)
{ {
//args = new string[] { "mbrucedogs" }; //args = new string[] { "mbrucedogstest" };
if (args.Length != 1) if (args.Length != 1)
{ {
Console.WriteLine("usage: songcrawler partyid songspath"); Console.WriteLine("usage: songcrawler partyid songspath");
@ -55,6 +55,7 @@ namespace BillboardPlaylistUpdater
client.Set(firepath, songList); client.Set(firepath, songList);
//update Controller Charts for Local Search and save //update Controller Charts for Local Search and save
client.Set(string.Format("controllers/{0}/songList", controller), songList);
UpdateSearchLists(); UpdateSearchLists();
client.Set(string.Format("controllers/{0}/songList", controller), songList); client.Set(string.Format("controllers/{0}/songList", controller), songList);
} }
@ -155,7 +156,7 @@ namespace BillboardPlaylistUpdater
{ {
if (primary.Contains(toMatch) || toMatch.Contains(primary)) { return true; } if (primary.Contains(toMatch) || toMatch.Contains(primary)) { return true; }
int diff = primary.LevenshteinDistance(toMatch); int diff = primary.LevenshteinDistance(toMatch);
int distance = 4; int distance = 3;
if (toMatch.Length < 6) { distance = 2; } if (toMatch.Length < 6) { distance = 2; }
return diff < distance; return diff < distance;
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="AngleSharp" version="0.9.9" targetFramework="net452" /> <package id="AngleSharp" version="0.9.9" targetFramework="net452" />
<package id="DuoVia.FuzzyStrings" version="1.0.1" targetFramework="net452" /> <package id="DuoVia.FuzzyStrings" version="2.1.0" targetFramework="net472" />
<package id="FireSharp" version="2.0.4" targetFramework="net452" /> <package id="FireSharp" version="2.0.4" targetFramework="net452" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net452" /> <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net452" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net452" /> <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net452" />

View File

@ -11,6 +11,7 @@
<AssemblyName>CdgLib</AssemblyName> <AssemblyName>CdgLib</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>

View File

@ -9,10 +9,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FirebaseKaraoke</RootNamespace> <RootNamespace>FirebaseKaraoke</RootNamespace>
<AssemblyName>FirebaseKaraoke</AssemblyName> <AssemblyName>FirebaseKaraoke</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="Firebase.Secret" value="9BQHUEJhScgK2FP10hvlToxTlGQpXT94Cvx01piO" /> <add key="Firebase.Secret" value="9BQHUEJhScgK2FP10hvlToxTlGQpXT94Cvx01piO"/>
<add key="Firebase.Path" value="https://herse.firebaseio.com/" /> <add key="Firebase.Path" value="https://herse.firebaseio.com/"/>
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Herse.Models</RootNamespace> <RootNamespace>Herse.Models</RootNamespace>
<AssemblyName>Herse.Models</AssemblyName> <AssemblyName>Herse.Models</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>

View File

@ -18,9 +18,6 @@ namespace Herse.Models
[JsonProperty("genre")] [JsonProperty("genre")]
public string Genre { get; set; } public string Genre { get; set; }
[JsonProperty("year")]
public int Year { get; set; }
[JsonProperty("path")] [JsonProperty("path")]
public string Path { get; set; } public string Path { get; set; }
@ -29,6 +26,10 @@ namespace Herse.Models
public bool Disabled { get; set; } = false; public bool Disabled { get; set; } = false;
[JsonProperty("favorite")]
public bool Favorite { get; set; } = false;
[JsonIgnore] [JsonIgnore]
public FileType FileType public FileType FileType
{ {

View File

@ -1,34 +1,34 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections> </configSections>
<appSettings> <appSettings>
<add key="Firebase.Secret" value="9BQHUEJhScgK2FP10hvlToxTlGQpXT94Cvx01piO" /> <add key="Firebase.Secret" value="9BQHUEJhScgK2FP10hvlToxTlGQpXT94Cvx01piO"/>
<add key="Firebase.Path" value="https://herse.firebaseio.com/" /> <add key="Firebase.Path" value="https://herse.firebaseio.com/"/>
<add key="KaraokePlayer.ControllerId" value="" /> <add key="KaraokePlayer.ControllerId" value="mbrucedogs"/>
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup> </startup>
<entityFramework> <entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters> <parameters>
<parameter value="v11.0" /> <parameter value="v11.0"/>
</parameters> </parameters>
</defaultConnectionFactory> </defaultConnectionFactory>
<providers> <providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers> </providers>
</entityFramework> </entityFramework>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>KaraokePlayer</RootNamespace> <RootNamespace>KaraokePlayer</RootNamespace>
<AssemblyName>KaraokePlayer</AssemblyName> <AssemblyName>KaraokePlayer</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
@ -29,6 +29,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>

View File

@ -19,7 +19,7 @@ namespace KaraokePlayer.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // 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.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {

View File

@ -8,21 +8,17 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace KaraokePlayer.Properties namespace KaraokePlayer.Properties {
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default {
{ get {
get
{
return defaultInstance; return defaultInstance;
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -11,4 +11,4 @@
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

View File

@ -8,10 +8,10 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace SingsALot.Properties namespace SingsALot.Properties {
{ using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@ -19,51 +19,43 @@ namespace SingsALot.Properties
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // 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.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources {
{
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources() {
{
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager {
{ get {
get if (object.ReferenceEquals(resourceMan, null)) {
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SingsALot.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SingsALot.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture {
{ get {
get
{
return resourceCulture; return resourceCulture;
} }
set set {
{
resourceCulture = value; resourceCulture = value;
} }
} }

View File

@ -8,21 +8,17 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace SingsALot.Properties namespace SingsALot.Properties {
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default {
{ get {
get
{
return defaultInstance; return defaultInstance;
} }
} }

View File

@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>SingsALot</RootNamespace> <RootNamespace>SingsALot</RootNamespace>
<AssemblyName>SingsALot</AssemblyName> <AssemblyName>SingsALot</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
@ -30,6 +30,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="Firebase.Secret" value="9BQHUEJhScgK2FP10hvlToxTlGQpXT94Cvx01piO" /> <add key="Firebase.Secret" value="9BQHUEJhScgK2FP10hvlToxTlGQpXT94Cvx01piO"/>
<add key="Firebase.Path" value="https://herse.firebaseio.com/" /> <add key="Firebase.Path" value="https://herse.firebaseio.com/"/>
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>

View File

@ -31,7 +31,7 @@ namespace SongCrawler
private static void CrawlSongs(string[] args) private static void CrawlSongs(string[] args)
{ {
//string [] test = { "mbrucedogs", "z:\\" }; //string [] test = { "mbrucedogstest", "z:\\" };
//args = test; //args = test;
if (args.Length != 2) if (args.Length != 2)
{ {
@ -46,14 +46,39 @@ namespace SongCrawler
BasePath = ConfigurationManager.AppSettings["Firebase.Path"] BasePath = ConfigurationManager.AppSettings["Firebase.Path"]
}; };
FireSharp.FirebaseClient client = new FireSharp.FirebaseClient(config); 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"); Console.WriteLine("Loading current library");
List<Song> songs = client.Get(firepath).ResultAs<List<Song>>();
if (songs != null) List<Song> songs = null; // client.Get(songsPath).ResultAs<List<Song>>();
Console.WriteLine(string.Format("{0} songs loaded", songs.Count)); List<Song> disabled = null;
else List<Song> favorited = null;
try
{
disabled = client.Get(disabledPath).ResultAs<List<Song>>();
}
catch
{
disabled = convertToList(client.Get(disabledPath).Body);
}
try
{
favorited = client.Get(favoritesPath).ResultAs<List<Song>>();
}
catch
{
favorited = convertToList(client.Get(favoritesPath).Body);
}
//if (songs != null)
// Console.WriteLine(string.Format("{0} songs loaded", songs.Count));
//else
songs = new List<Song>(); songs = new List<Song>();
client.Set(songsPath, songs);
List<string> files = new List<string>(); List<string> files = new List<string>();
files.AddRange(FindFiles("mp4", songpath)); files.AddRange(FindFiles("mp4", songpath));
files.AddRange(FindFiles("mp3", songpath)); files.AddRange(FindFiles("mp3", songpath));
@ -68,26 +93,82 @@ namespace SongCrawler
{ {
song = MakeSong(filepath); song = MakeSong(filepath);
Console.WriteLine(string.Format("{0:000000}/{1} - {2} - {3}", i, files.Count, song.Artist, song.Title)); 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) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); 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<CreatedSong> created = new List<CreatedSong>(); List<CreatedSong> created = new List<CreatedSong>();
foreach (Song s in songs) foreach (Song s in songs)
{ {
created.Add(new CreatedSong(File.GetCreationTime(s.Path), s)); created.Add(new CreatedSong(File.GetCreationTime(s.Path), s));
} }
var first200 = created.Where(s => s.created != null).OrderByDescending(s => s.created).Take(200); 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); 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<Song> convertToList(dynamic json)
{
dynamic data = JsonConvert.DeserializeObject<dynamic>(json);
var list = new List<Song>();
foreach (var itemDynamic in data)
{
var fjson = itemDynamic.Value.ToString();
var f = JsonConvert.DeserializeObject<Song>(fjson);
list.Add(f);
}
return list;
}
private static void DeleteSongs(string[] args) private static void DeleteSongs(string[] args)
{ {
if (args.Length != 3) if (args.Length != 3)
@ -334,10 +415,6 @@ namespace SongCrawler
if (tagFile.Tag.FirstGenre != null) { if (tagFile.Tag.FirstGenre != null) {
song.Genre = tagFile.Tag.FirstGenre.Trim(); song.Genre = tagFile.Tag.FirstGenre.Trim();
} }
if (tagFile.Tag.Year > 0)
{
song.Year = (int)tagFile.Tag.Year;
}
} }
catch catch
{ {

View File

@ -9,11 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SongCrawler</RootNamespace> <RootNamespace>SongCrawler</RootNamespace>
<AssemblyName>SongCrawler</AssemblyName> <AssemblyName>SongCrawler</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>