1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

New: Add option to import from any user's personal list

This commit is contained in:
Daniel Martin Gonzalez 2021-04-06 00:45:23 +02:00 committed by GitHub
parent 1e99856ffc
commit d6e5d9c424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -26,17 +26,18 @@ public virtual ImportListPageableRequestChain GetListItems()
private IEnumerable<ImportListRequest> GetSeriesRequest()
{
var link = Settings.BaseUrl.Trim();
var userName = Settings.Username.IsNotNullOrWhiteSpace() ? Settings.Username.Trim() : Settings.AuthUser.Trim();
switch (Settings.TraktListType)
{
case (int)TraktUserListType.UserWatchList:
link += $"/users/{Settings.AuthUser.Trim()}/watchlist/shows?limit={Settings.Limit}";
link += $"/users/{userName}/watchlist/shows?limit={Settings.Limit}";
break;
case (int)TraktUserListType.UserWatchedList:
link += $"/users/{Settings.AuthUser.Trim()}/watched/shows?limit={Settings.Limit}";
link += $"/users/{userName}/watched/shows?limit={Settings.Limit}";
break;
case (int)TraktUserListType.UserCollectionList:
link += $"/users/{Settings.AuthUser.Trim()}/collection/shows?limit={Settings.Limit}";
link += $"/users/{userName}/collection/shows?limit={Settings.Limit}";
break;
}

View File

@ -24,5 +24,8 @@ public TraktUserSettings()
[FieldDefinition(1, Label = "List Type", Type = FieldType.Select, SelectOptions = typeof(TraktUserListType), HelpText = "Type of list you're seeking to import from")]
public int TraktListType { get; set; }
[FieldDefinition(2, Label = "Username", HelpText = "Username for the List to import from (empty to use Auth User)")]
public string Username { get; set; }
}
}