dont default to random and don't fail if it is missing

This commit is contained in:
j 2018-12-03 21:52:57 +01:00
parent 3c80c721d3
commit d3f1a95c5f

View file

@ -62,8 +62,10 @@ class Engine:
self.state['userKeywordsWeights'] = {
'themeTags': {'locked': False, 'value': 0.3},
'characterTags': {'locked': False, 'value': 0.7},
'random' : {'locked': False, 'value': True}
'random': {'locked': False, 'value': False}
}
if 'random' not in self.state['userKeywordsWeights']:
self.state['userKeywordsWeights']['random'] = {'locked': False, 'value': False}
self.update_keywords()
@property
@ -263,7 +265,7 @@ class Engine:
playlists.remove(playlist)
# Generate random weights if random option is chosen in the dashboard:
if userKeywordsWeights['random']:
if userKeywordsWeights.get('random'):
themeWeights = random.random()
charWeights = 1-themeWeights
else: