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)
|
private static void CrawlSongs(string[] args)
|
||||||
{
|
{
|
||||||
//string [] test = { "mbrucedogstest", "z:\\" };
|
//string [] test = { "mbrucedogs", "z://" };
|
||||||
//args = test;
|
//args = test;
|
||||||
if (args.Length != 2)
|
if (args.Length != 2)
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ namespace SongCrawler
|
|||||||
string disabledPath = string.Format("controllers/{0}/disabled", controller);
|
string disabledPath = string.Format("controllers/{0}/disabled", controller);
|
||||||
Console.WriteLine("Loading current library");
|
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> disabled = null;
|
||||||
List<Song> favorited = null;
|
List<Song> favorited = null;
|
||||||
try
|
try
|
||||||
@ -72,9 +72,6 @@ namespace SongCrawler
|
|||||||
favorited = convertToList(client.Get(favoritesPath).Body);
|
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);
|
client.Set(songsPath, songs);
|
||||||
@ -134,16 +131,11 @@ namespace SongCrawler
|
|||||||
|
|
||||||
client.Set(songsPath, songs);
|
client.Set(songsPath, songs);
|
||||||
|
|
||||||
List<CreatedSong> created = new List<CreatedSong>();
|
var created = songs.Select(s => new CreatedSong(File.GetCreationTime(s.Path), s)).ToList();
|
||||||
foreach (Song s in songs)
|
|
||||||
{
|
|
||||||
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 => new PathOnly(path: s.song.Path)).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, first200);
|
client.Set(newSongs, added);
|
||||||
|
|
||||||
}
|
}
|
||||||
private class PathOnly
|
private class PathOnly
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user