improved UI

This commit is contained in:
didier amyot authored and didier amyot committed 2024-11-04 18:50:34 -05:00
1 parent 520fab5c93
commit e9da24b54d
13 files changed
+491 -32

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
export type MatchInfo = {
id: string,
originalVideoUrl: string,
matchDate: string,
label: string
}
export interface MatchService {
getAllMatchInfo(): AsyncIterator<MatchInfo>;
getMatchInfoById(id: string): Promise<MatchInfo|undefined>;
}
export class FileMatchService implements MatchService{
readonly #indexFile: string
constructor(indexFile: string) {
this.#indexFile = indexFile;
}
async *getAllMatchInfo(): AsyncIterator<MatchInfo>{
const data = await Deno.readTextFile(this.#indexFile)
const ret = JSON.parse(data) as {matches: MatchInfo[]}
yield* ret.matches
}
async getMatchInfoById(id: string): Promise<MatchInfo|undefined>{
for await(const mi of this.getAllMatchInfo()){
if(mi.id === id){
return mi
}
}
}
}