glensc / python-pytrakt

A Pythonic interface to the Trakt.tv REST API
https://glensc.github.io/python-pytrakt/
Other
22 stars 7 forks source link

Refactor: Use NamedTuple typing #28

Closed glensc closed 1 year ago

glensc commented 1 year ago

Replaces https://github.com/moogar0880/PyTrakt/pull/190

NOTE: there appears Translation being present in movie.py and tv.py. and they are not even identical.

NOTE: Can't have NamedTuple and __init__, so UserList stays as namedtuple()

UPDATE: Copied DataClassMixin trick from:

simonc56 commented 1 year ago

Tested successfully with plextraktsync 0.26.4 and liked_lists: true 👍

glensc commented 1 year ago

i recall i tested like this

diff --git a/trakt/users.py b/trakt/users.py
index 4a8b33e..14714c3 100644
--- a/trakt/users.py
+++ b/trakt/users.py
@@ -88,6 +88,7 @@ class UserList(DataClassMixin(UserListTuple), IdsMixin):

     def __init__(self, ids=None, **kwargs):
         super().__init__(**kwargs)
+        print(f"Created userlist: {self.data}")
         self._ids = ids
         self._items = list()