@ -15,12 +15,14 @@ namespace NzbDrone.Core.ImportLists.LastFm
public class LastFmUserSettings : IImportListSettings
public class LastFmUserSettings : IImportListSettings
{
{
private static readonly LastFmSettingsValidator Validator = new LastFmSettingsValidator ( ) ;
private static readonly LastFmSettingsValidator Validator = new ( ) ;
public LastFmUserSettings ( )
public LastFmUserSettings ( )
{
{
BaseUrl = "https://ws.audioscrobbler.com/2.0/ ?method=user.gettopartists ";
BaseUrl = "https://ws.audioscrobbler.com/2.0/ ";
ApiKey = "204c76646d6020eee36bbc51a2fcd810" ;
ApiKey = "204c76646d6020eee36bbc51a2fcd810" ;
Method = ( int ) LastFmUserMethodList . TopArtists ;
Period = ( int ) LastFmUserTimePeriod . Overall ;
Count = 25 ;
Count = 25 ;
}
}
@ -30,7 +32,13 @@ namespace NzbDrone.Core.ImportLists.LastFm
[FieldDefinition(0, Label = "Last.fm UserID", HelpText = "Last.fm UserId to pull artists from")]
[FieldDefinition(0, Label = "Last.fm UserID", HelpText = "Last.fm UserId to pull artists from")]
public string UserId { get ; set ; }
public string UserId { get ; set ; }
[FieldDefinition(1, Label = "Count", HelpText = "Number of results to pull from list (Max 1000)", Type = FieldType.Number)]
[FieldDefinition(1, Label = "List", Type = FieldType.Select, SelectOptions = typeof(LastFmUserMethodList))]
public int Method { get ; set ; }
[FieldDefinition(2, Label = "Period", Type = FieldType.Select, SelectOptions = typeof(LastFmUserTimePeriod), HelpText = "The time period over which to retrieve top artists for")]
public int Period { get ; set ; }
[FieldDefinition(3, Label = "Count", HelpText = "Number of results to pull from list (Max 1000)", Type = FieldType.Number)]
public int Count { get ; set ; }
public int Count { get ; set ; }
public NzbDroneValidationResult Validate ( )
public NzbDroneValidationResult Validate ( )
@ -38,4 +46,28 @@ namespace NzbDrone.Core.ImportLists.LastFm
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
}
}
}
}
public enum LastFmUserMethodList
{
[FieldOption(Label = "Top Artists")]
TopArtists = 0 ,
[FieldOption(Label = "Top Albums")]
TopAlbums = 1
}
public enum LastFmUserTimePeriod
{
[FieldOption(Label = "Overall")]
Overall = 0 ,
[FieldOption(Label = "Last Week")]
LastWeek = 1 ,
[FieldOption(Label = "Last Month")]
LastMonth = 2 ,
[FieldOption(Label = "Last 3 Months")]
LastThreeMonths = 3 ,
[FieldOption(Label = "Last 6 Months")]
LastSixMonths = 4 ,
[FieldOption(Label = "Last 12 Months")]
LastTwelveMonths = 5
}
}
}