public static void AddRemoveEpisodeInUserList(string username, string title, string year, string season, string episode, string tvdbid, bool remove)
{
if (!GUICommon.CheckLogin(false))
{
return;
}
GUIBackgroundTask.Instance.ExecuteInBackgroundAndCallback(() =>
{
return(TraktLists.GetListsForUser(username));
},
delegate(bool success, object result)
{
if (success)
{
IEnumerable <TraktUserList> customlists = result as IEnumerable <TraktUserList>;
// get slug of lists selected
List <string> slugs = TraktLists.GetUserListSelections(customlists.ToList());
if (slugs == null || slugs.Count == 0)
{
return;
}
TraktListItem item = new TraktListItem
{
Type = TraktItemType.episode.ToString(),
Title = title,
Year = Convert.ToInt32(year),
Season = Convert.ToInt32(season),
Episode = Convert.ToInt32(episode),
TvdbId = tvdbid
};
AddRemoveItemInList(slugs, item, remove);
}
}, Translation.GettingLists, true);
}