z411 / trackma

Open multi-site list manager for Unix-like systems. (ex-wMAL)
https://z411.github.io/trackma
GNU General Public License v3.0
761 stars 82 forks source link

kitsu: Try multiple keys for image urls #666

Closed FichteFoll closed 1 year ago

FichteFoll commented 1 year ago

See title. Addresses the first part of #665 but does not do anything about the URLs only being cacheable for a limited amount of time. That will need separate logic.

Edit: I should mention this is untested.

Eiji7 commented 1 year ago

@FichteFoll I have tried this PR and got:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/Trackma-0.8.5-py3.10.egg/trackma/ui/qt/workers.py", line 185, in run
    ret = self.function(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/dist-packages/Trackma-0.8.5-py3.10.egg/trackma/ui/qt/workers.py", line 145, in _start
    self.engine = Engine(account, self._messagehandler)
  File "/usr/local/lib/python3.10/dist-packages/Trackma-0.8.5-py3.10.egg/trackma/engine.py", line 87, in __init__
    self._init_data_handler()
  File "/usr/local/lib/python3.10/dist-packages/Trackma-0.8.5-py3.10.egg/trackma/engine.py", line 120, in _init_data_handler
    self.data_handler = data.Data(
  File "/usr/local/lib/python3.10/dist-packages/Trackma-0.8.5-py3.10.egg/trackma/data.py", line 79, in __init__
    __import__(modulename)
  File "/usr/local/lib/python3.10/dist-packages/Trackma-0.8.5-py3.10.egg/trackma/lib/libkitsu.py", line 37, in <module>
    class PosterImageKey(Enum, str):
NameError: name 'Enum' is not defined

Just to be sure I have uninstalled Trackma using pip3 before trying the cloned branch. The sudo python3 setup.py install worked without any problem.

Only those warnings appeared, but I don't think that those caused any problem in this case:

/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(

Do I have some python package missing?

FichteFoll commented 1 year ago

Please try again, the first version was a bit sloppy. My local linter setup is broken atm.

Eiji7 commented 1 year ago

Trackma launches without any problem. I have tested the image of mentioned anime entry and I can confirm that it works as expected! Logs are clear. Waiting for merge, thanks!

Cwavs commented 1 year ago

Can confirm, this also fixed the issue on my end. Thanks for the fix!

FichteFoll commented 1 year ago

Thanks for confirmation. I'm merging this, then.