Signed-off-by: mbrucedogs <mbrucedogs@gmail.com>
This commit is contained in:
parent
2b6a4a5c75
commit
c1d2ecafc5
@ -33,10 +33,10 @@ namespace SongCrawler
|
||||
{
|
||||
DeleteSongs(args);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
CrawlSongs(args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void CrawlSongs(string[] args)
|
||||
@ -204,6 +204,46 @@ namespace SongCrawler
|
||||
client.Set(firepath, songs);
|
||||
|
||||
}
|
||||
|
||||
private static void fixNewSongs(FireSharp.FirebaseClient client, String controller)
|
||||
{
|
||||
string songsPath = string.Format("controllers/{0}/songs", controller);
|
||||
string newSongsPath = string.Format("controllers/{0}/newSongs", controller);
|
||||
|
||||
List<Song> songs = client.Get(songsPath).ResultAs<List<Song>>();
|
||||
List<Song> newSongs = client.Get(newSongsPath).ResultAs<List<Song>>();
|
||||
|
||||
List<Song> updated = new List<Song>();
|
||||
foreach (Song n in newSongs){
|
||||
var found = songs.First(s => s.Path == n.Path);
|
||||
if(found != null)
|
||||
{
|
||||
updated.Add(found);
|
||||
}
|
||||
}
|
||||
client.Set(newSongsPath, updated);
|
||||
}
|
||||
|
||||
private static void fixHistory(FireSharp.FirebaseClient client, String controller)
|
||||
{
|
||||
List<History> history = null;
|
||||
try
|
||||
{
|
||||
history = client.Get(string.Format("controllers/{0}/history", controller)).ResultAs<List<History>>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
dynamic data = JsonConvert.DeserializeObject<dynamic>(client.Get(string.Format("controllers/{0}/history", controller)).Body);
|
||||
history = new List<History>();
|
||||
foreach (var itemDynamic in data)
|
||||
{
|
||||
var fjson = itemDynamic.Value.ToString();
|
||||
var f = JsonConvert.DeserializeObject<History>(fjson);
|
||||
history.Add(f);
|
||||
}
|
||||
}
|
||||
client.Set(string.Format("controllers/{0}/history", controller), history);
|
||||
}
|
||||
public class CreatedSong
|
||||
{
|
||||
public DateTime created { get; set; }
|
||||
@ -379,7 +419,6 @@ namespace SongCrawler
|
||||
}
|
||||
CheckTitle(song);
|
||||
song.Path = filepath;
|
||||
song.Guid = GuidFromString(filepath).ToString();
|
||||
return song;
|
||||
}
|
||||
|
||||
@ -427,9 +466,6 @@ namespace SongCrawler
|
||||
tagFile = TagLib.File.Create(path);
|
||||
song.Title = tagFile.Tag.Title.Trim();
|
||||
song.Artist = tagFile.Tag.FirstPerformer.Trim();
|
||||
if (tagFile.Tag.FirstGenre != null) {
|
||||
song.Genre = tagFile.Tag.FirstGenre.Trim();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user