elfhosted / plex_debrid

Plex torrent streaming through Debrid Services
27 stars 7 forks source link

Can't run unless Trakt client_id and client_secret are available #18

Open moe93 opened 2 days ago

moe93 commented 2 days ago

I keep getting the following Traceback whenever I try to launch the plex_debrid main.py file:

File "/home/dietpi/gits/plex_debrid_elfhosted/content/services/trakt.py", line 18, in <module>
    trakt = Settings()
            ^^^^^^^^^^
  File "/home/dietpi/.local/lib/python3.11/site-packages/pydantic_settings/main.py", line 167, in __init__
    super().__init__(
  File "/home/dietpi/.local/lib/python3.11/site-packages/pydantic/main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for Settings
client_id
  Field required [type=missing, input_value={}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing
client_secret
  Field required [type=missing, input_value={}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing

I don't care for Trakt and was hoping to be able to run the script without having to setup Trakt.

esquioga commented 2 days ago

It's missing defaults values on the class, you can change Settings on trakt.py to this

class Settings(BaseSettings):
    client_id: str = ""
    client_secret: str = ""

    class Config:
        env_file = ".env"
        env_file_encoding = "utf-8"

The original code seems to have an actual value there, probably not needed if you're not using the service, but you can find it here

moe93 commented 2 days ago

@esquioga Thank you. I do have some bogus values in a .env file to get the script up and running.

Just thought it was an oversight that those values needed to be there even when Trakt isn't being used.