@@ -103,48 +103,27 @@ export function aiFilterClips(
103
103
]
104
104
: rounds ;
105
105
106
- // console.log('selectedRounds', selectedRounds);
107
-
108
106
// Sort rounds by score (descending)
109
107
const sortedRounds = selectedRounds . sort (
110
108
( a , b ) => getRoundScore ( b , clips ) - getRoundScore ( a , clips ) ,
111
109
) ;
112
110
113
- // console.log('sortedRounds by rooundScore', sortedRounds);
114
-
115
111
let clipsFromRounds : TClip [ ] = [ ] ;
116
112
117
113
let totalDuration = 0 ;
118
114
for ( let i = 0 ; i < sortedRounds . length ; ++ i ) {
119
115
if ( totalDuration > targetDuration ) {
120
- // console.log(`Duration: ${totalDuration} more than target: ${targetDuration}`);
121
116
break ;
122
117
} else {
123
- // console.log(`Duration: ${totalDuration} less than target: ${targetDuration}`);
124
118
//Todo M: how do sort? Per round or all together and then the rounds are in the stream order again?
125
119
const roundIndex = sortedRounds [ i ] ;
126
- // console.log('include round ', roundIndex);
127
120
128
121
const roundClips = sortClipsByOrder ( getClipsOfRound ( roundIndex , clips ) , streamId ) ;
129
- // console.log(
130
- // 'roundClips before adding:',
131
- // roundClips.map(c => ({
132
- // duration: c.duration,
133
- // })),
134
- // );
135
122
136
123
clipsFromRounds = [ ...clipsFromRounds , ...roundClips ] ;
137
124
138
- // console.log(
139
- // 'clipsFromRounds after adding:',
140
- // clipsFromRounds.map(c => ({
141
- // duration: c.duration,
142
- // })),
143
- // );
144
125
totalDuration = getCombinedClipsDuration ( clipsFromRounds ) ;
145
- // console.log('new totalDuration:', totalDuration);
146
126
}
147
- // console.log('clipsFromRounds', clipsFromRounds);
148
127
}
149
128
const contextTypes = [
150
129
EHighlighterInputTypes . DEPLOY ,
@@ -156,25 +135,12 @@ export function aiFilterClips(
156
135
clips => ! ( clips as IAiClip ) . aiInfo . inputs . some ( input => contextTypes . includes ( input . type ) ) ,
157
136
)
158
137
. sort ( ( a , b ) => ( a as IAiClip ) . aiInfo . score - ( b as IAiClip ) . aiInfo . score ) ;
159
- // console.log(
160
- // 'clipsSortedByScore',
161
- // clipsSortedByScore.map(clip => {
162
- // return {
163
- // score: (clip as IAiClip).aiInfo.score,
164
- // inputs: JSON.stringify((clip as IAiClip).aiInfo.inputs),
165
- // };
166
- // }),
167
- // );
168
- // console.log('clipsFromRounds', clipsFromRounds);
169
138
170
139
const filteredClips : TClip [ ] = clipsFromRounds ;
171
140
let currentDuration = getCombinedClipsDuration ( filteredClips ) ;
172
141
173
- // console.log('remove clipswise to get closer to target');
174
-
175
142
const BUFFER_SEC = 0 ;
176
143
while ( currentDuration > targetDuration + BUFFER_SEC ) {
177
- // console.log('ruuun currentDuration', currentDuration);
178
144
if ( clipsSortedByScore === undefined || clipsSortedByScore . length === 0 ) {
179
145
break ;
180
146
}
@@ -187,12 +153,6 @@ export function aiFilterClips(
187
153
if ( index > - 1 ) {
188
154
filteredClips . splice ( index , 1 ) ; // 2nd parameter means remove one item only
189
155
currentDuration = getCombinedClipsDuration ( filteredClips ) ;
190
- // console.log(
191
- // 'removed, new currentDuration:',
192
- // currentDuration,
193
- // 'target:',
194
- // targetDuration + BUFFER_SEC,
195
- // );
196
156
}
197
157
}
198
158
0 commit comments