1
0
Fork 0
mirror of https://github.com/Findus23/cr-search.git synced 2024-09-18 14:13:45 +02:00

simpler color data

This commit is contained in:
Lukas Winkler 2021-07-15 22:32:22 +02:00
parent a793ace78c
commit ba6fed81af
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 39 additions and 33 deletions

View file

@ -1,16 +1,14 @@
from data import colors_c2, colors_c1
from data import colors
from models import Person, Series
campaign2 = Series.select().where(Series.title == "Campaign 2").get()
campaign1 = Series.select().where(Series.title == "Campaign 1").get()
p: Person
for p in Person.select():
if p.name in colors_c1.keys() and p.series == campaign1:
print(p.name)
p.color = colors_c1[p.name]
p.save()
if p.name in colors_c2.keys() and p.series == campaign2:
print(p.name)
p.color = colors_c2[p.name]
p.save()
for p in Person.select().join(Series):
if p.series.slug in colors:
series_colors = colors[p.series.slug]
if p.name in series_colors.keys():
p.color=series_colors[p.name]
p.save()

42
data.py
View file

@ -1,27 +1,29 @@
from dataclasses import dataclass
from typing import Optional, List
colors_c1 = {
"Travis": "#7592a4",
"Marisha": "#bd6b1e",
"Taliesin": "#3c487d",
"Ashley": "#fdd9be",
"Sam": "#781485",
"Liam": "#3d7580",
"Laura": "#28607d",
"Orion": "#933326"
}
colors = {
"campaign1": {
"Travis": "#7592a4",
"Marisha": "#bd6b1e",
"Taliesin": "#3c487d",
"Ashley": "#fdd9be",
"Sam": "#781485",
"Liam": "#3d7580",
"Laura": "#28607d",
"Orion": "#933326"
},
"campaign2":{
"Laura": "#59c3f9",
"Marisha": "#00146e",
"Liam": "#fe8413",
"Taliesin": "#be1c0d",
"Ashley": "#868984",
"Sam": "#dae1dd",
"Travis": "#076708",
"Matt": "#005d73", # random color
"Khary": "#bcc9e3"
}
colors_c2 = {
"Laura": "#59c3f9",
"Marisha": "#00146e",
"Liam": "#fe8413",
"Taliesin": "#be1c0d",
"Ashley": "#868984",
"Sam": "#dae1dd",
"Travis": "#076708",
"Matt": "#005d73", # random color
"Khary": "#bcc9e3"
}
single_speaker = {

View file

@ -19,9 +19,12 @@ order by len desc;
-- delete
-- from phrase;
delete from line;
-- delete from line;
update episode set text_imported=False;
-- update episode
-- set text_imported= False;
update person set color=null;
EXPLAIN analyse
SELECT text, sum(count) as total_count
@ -82,4 +85,7 @@ ORDER BY rank DESC
LIMIT 20;
SELECT * FROM ts_stat('SELECT search_text from line') order by nentry desc limit 500;
SELECT *
FROM ts_stat('SELECT search_text from line')
order by nentry desc
limit 500;