updated UI for a delete songs only, so you can reload without losing any history or song lists

Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
Matt Bruce 2018-04-28 10:51:00 -05:00
parent baebab614d
commit 946bdd9125
3 changed files with 39 additions and 4 deletions

View File

@ -10,6 +10,7 @@
<Button x:Name="launchPlayerButton" Content="Launch Player" HorizontalAlignment="Left" Margin="9,97,0,0" VerticalAlignment="Top" Width="145" Height="44" IsEnabled="False" Click="launchPlayerButton_Click"/>
<Button x:Name="syncLibraryButton" Content="Sync Library" HorizontalAlignment="Left" Margin="160,97,0,0" VerticalAlignment="Top" Width="145" Height="44" IsEnabled="False" Click="syncLibraryButton_Click"/>
<Button x:Name="updateBillboardButton" Content="Update Billboard" HorizontalAlignment="Left" Margin="310,97,0,0" VerticalAlignment="Top" Width="145" Height="44" IsEnabled="False" Click="updateBillboardButton_Click"/>
<Button x:Name="deleteSongs" Content="Delete Songs" HorizontalAlignment="Left" Margin="310,10,0,0" VerticalAlignment="Top" Width="145" Height="22" IsEnabled="True" Click="deleteSongsButton_Click"/>
<TextBox x:Name="controllerName" HorizontalAlignment="Left" Height="23" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="295" TextChanged="controllerName_TextChanged"/>
<TextBox x:Name="songsLocation" HorizontalAlignment="Left" Height="23" Margin="10,38,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="295" TextChanged="songsLocation_TextChanged"/>
<Button x:Name="songsLocationButton" Content="Songs Folder" HorizontalAlignment="Left" Margin="310,38,0,0" VerticalAlignment="Top" Width="145" Height="23" Click="songsLocationButton_Click"/>

View File

@ -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);
}
}
}

View File

@ -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<CreatedSong> created = new List<CreatedSong>();
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<Song> songs = new List<Song>();
client.Set(firepath, songs);
}
public class CreatedSong
{