diff --git a/HiddenUpdater/HiddenUpdater.csproj b/HiddenUpdater/HiddenUpdater.csproj index c0dfece..895ac32 100644 --- a/HiddenUpdater/HiddenUpdater.csproj +++ b/HiddenUpdater/HiddenUpdater.csproj @@ -61,6 +61,7 @@ + diff --git a/HiddenUpdater/Program.cs b/HiddenUpdater/Program.cs index 5902a60..1b7fcc3 100644 --- a/HiddenUpdater/Program.cs +++ b/HiddenUpdater/Program.cs @@ -15,6 +15,12 @@ namespace HiddenUpdater public static async Task Main(string[] args) { + Console.Write("Download (1) or lyrics (2): "); + if (int.Parse(Console.ReadLine()) != 1) + { + StoreLyrics.Store(); + return; + } var auth = new CredentialsAuth("ce11c54b88cf41149e528de5ec73aa69", File.ReadAllText("secret.txt")); var token = await auth.GetToken(); var spotify = new SpotifyWebAPI diff --git a/HiddenUpdater/StoreLyrics.cs b/HiddenUpdater/StoreLyrics.cs new file mode 100644 index 0000000..4a1afc1 --- /dev/null +++ b/HiddenUpdater/StoreLyrics.cs @@ -0,0 +1,57 @@ +using System; +using System.IO; +using System.Linq; +using System.Net; +using Newtonsoft.Json.Linq; + +namespace HiddenUpdater +{ + public class StoreLyrics + { + public static void Store() + { + do + { + Console.Write("One artist: "); + string artist = Console.ReadLine(); + if (artist.Length == 0) break; + Console.Write("Title: "); + string title = Console.ReadLine(); + if (artist.Length == 0) break; + var songs = JArray.Parse(File.ReadAllText("songs.json")); + foreach (var song in songs) + { + if (((string) song["sname"]).Contains(title)) + { + Console.WriteLine("Title matches: " + song["artists"] + " - " + song["sname"]); + if (song["artists"].Any(a => ((string) a).Contains(artist))) + { + Console.WriteLine("Artist matches"); + /*Console.WriteLine("Lyrics (type \"END\" when done):"); + string lyrics = ""; + do + { + var line = Console.ReadLine(); + Console.WriteLine("Line: " + line); + if (line == "END") break; + lyrics += " " + line + "\n"; + } while (true);*/ + File.WriteAllText("lyrics.txt", ""); + Console.WriteLine("Put the lyrics in lyrics.txt and press Enter"); + Console.ReadLine(); + + string lyrics = ""; + foreach(string line in File.ReadLines("lyrics.txt")) { + Console.WriteLine("Line: " + line); + lyrics += " " + line + "\n"; + } + + File.AppendAllText("songextra.yml", "- sid: " + song["sid"] + "\n lyrics: |\n" + lyrics); + break; + } + } + } + } while (true); + } + } +} \ No newline at end of file