dont default to random and don't fail if it is missing
This commit is contained in:
parent
3c80c721d3
commit
d3f1a95c5f
1 changed files with 4 additions and 2 deletions
|
@ -62,8 +62,10 @@ class Engine:
|
||||||
self.state['userKeywordsWeights'] = {
|
self.state['userKeywordsWeights'] = {
|
||||||
'themeTags': {'locked': False, 'value': 0.3},
|
'themeTags': {'locked': False, 'value': 0.3},
|
||||||
'characterTags': {'locked': False, 'value': 0.7},
|
'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()
|
self.update_keywords()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -263,7 +265,7 @@ class Engine:
|
||||||
playlists.remove(playlist)
|
playlists.remove(playlist)
|
||||||
|
|
||||||
# Generate random weights if random option is chosen in the dashboard:
|
# Generate random weights if random option is chosen in the dashboard:
|
||||||
if userKeywordsWeights['random']:
|
if userKeywordsWeights.get('random'):
|
||||||
themeWeights = random.random()
|
themeWeights = random.random()
|
||||||
charWeights = 1-themeWeights
|
charWeights = 1-themeWeights
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue