Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checkbox that disables language filter and enables indexers oriented language setting #178

Merged

Conversation

victorgveloso
Copy link
Contributor

This PR builds upon the original proposal in #166 to introduce a checkbox (getAllLanguages) that disables filtering by languages. It resolves issues identified in #176 by leveraging the language of Jackett's Indexers to request best TMDB metadata.

This approach ensures the feature is more flexible and powerful, while maintaining backward compatibility and user awareness of how language settings are applied.

Closes #166.
Addresses #176.

@victorgveloso victorgveloso force-pushed the feat/indexer-oriented-language branch from 6aa73ed to de7d28d Compare December 1, 2024 05:48
@victorgveloso victorgveloso force-pushed the feat/indexer-oriented-language branch from 83f2a7c to c049416 Compare December 1, 2024 08:51
@victorgveloso
Copy link
Contributor Author

I just tested the add-on with my changes and after some tweaks I managed to watch portuguese dubbed content with premiumize on stremio! Playing with it revealed some glitches so I took the liberty of fixing those glitches and submitting individual PRs (i.e., #179 and #180) for those unrelated to this feature request. Fixes to glitches in my own code were push forced into my commits to avoid messing with the commit history.

@davidemarcoli
Copy link
Collaborator

@victorgveloso The default behavior is the same as before, correct? If it is, then I'll merge it. LGTM!

@victorgveloso
Copy link
Contributor Author

victorgveloso commented Dec 29, 2024

If the user leave the checkbox unchecked, it will disable the feature entirely and work as default. Notice, however, due to an additional parameter (getAllLanguages), users should update their configuration url to reflect the change.

EDIT: I just tested and if that field is missing from the config URL, it will behave as default too. So it's mostly safe to merge it.

That is due to the expression self.config['getAllLanguages'] at https://github.com/aymene69/stremio-jackett/pull/178/files#diff-0ab2fa3b7070aeb1a5682f3482603c998bc97022c706df44f9a5e0cd3021bed6R27

@davidemarcoli
Copy link
Collaborator

@victorgveloso I get the following error when trying to run the code

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/davidemarcoli/.cache/pypoetry/virtualenvs/riven-66TogHQI-py3.12/lib/python3.12/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/davidemarcoli/projects/private/stremio-jackett/source/main.py", line 165, in get_results
    jackett_service = jackett_service if jackett_service else JackettService(config)
                                         ^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'jackett_service' where it is not associated with a value

The variable jackett_service needs to be initialized to None

@victorgveloso
Copy link
Contributor Author

Fixed.

For some reason, the docker container doesn't show me the same error but I agree it's better to initialize it as none to avoid future bugs.

@victorgveloso
Copy link
Contributor Author

@davidemarcoli Could you please review and merge it?

@aymene69 aymene69 merged commit adbe21e into aymene69:main Jan 3, 2025
1 check passed
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.

4 participants