forked from 0x2620/pandora
import subtitles if no subtitles exist
This commit is contained in:
parent
f790b039da
commit
f12dfdc4a3
1 changed files with 3 additions and 2 deletions
|
@ -1536,13 +1536,14 @@ class Item(models.Model):
|
||||||
subtitles = utils.get_by_key(settings.CONFIG['layers'], 'isSubtitles', True)
|
subtitles = utils.get_by_key(settings.CONFIG['layers'], 'isSubtitles', True)
|
||||||
if not subtitles:
|
if not subtitles:
|
||||||
return
|
return
|
||||||
|
layer = subtitles['id']
|
||||||
|
existing = self.annotations.filter(layer=layer).exclude(value='')
|
||||||
# only import on 0xdb for now or if forced manually
|
# only import on 0xdb for now or if forced manually
|
||||||
# since this will remove all existing subtitles
|
# since this will remove all existing subtitles
|
||||||
if not settings.USE_IMDB and not force:
|
if not (settings.USE_IMDB or existing.count() == 0) or not force:
|
||||||
self.add_empty_clips()
|
self.add_empty_clips()
|
||||||
return False
|
return False
|
||||||
with transaction.commit_on_success():
|
with transaction.commit_on_success():
|
||||||
layer = subtitles['id']
|
|
||||||
Annotation.objects.filter(layer=layer, item=self).delete()
|
Annotation.objects.filter(layer=layer, item=self).delete()
|
||||||
AnnotationSequence.reset(self)
|
AnnotationSequence.reset(self)
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
Loading…
Reference in a new issue