For subscriptions, the playlist indices are stored in the database as zero-based.

This commit is contained in:
Tiberiu Chibici 2019-08-19 16:59:31 +03:00
parent 679ea7889b
commit 2bdafa291d

View File

@ -106,7 +106,7 @@ class SynchronizeJob(Job):
# fix playlist index if necessary # fix playlist index if necessary
if sub.rewrite_playlist_indices or Video.objects.filter(subscription=sub, playlist_index=item.position).exists(): if sub.rewrite_playlist_indices or Video.objects.filter(subscription=sub, playlist_index=item.position).exists():
highest = Video.objects.filter(subscription=sub).aggregate(Max('playlist_index'))['playlist_index__max'] highest = Video.objects.filter(subscription=sub).aggregate(Max('playlist_index'))['playlist_index__max']
item.position = 1 + (highest or 0) item.position = 1 + (highest or -1)
self.__new_vids.append(Video.create(item, sub)) self.__new_vids.append(Video.create(item, sub))