fixed bug
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
5389194830
commit
d40ab93df2
@ -31,7 +31,7 @@ namespace SongCrawler
|
||||
|
||||
private static void CrawlSongs(string[] args)
|
||||
{
|
||||
//string [] test = { "mbrucedogstest", "z:\\" };
|
||||
//string [] test = { "mbrucedogs", "z://" };
|
||||
//args = test;
|
||||
if (args.Length != 2)
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace SongCrawler
|
||||
string disabledPath = string.Format("controllers/{0}/disabled", controller);
|
||||
Console.WriteLine("Loading current library");
|
||||
|
||||
List<Song> songs = null; // client.Get(songsPath).ResultAs<List<Song>>();
|
||||
List<Song> songs = null; //client.Get(songsPath).ResultAs<List<Song>>();
|
||||
List<Song> disabled = null;
|
||||
List<Song> favorited = null;
|
||||
try
|
||||
@ -72,10 +72,7 @@ namespace SongCrawler
|
||||
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);
|
||||
|
||||
@ -134,16 +131,11 @@ namespace SongCrawler
|
||||
|
||||
client.Set(songsPath, songs);
|
||||
|
||||
List<CreatedSong> created = new List<CreatedSong>();
|
||||
foreach (Song s in songs)
|
||||
{
|
||||
created.Add(new CreatedSong(File.GetCreationTime(s.Path), s));
|
||||
}
|
||||
|
||||
var created = songs.Select(s => new CreatedSong(File.GetCreationTime(s.Path), s)).ToList();
|
||||
var first200 = created.Where(s => s.created != null).OrderByDescending(s => s.created).Take(200);
|
||||
var added = first200.Select(s => new PathOnly(path: s.song.Path)).ToList();
|
||||
string newSongs = string.Format("controllers/{0}/newSongs", controller);
|
||||
client.Set(newSongs, first200);
|
||||
client.Set(newSongs, added);
|
||||
|
||||
}
|
||||
private class PathOnly
|
||||
|
||||
Loading…
Reference in New Issue
Block a user