remove no longer existing tags
This commit is contained in:
parent
04a38b77b7
commit
4c4c61bf4c
1 changed files with 8 additions and 2 deletions
|
@ -127,7 +127,8 @@ class Engine:
|
||||||
return [{
|
return [{
|
||||||
'clips': video['clips'],
|
'clips': video['clips'],
|
||||||
'position': random.randrange(len(video['clips'])),
|
'position': random.randrange(len(video['clips'])),
|
||||||
'name': video['name']
|
'name': video['name'],
|
||||||
|
'tags': video['tags'],
|
||||||
} for video in videos]
|
} for video in videos]
|
||||||
|
|
||||||
def update_state(self, data):
|
def update_state(self, data):
|
||||||
|
@ -210,15 +211,20 @@ class Engine:
|
||||||
if 'globalKeywords' not in self.state:
|
if 'globalKeywords' not in self.state:
|
||||||
self.state['globalKeywords'] = {}
|
self.state['globalKeywords'] = {}
|
||||||
changed = True
|
changed = True
|
||||||
|
existing_tags = set()
|
||||||
for playlist in self.playlists:
|
for playlist in self.playlists:
|
||||||
for tag in playlist.get('tags', []):
|
for tag in playlist.get('tags', []):
|
||||||
|
if not tag.isupper() and tag:
|
||||||
|
existing_tags.add(tag)
|
||||||
if not tag.isupper() and tag not in self.state['globalKeywords']:
|
if not tag.isupper() and tag not in self.state['globalKeywords']:
|
||||||
self.state['globalKeywords'][tag] = {'value': 0}
|
self.state['globalKeywords'][tag] = {'value': 0}
|
||||||
changed = True
|
changed = True
|
||||||
|
for tag in set(self.state['globalKeywords']) - existing_tags:
|
||||||
|
del self.state['globalKeywords'][tag]
|
||||||
|
changed = True
|
||||||
if changed:
|
if changed:
|
||||||
self.save_state()
|
self.save_state()
|
||||||
|
|
||||||
|
|
||||||
@run_async
|
@run_async
|
||||||
def update_async(self):
|
def update_async(self):
|
||||||
self.update()
|
self.update()
|
||||||
|
|
Loading…
Reference in a new issue