Aray Karjauv commited on
Commit
7fccd94
1 Parent(s): 407695b

fix css, add backgound

Browse files
Files changed (2) hide show
  1. backend.py +3 -0
  2. player.html +14 -11
backend.py CHANGED
@@ -191,7 +191,10 @@ def timeline_to_vtt(timeline):
191
 
192
  def calc_speaker_percentage(timeline, duration):
193
  percentages = []
 
194
  for start in sorted(timeline.keys()):
 
 
195
  end = timeline[start]['end']
196
  speaker = timeline[start]['speaker']
197
  percentages.append([speaker, 100*(end-start)/duration])
 
191
 
192
  def calc_speaker_percentage(timeline, duration):
193
  percentages = []
194
+ end = 0
195
  for start in sorted(timeline.keys()):
196
+ if(start > end):
197
+ percentages.append(['Background', 100*(start-end)/duration])
198
  end = timeline[start]['end']
199
  speaker = timeline[start]['speaker']
200
  percentages.append([speaker, 100*(end-start)/duration])
player.html CHANGED
@@ -8,54 +8,57 @@
8
  .speaker{
9
  height: 100%;
10
  }
 
 
 
11
  /* Pastel pink */
12
  .SPEAKER_00 {
13
- color: #FEC8D8;
14
  }
15
 
16
  /* Pastel peach */
17
  .SPEAKER_01 {
18
- color: #FEDBB7;
19
  }
20
 
21
  /* Pastel yellow */
22
  .SPEAKER_02 {
23
- color: #FEF5E3;
24
  }
25
 
26
  /* Pastel green */
27
  .SPEAKER_03 {
28
- color: #C5E5C5;
29
  }
30
 
31
  /* Pastel blue */
32
  .SPEAKER_04 {
33
- color: #C3D9FF;
34
  }
35
 
36
  /* Pastel lavender */
37
  .SPEAKER_05 {
38
- color: #E9C7E9;
39
  }
40
 
41
  /* Pastel coral */
42
  .SPEAKER_06 {
43
- color: #FFD6D1;
44
  }
45
 
46
  /* Pastel salmon */
47
  .SPEAKER_07{
48
- color: #FFC8B4;
49
  }
50
 
51
  /* Pastel mint */
52
  .SPEAKER_08 {
53
- color: #D1E8D1;
54
  }
55
 
56
  /* Pastel sky blue */
57
  .SPEAKER_09 {
58
- color: #B3D8FF;
59
  }
60
  </style>
61
  </head>
@@ -83,7 +86,7 @@
83
  let last_time = 0
84
  for(let p of percentages){
85
  console.log(p)
86
- divs += `<div class="speaker speaker_${p[0]}" style="width:${p[1]}%;" title="${p[0]}"></div>\n`
87
  }
88
  console.log(divs)
89
  timeline.innerHTML = divs
 
8
  .speaker{
9
  height: 100%;
10
  }
11
+ .Background{
12
+ background-color: lightgray;
13
+ }
14
  /* Pastel pink */
15
  .SPEAKER_00 {
16
+ background-color: #FEC8D8;
17
  }
18
 
19
  /* Pastel peach */
20
  .SPEAKER_01 {
21
+ background-color: #ff8282;
22
  }
23
 
24
  /* Pastel yellow */
25
  .SPEAKER_02 {
26
+ background-color: #acffb3;
27
  }
28
 
29
  /* Pastel green */
30
  .SPEAKER_03 {
31
+ background-color: #C5E5C5;
32
  }
33
 
34
  /* Pastel blue */
35
  .SPEAKER_04 {
36
+ background-color: #C3D9FF;
37
  }
38
 
39
  /* Pastel lavender */
40
  .SPEAKER_05 {
41
+ background-color: #E9C7E9;
42
  }
43
 
44
  /* Pastel coral */
45
  .SPEAKER_06 {
46
+ background-color: #FFD6D1;
47
  }
48
 
49
  /* Pastel salmon */
50
  .SPEAKER_07{
51
+ background-color: #fffab4;
52
  }
53
 
54
  /* Pastel mint */
55
  .SPEAKER_08 {
56
+ background-color: #D1E8D1;
57
  }
58
 
59
  /* Pastel sky blue */
60
  .SPEAKER_09 {
61
+ background-color: #9b5f2b;
62
  }
63
  </style>
64
  </head>
 
86
  let last_time = 0
87
  for(let p of percentages){
88
  console.log(p)
89
+ divs += `<div class="speaker ${p[0]}" style="width:${p[1]}%;" title="${p[0]}"></div>\n`
90
  }
91
  console.log(divs)
92
  timeline.innerHTML = divs