From ac5736c05b6bb47561184a61163ad7228f080981 Mon Sep 17 00:00:00 2001 From: Daniel Martin Gonzalez Date: Fri, 9 Apr 2021 13:06:21 +0200 Subject: [PATCH] New: Add option to import from any Trakt user's personal list --- .../ImportLists/Trakt/User/TraktUserRequestGenerator.cs | 8 +++++--- .../ImportLists/Trakt/User/TraktUserSettings.cs | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserRequestGenerator.cs b/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserRequestGenerator.cs index 41ac99a1a..af1a94ee7 100644 --- a/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserRequestGenerator.cs +++ b/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserRequestGenerator.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Notifications.Trakt; @@ -26,17 +27,18 @@ public virtual ImportListPageableRequestChain GetMovies() private IEnumerable GetMoviesRequest() { var link = string.Empty; + var userName = Settings.Username.IsNotNullOrWhiteSpace() ? Settings.Username.Trim() : Settings.AuthUser.Trim(); switch (Settings.TraktListType) { case (int)TraktUserListType.UserWatchList: - link += $"users/{Settings.AuthUser.Trim()}/watchlist/movies?limit={Settings.Limit}"; + link += $"users/{userName}/watchlist/movies?limit={Settings.Limit}"; break; case (int)TraktUserListType.UserWatchedList: - link += $"users/{Settings.AuthUser.Trim()}/watched/movies?limit={Settings.Limit}"; + link += $"users/{userName}/watched/movies?limit={Settings.Limit}"; break; case (int)TraktUserListType.UserCollectionList: - link += $"users/{Settings.AuthUser.Trim()}/collection/movies?limit={Settings.Limit}"; + link += $"users/{userName}/collection/movies?limit={Settings.Limit}"; break; } diff --git a/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserSettings.cs b/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserSettings.cs index 9580c8abe..9784c858b 100644 --- a/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserSettings.cs +++ b/src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserSettings.cs @@ -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; } } }