2013-03-04 20:03:36 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers.Music
|
|
|
|
|
{
|
|
|
|
|
public static class LastfmHelper
|
|
|
|
|
{
|
|
|
|
|
public static string LocalArtistMetaFileName = "MBArtist.json";
|
|
|
|
|
|
|
|
|
|
public static void ProcessArtistData(BaseItem artist, LastfmArtist data)
|
|
|
|
|
{
|
|
|
|
|
artist.Overview = data.bio != null ? data.bio.content : null;
|
2013-03-05 15:45:25 +00:00
|
|
|
|
var yearFormed = 0;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
yearFormed = Convert.ToInt32(data.bio.yearformed);
|
|
|
|
|
}
|
|
|
|
|
catch (FormatException)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
catch (NullReferenceException)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
catch (OverflowException)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
artist.PremiereDate = new DateTime(yearFormed, 1,1);
|
2013-03-04 20:03:36 +00:00
|
|
|
|
if (data.tags != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var tag in data.tags.tag)
|
|
|
|
|
{
|
|
|
|
|
artist.AddGenre(tag.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|