From 2bdafa291d937501d7a49b6651744ebc72dc8352 Mon Sep 17 00:00:00 2001 From: Tiberiu Chibici Date: Mon, 19 Aug 2019 16:59:31 +0300 Subject: [PATCH] For subscriptions, the playlist indices are stored in the database as zero-based. --- app/YtManagerApp/management/jobs/synchronize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/YtManagerApp/management/jobs/synchronize.py b/app/YtManagerApp/management/jobs/synchronize.py index 9f126af..d87f904 100644 --- a/app/YtManagerApp/management/jobs/synchronize.py +++ b/app/YtManagerApp/management/jobs/synchronize.py @@ -106,7 +106,7 @@ class SynchronizeJob(Job): # fix playlist index if necessary 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'] - item.position = 1 + (highest or 0) + item.position = 1 + (highest or -1) self.__new_vids.append(Video.create(item, sub))