mirror of
https://github.com/chibicitiberiu/ytsm.git
synced 2024-02-24 05:43:31 +00:00
For subscriptions, the playlist indices are stored in the database as zero-based.
This commit is contained in:
parent
679ea7889b
commit
2bdafa291d
@ -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))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user