diff --git a/SingsALot/MainWindow.xaml b/SingsALot/MainWindow.xaml
index 55c5842..23a0d43 100644
--- a/SingsALot/MainWindow.xaml
+++ b/SingsALot/MainWindow.xaml
@@ -10,6 +10,7 @@
+
diff --git a/SingsALot/MainWindow.xaml.cs b/SingsALot/MainWindow.xaml.cs
index 9211465..f0afb9e 100644
--- a/SingsALot/MainWindow.xaml.cs
+++ b/SingsALot/MainWindow.xaml.cs
@@ -132,5 +132,13 @@ namespace SingsALot
startInfo.Arguments = this.settings.controllerName;
Process.Start(startInfo);
}
+
+ private void deleteSongsButton_Click(object sender, RoutedEventArgs e)
+ {
+ ProcessStartInfo startInfo = new ProcessStartInfo();
+ startInfo.FileName = "SongCrawler.exe";
+ startInfo.Arguments = string.Format("{0} {1} {2}", this.settings.controllerName, this.settings.songsLocationPath, "delete");
+ Process.Start(startInfo);
+ }
}
}
diff --git a/SongCrawler/Program.cs b/SongCrawler/Program.cs
index 33e19b0..09381a7 100644
--- a/SongCrawler/Program.cs
+++ b/SongCrawler/Program.cs
@@ -19,8 +19,13 @@ namespace SongCrawler
{
static void Main(string[] args)
{
- //FindDuplicates(args);
- CrawlSongs(args);
+ if (args.Count() == 3)
+ {
+ DeleteSongs(args);
+ }
+ else {
+ CrawlSongs(args);
+ }
}
@@ -73,13 +78,34 @@ namespace SongCrawler
List created = new List();
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 added = first200.Select(s=>s.song).ToList();
+ var added = first200.Select(s => s.song).ToList();
string newSongs = string.Format("controllers/{0}/newSongs", controller);
client.Set(newSongs, added);
+ }
+ private static void DeleteSongs(string[] args)
+ {
+ if (args.Length != 3)
+ {
+ Console.WriteLine("usage: songcrawler partyid songspath delete");
+ return;
+ }
+ string controller = args[0];
+ string songpath = args[1];
+ IFirebaseConfig config = new FirebaseConfig
+ {
+ AuthSecret = ConfigurationManager.AppSettings["Firebase.Secret"],
+ BasePath = ConfigurationManager.AppSettings["Firebase.Path"]
+ };
+ FireSharp.FirebaseClient client = new FireSharp.FirebaseClient(config);
+ string firepath = string.Format("controllers/{0}/songs", controller);
+ Console.WriteLine("Deleting Songs ...");
+ List songs = new List();
+ client.Set(firepath, songs);
+
}
public class CreatedSong
{