Skip to content

Monkey patch trakt UserList with a type field#1100

Closed
glensc wants to merge 3 commits into
Taxel:mainfrom
glensc:monkey-patch-trakt
Closed

Monkey patch trakt UserList with a type field#1100
glensc wants to merge 3 commits into
Taxel:mainfrom
glensc:monkey-patch-trakt

Conversation

@glensc

@glensc glensc commented Oct 11, 2022

Copy link
Copy Markdown
Collaborator

Monkey patching moogar0880/PyTrakt#206

Fixes #941

@marksie1988

Copy link
Copy Markdown

I am just running a test now, but so far it seems to be working.

@glensc glensc marked this pull request as ready for review October 11, 2022 16:07
@marksie1988

Copy link
Copy Markdown

Ok i did the command plextraktsync sync which throws errors:

INFO     PlexTraktSync [0.20.10]
Sync Movie sections: [<PlexLibrarySection:movie:Films>]
Sync Show sections: [<PlexLibrarySection:show:TV programmes>]
INFO     Downloaded List Fast and Furious Chronology
INFO     Downloaded List The Matrix Franchise
INFO     Downloaded List The Bourne Identity Series
Traceback (most recent call last):
  File "/root/.local/bin/plextraktsync", line 8, in <module>
    sys.exit(cli())
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/cli.py", line 28, in wrap
    cmd(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/commands/sync.py", line 60, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/sync.py", line 64, in sync
    listutil.addList(lst["username"], lst["listname"])
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 88, in addList
    self.lists.append(TraktList(username, listname))
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 47, in __init__
    for elem in LazyUserList._get(listname, username)._items
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/trakt/core.py", line 554, in inner
    return generator.send(json_data)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 35, in _get
    ulist = LazyUserList(creator=creator, **data)
TypeError: <lambda>() missing 1 required positional argument: 'type'

@glensc

glensc commented Oct 12, 2022

Copy link
Copy Markdown
Collaborator Author

@marksie1988: wtf? you're not even using code from this branch, why should it work?!

@marksie1988

marksie1988 commented Oct 12, 2022

Copy link
Copy Markdown

@marksie1988: wtf? you're not even using code from this branch, why should it work?!

Aren't I? I specified to install this PR with:

plextraktsync self-update --pr 1100

It looked to update as expected. I'll double check

Edit:

Yea I'm an idiot 😂 didn't realise that it created a new executable.

When I run plextraktsync@1100 sync I get a different error

INFO     PlexTraktSync [0.22.0dev0]
INFO     Sync Movie sections: [<PlexLibrarySection:movie:Films>]
INFO     Sync Show sections: [<PlexLibrarySection:show:TV programmes>]
Error: Error running sync command: maximum recursion depth exceeded while calling
a Python object

So seems that this does fix the initial error but I'm not sure if this new one is related

@glensc

glensc commented Oct 14, 2022

Copy link
Copy Markdown
Collaborator Author
  1. your version said "INFO PlexTraktSync [0.20.10]"
  2. line numbers don't match with the code.

so I'd say you failed initially :)

@glensc

glensc commented Oct 14, 2022

Copy link
Copy Markdown
Collaborator Author

Added debug: 54e5924, it should give a trace to see where the recursion came from.

@glensc

glensc commented Oct 14, 2022

Copy link
Copy Markdown
Collaborator Author

@marksie1988 I'm not familiar with the problem, what should I enable in my config.yml so I get the same error?

@marksie1988

marksie1988 commented Oct 14, 2022

Copy link
Copy Markdown

Copy of my config file below

cache:
  path: $PTS_CACHE_DIR/trakt_cache
excluded-libraries:
- Private
- Family Holidays
logging:
  append: true
  debug: false
  filename: plextraktsync.log
sync:
  plex_to_trakt:
    collection: true
    ratings: true
    watched_status: true
  trakt_to_plex:
    liked_lists: true
    ratings: true
    watched_status: true
    watchlist: true
watch:
  add_collection: false
  remove_collection: false
  scrobble_threshold: 80
  username_filter: true
xbmc-providers:
  movies: imdb
  shows: tvdb

I ran again plextraktsync self-update --pr 1100 however the output from command plextraktsync@1100 sync was still the same:

INFO     PlexTraktSync [0.22.0dev0]  
INFO     Sync Movie sections: [<PlexLibrarySection:movie:Films>]
INFO     Sync Show sections: [<PlexLibrarySection:show:TV programmes>]
Error: Error running sync command: maximum recursion depth exceeded while calling a Python object

not sure if i need to do something else to ensure the new update is added.

@glensc

glensc commented Oct 15, 2022

Copy link
Copy Markdown
Collaborator Author

the version will stay 0.22.0dev0 regardless of the commit. try uninstalling old version first with pipx. also didn't ask for full config, but what config key actually matters.

@marksie1988

Copy link
Copy Markdown

using pipx to remove worked, I now get the full trace:

INFO     PlexTraktSync [0.22.0dev0]
INFO     Sync Movie sections: [<PlexLibrarySection:movie:Films>]
INFO     Sync Show sections: [<PlexLibrarySection:show:TV programmes>]
Traceback (most recent call last):
  File "/root/.local/bin/plextraktsync@1100", line 8, in <module>
    sys.exit(cli())
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1130, in __call__                                                                        
    return self.main(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/cli.py", line 26, in wrap                                                                       
    cmd(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/commands/sync.py", line 58, in sync                                                             
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/sync.py", line 83, in sync                                                                      
    listutil.addList(lst["username"], lst["listname"])
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 88, in addList                                                        
    self.lists.append(TraktList(username, listname))
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 47, in __init__                                                       
    for elem in LazyUserList._get(listname, username)._items
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/core.py", line 554, in inner
    return generator.send(json_data)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 35, in _get                                                           
    ulist = LazyUserList(creator=creator, **data)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/users.py", line 72, in __init__
    super(UserList, self).__init__()
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/users.py", line 72, in __init__
    super(UserList, self).__init__()
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/users.py", line 72, in __init__
    super(UserList, self).__init__()
  [Previous line repeated 980 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object

@racincason

racincason commented Oct 15, 2022

Copy link
Copy Markdown

I created a copy of my working directory and updated the 2 python files.
I am also getting an error. Please see trace below.

**I understand it says 0.22.1 branch but as i said, i updated the files manually.

Traceback (most recent call last):
  File "Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "PlexTraktSync-0.22.1 - Copy\plextraktsync\__main__.py", line 18, in <module>
    cli()
  File "Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "Python310\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "Python310\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "PlexTraktSync-0.22.1 - Copy\plextraktsync\cli.py", line 26, in wrap
    cmd(*args, **kwargs)
  File "PlexTraktSync-0.22.1 - Copy\plextraktsync\commands\sync.py", line 58, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "PlexTraktSync-0.22.1 - Copy\plextraktsync\sync.py", line 83, in sync
    listutil.addList(lst["username"], lst["listname"])
  File "PlexTraktSync-0.22.1 - Copy\plextraktsync\trakt_list_util.py", line 88, in addList
    self.lists.append(TraktList(username, listname))
  File "PlexTraktSync-0.22.1 - Copy\plextraktsync\trakt_list_util.py", line 47, in __init__
    for elem in LazyUserList._get(listname, username)._items
  File "Python310\lib\site-packages\trakt\core.py", line 554, in inner
    return generator.send(json_data)
  File "CPlexTraktSync-0.22.1 - Copy\plextraktsync\trakt_list_util.py", line 35, in _get
    ulist = LazyUserList(creator=creator, **data)
  File "Python310\lib\site-packages\trakt\users.py", line 72, in __init__
    super(UserList, self).__init__()
  File "Python310\lib\site-packages\trakt\users.py", line 72, in __init__
    super(UserList, self).__init__()
  File "Python310\lib\site-packages\trakt\users.py", line 72, in __init__
    super(UserList, self).__init__()
  [Previous line repeated 977 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object

@glensc glensc force-pushed the monkey-patch-trakt branch from 54e5924 to 9374c75 Compare October 16, 2022 22:53
@glensc

glensc commented Oct 16, 2022

Copy link
Copy Markdown
Collaborator Author

1a9c2ed might help

@marksie1988

Copy link
Copy Markdown

Still happening im afraid:

~# plextraktsync@1100 sync
INFO     PlexTraktSync [0.22.0@pr/1100#1b3625cc]                                                                                                                                            INFO     Sync Movie sections: [<PlexLibrarySection:movie:Films>]                                                                                                                            INFO     Sync Show sections: [<PlexLibrarySection:show:TV programmes>]                                                                                                                      Traceback (most recent call last):
  File "/root/.local/bin/plextraktsync@1100", line 8, in <module>
    sys.exit(cli())
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/cli.py", line 26, in wrap
    cmd(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/commands/sync.py", line 58, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/sync.py", line 83, in sync
    listutil.addList(lst["username"], lst["listname"])
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 88, in addList
    self.lists.append(TraktList(username, listname))
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 47, in __init__
    for elem in LazyUserList._get(listname, username)._items
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/core.py", line 554, in inner
    return generator.send(json_data)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/plextraktsync/trakt_list_util.py", line 35, in _get
    ulist = LazyUserList(creator=creator, **data)
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/users.py", line 72, in __init__
    super(UserList, self).__init__()
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/users.py", line 72, in __init__
    super(UserList, self).__init__()
  File "/root/.local/pipx/venvs/plextraktsync@1100/lib/python3.9/site-packages/trakt/users.py", line 72, in __init__
    super(UserList, self).__init__()
  [Previous line repeated 980 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object

@glensc

glensc commented Oct 19, 2022

Copy link
Copy Markdown
Collaborator Author

The trace indicates that liked_lists must be enabled in config.yml:

i.e trying to figure out how to reproduce this:

@glensc

glensc commented Oct 19, 2022

Copy link
Copy Markdown
Collaborator Author

That is still not enough to reproduce:

[2022-10-19 16:22:10] INFO Completed full sync in 1 min 13.8 seconds

if any of you want me to work on this, provide the exact steps to reproduce!

@glensc glensc force-pushed the monkey-patch-trakt branch from 1b3625c to 7f78168 Compare October 19, 2022 13:29
@marksie1988

Copy link
Copy Markdown

All I have done is as follows:

Run command:

plextraktsync self-update --pr 1100
plextraktsync@1100 sync

After this the failure occurs, i'm using the config that I posted previously.

not sure you need it, but Plex server is Version 1.29.1.6313
Server is running Debian 11

im not too familiar with pipx so unsure if its configuration could impact the venv configurations.

@racincason

This comment was marked as off-topic.

@racincason

This comment was marked as off-topic.

@glensc

glensc commented Oct 23, 2022

Copy link
Copy Markdown
Collaborator Author

Replaced with #1124

@glensc glensc closed this Oct 23, 2022
@glensc glensc deleted the monkey-patch-trakt branch October 23, 2022 14:19
@glensc

glensc commented Oct 23, 2022

Copy link
Copy Markdown
Collaborator Author

@racincason stop abusing the pull requests, create new issue of your problems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't sync liked playlists : unexpected keyword argument 'type'

3 participants