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 [{
|
||||
'clips': video['clips'],
|
||||
'position': random.randrange(len(video['clips'])),
|
||||
'name': video['name']
|
||||
'name': video['name'],
|
||||
'tags': video['tags'],
|
||||
} for video in videos]
|
||||
|
||||
def update_state(self, data):
|
||||
|
@ -210,15 +211,20 @@ class Engine:
|
|||
if 'globalKeywords' not in self.state:
|
||||
self.state['globalKeywords'] = {}
|
||||
changed = True
|
||||
existing_tags = set()
|
||||
for playlist in self.playlists:
|
||||
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']:
|
||||
self.state['globalKeywords'][tag] = {'value': 0}
|
||||
changed = True
|
||||
for tag in set(self.state['globalKeywords']) - existing_tags:
|
||||
del self.state['globalKeywords'][tag]
|
||||
changed = True
|
||||
if changed:
|
||||
self.save_state()
|
||||
|
||||
|
||||
@run_async
|
||||
def update_async(self):
|
||||
self.update()
|
||||
|
|
Loading…
Reference in a new issue