jl94x4 / ColleXions

ColleXions automates the process of pinning collections to your Plex home screen, making it easier to showcase your favorite content. With customizable features, it enhances your Plex experience by dynamically adjusting what is displayed, randomly.
MIT License
31 stars 1 forks source link

Parsing dates in special collections is incorrect #4

Closed d3mystified closed 1 month ago

d3mystified commented 1 month ago

Example:

        {
            "start_date": "2-5",
            "end_date": "2-15",
            "collection_names": [
                "Valentine's Day"
            ]
        },

OR

        {
            "start_date": "02-05",
            "end_date": "02-15",
            "collection_names": [
                "Valentine's Day"
            ]
        },

both result in:

Traceback (most recent call last):
  File "/app/ColleXions.py", line 183, in <module>
    main()
  File "/app/ColleXions.py", line 169, in main
    special_collections = get_special_collections(config)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/ColleXions.py", line 108, in get_special_collections
    start_date = datetime.strptime(special['start_date'], '%Y-%m-%d').date()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/_strptime.py", line 567, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2-5' does not match format '%Y-%m-%d'

%Y-%m-%d seems like the wrong thing to use because the dates will span all years.

defluophoenix commented 1 month ago

Are you using the latest version v1.11? The latest version definitely only requires the month and day, the older versions also required year

d3mystified commented 1 month ago

I'm not sure I'm using the docker image.

jl94x4 commented 1 month ago

This has been fixed in the updated docker.