Spaces:
Running
Running
Point viewer at opencs2_dataset layout
Browse files- src/lib/api/hf.ts +3 -10
- src/lib/types.ts +1 -1
src/lib/api/hf.ts
CHANGED
|
@@ -8,12 +8,10 @@ let matchesPromise: Promise<Match[]> | null = null;
|
|
| 8 |
let roundsPromise: Promise<Round[]> | null = null;
|
| 9 |
const matchPreviewsCache = new Map<string, Promise<PreviewChunk[]>>();
|
| 10 |
|
| 11 |
-
// Compacted web-tier index. Single deduped parquet per scope, written by the
|
| 12 |
-
// ingestion pipeline after each upload batch.
|
| 13 |
const WEB_MAPS = 'index/web/maps.parquet';
|
| 14 |
const WEB_ROUNDS = 'index/web/rounds.parquet';
|
| 15 |
const matchPreviewsPath = (matchId: number, mapName: string) =>
|
| 16 |
-
`
|
| 17 |
|
| 18 |
export function listMatches(opts: FetchOptions = {}): Promise<Match[]> {
|
| 19 |
if (matchesPromise) return matchesPromise;
|
|
@@ -53,11 +51,6 @@ export async function listRounds(
|
|
| 53 |
.sort((a, b) => a.round - b.round);
|
| 54 |
}
|
| 55 |
|
| 56 |
-
/**
|
| 57 |
-
* Single deduped per-(match, map) parquet with every player's preview rows.
|
| 58 |
-
* Each row's `preview_path` is relative to its own `player=N` dir, so the
|
| 59 |
-
* absolute URL is rebuilt using `r.player`.
|
| 60 |
-
*/
|
| 61 |
async function loadMatchPreviews(
|
| 62 |
matchId: number,
|
| 63 |
mapName: string,
|
|
@@ -67,7 +60,7 @@ async function loadMatchPreviews(
|
|
| 67 |
const cached = matchPreviewsCache.get(key);
|
| 68 |
if (cached) return cached;
|
| 69 |
|
| 70 |
-
const baseDir = `
|
| 71 |
const promise = fetchParquetRows<PreviewChunk>(
|
| 72 |
resolveUrl(matchPreviewsPath(matchId, mapName)),
|
| 73 |
opts
|
|
@@ -75,7 +68,7 @@ async function loadMatchPreviews(
|
|
| 75 |
.then((rows) => {
|
| 76 |
for (const r of rows) {
|
| 77 |
r.preview_video = {
|
| 78 |
-
src: resolveUrl(`${baseDir}/
|
| 79 |
};
|
| 80 |
}
|
| 81 |
return rows;
|
|
|
|
| 8 |
let roundsPromise: Promise<Round[]> | null = null;
|
| 9 |
const matchPreviewsCache = new Map<string, Promise<PreviewChunk[]>>();
|
| 10 |
|
|
|
|
|
|
|
| 11 |
const WEB_MAPS = 'index/web/maps.parquet';
|
| 12 |
const WEB_ROUNDS = 'index/web/rounds.parquet';
|
| 13 |
const matchPreviewsPath = (matchId: number, mapName: string) =>
|
| 14 |
+
`rounds/match_id=${matchId}/map_name=${mapName}/chunks-preview.parquet`;
|
| 15 |
|
| 16 |
export function listMatches(opts: FetchOptions = {}): Promise<Match[]> {
|
| 17 |
if (matchesPromise) return matchesPromise;
|
|
|
|
| 51 |
.sort((a, b) => a.round - b.round);
|
| 52 |
}
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
async function loadMatchPreviews(
|
| 55 |
matchId: number,
|
| 56 |
mapName: string,
|
|
|
|
| 60 |
const cached = matchPreviewsCache.get(key);
|
| 61 |
if (cached) return cached;
|
| 62 |
|
| 63 |
+
const baseDir = `rounds/match_id=${matchId}/map_name=${mapName}`;
|
| 64 |
const promise = fetchParquetRows<PreviewChunk>(
|
| 65 |
resolveUrl(matchPreviewsPath(matchId, mapName)),
|
| 66 |
opts
|
|
|
|
| 68 |
.then((rows) => {
|
| 69 |
for (const r of rows) {
|
| 70 |
r.preview_video = {
|
| 71 |
+
src: resolveUrl(`${baseDir}/${r.preview_path}`)
|
| 72 |
};
|
| 73 |
}
|
| 74 |
return rows;
|
src/lib/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
export const DATASET = 'blanchon/
|
| 2 |
|
| 3 |
export type Winner = 'team1' | 'team2';
|
| 4 |
export type WinnerSide = 'ct' | 't' | null;
|
|
|
|
| 1 |
+
export const DATASET = 'blanchon/opencs2_dataset';
|
| 2 |
|
| 3 |
export type Winner = 'team1' | 'team2';
|
| 4 |
export type WinnerSide = 'ct' | 't' | null;
|