meeb / tubesync

Syncs YouTube channels and playlists to a locally hosted media server
GNU Affero General Public License v3.0
1.97k stars 126 forks source link

Error: '<=' not supported between instances of 'NoneType' and 'datetime.datetime' #519

Closed RichardHyde closed 4 months ago

RichardHyde commented 4 months ago

Since updating to the latest build I've been getting an error '<=' not supported between instances of 'NoneType' and 'datetime.datetime' which wasn't happening with the v0.13.6 release.

I've gotten the error from two sources, Linus Tech Tips and MKBHD, and seems to be happening when running the sync.tasks.index_source_task task.

The error message from the background_task table is

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/background_task/tasks.py", line 43, in bg_runner
    func(*args, **kwargs)
  File "/app/sync/tasks.py", line 193, in index_source_task
    media.save()
  File "/app/sync/models.py", line 918, in save
    super().save(
  File "/usr/local/lib/python3.11/dist-packages/django/db/models/base.py", line 739, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/usr/local/lib/python3.11/dist-packages/django/db/models/base.py", line 787, in save_base
    post_save.send(
  File "/usr/local/lib/python3.11/dist-packages/django/dispatch/dispatcher.py", line 180, in send
    return [
           ^
  File "/usr/local/lib/python3.11/dist-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/sync/signals.py", line 117, in media_post_save
    skip_changed = filter_media(instance)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/sync/filtering.py", line 22, in filter_media
    if filter_max_cap(instance):
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/sync/filtering.py", line 111, in filter_max_cap
    if instance.published <= max_cap_age:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'NoneType' and 'datetime.datetime'

Let me know if you need any additional info, or want me to try something

meeb commented 4 months ago

Thanks for the issue! Again looks like this was introduced in a recent feature update and the above commit should fix it. It'll be available in :latest once the image builds. Feel free to open more issues if you encounter any more bugs, reports like this are most helpful.