Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions scripts/generate-featured-recaps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { execSync } from 'child_process';
import { existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from 'fs';
import { join, basename } from 'path';

const players = [
{ name: 'ドラ右 (Doramigi)', id: 1815290, imageUrl: '/images/recaps/ドラ右.webp' },
{ name: 'Miya', id: 1002311, imageUrl: '/images/recaps/Miya.webp' },
{ name: 'あcola (acola)', id: 1787719, imageUrl: '/images/recaps/あcola.webp' },
{ name: 'Hurt', id: 836465, imageUrl: '/images/recaps/Hurt.webp' },
{ name: 'Sparg0', id: 94369, imageUrl: '/images/recaps/Sparg0.webp' },
{ name: 'Sonix', id: 165614, imageUrl: '/images/recaps/Sonix.webp' },
{ name: 'Syrup', id: 767151, imageUrl: '/images/recaps/Syrup.webp' },
{ name: 'Zomba', id: 252388, imageUrl: '/images/recaps/Zomba.webp' },
{ name: 'カルメロ (Carmelo)', id: 2262042, imageUrl: '/images/recaps/カルメロ.webp' },
{ name: 'らる (Raru)', id: 1787715, imageUrl: '/images/recaps/らる.webp' },
{ name: 'Shuton', id: 134839, imageUrl: '/images/recaps/Shuton.webp' },
{ name: 'Tweek', id: 10213, imageUrl: '/images/recaps/Tweek.webp' },
{ name: 'Glutonny', id: 2613, imageUrl: '/images/recaps/Glutonny.webp' },
{ name: 'MkLeo', id: 41259, imageUrl: '/images/recaps/MkLeo.webp' },
{
name: 'たまPだいふく (TamaPDaifuku)',
id: 1816581,
imageUrl: '/images/recaps/たまPだいふく.webp'
},
{ name: 'Light', id: 95011, imageUrl: '/images/recaps/Light.webp' },
{ name: 'Peabnut', id: 37364, imageUrl: '/images/recaps/Peabnut.webp' },
{ name: 'Asimo', id: 964831, imageUrl: '/images/recaps/Asimo.webp' },
{ name: 'Wrath', id: 52384, imageUrl: '/images/recaps/Wrath.webp' },
{ name: 'Tea', id: 399160, imageUrl: '/images/recaps/Tea.webp' }
];

const API_BASE = 'http://localhost:5173/api';
const OUTPUT_DIR = join(process.cwd(), 'static', 'images', 'recaps');

async function main() {
console.log('Cleaning output directory...');
if (existsSync(OUTPUT_DIR)) {
for (const file of readdirSync(OUTPUT_DIR)) {
rmSync(join(OUTPUT_DIR, file));
}
} else {
mkdirSync(OUTPUT_DIR, { recursive: true });
}

console.log(`Starting generation for ${players.length} players...`);

const tempPropsPath = join(process.cwd(), 'temp-props.json');

for (const player of players) {
const filename = basename(player.imageUrl);
const outputPath = join(OUTPUT_DIR, filename);
const statsUrl = `${API_BASE}/user/${player.id}/stats/pretty`;

console.log(`\nProcessing ${player.name} (${player.id})...`);

try {
console.log(`\tFetching stats from ${statsUrl}...`);
const response = await fetch(statsUrl);

if (!response.ok) {
throw new Error(`Failed to fetch stats: ${response.status} ${response.statusText}`);
}

const props = await response.json();

console.log(`\tRendering to ${filename}...`);
writeFileSync(tempPropsPath, JSON.stringify(props));

const bunCmd = process.platform === 'win32' ? 'bun.cmd' : 'bun';
const cmd = `${bunCmd} run remotion still VerticalStill "${outputPath}" --props="${tempPropsPath}" --log=error`;
execSync(cmd, { stdio: 'inherit' });
console.log('\tDone!');
} catch (error) {
console.error(`\tError processing ${player.name}:`, error);
}
}

if (existsSync(tempPropsPath)) {
rmSync(tempPropsPath);
}

console.log('\nAll done!');
}

main().catch(console.error);
258 changes: 17 additions & 241 deletions src/remotion/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,256 +320,32 @@ export const RemotionRoot: React.FC = () => {
fps={FPS}
defaultProps={{
thisIsMyRecapProps: {
year: 2025,
user: {
gamerTag: 'Miya',
image:
'https://images.start.gg/images/user/1002311/image-1cfa44fda16c7d373c2942481aaea1bd.jpg',
country: 'Japan',
prefix: 'FENNEL',
socialMedias: { x: 'manmamiya13' }
}
year: YEAR,
user: ME
},
tournamentsProps: {
year: 2025,
attendance: [
{ month: 'Jan', attendance: 6 },
{ month: 'Feb', attendance: 4 },
{ month: 'Mar', attendance: 6 },
{ month: 'Apr', attendance: 3 },
{ month: 'May', attendance: 4 },
{ month: 'Jun', attendance: 2 },
{ month: 'Jul', attendance: 1 },
{ month: 'Aug', attendance: 4 },
{ month: 'Sep', attendance: 3 },
{ month: 'Oct', attendance: 2 },
{ month: 'Nov', attendance: 2 },
{ month: 'Dec', attendance: 2 }
]
year: YEAR,
attendance: ATTENDANCE
},
performancesProps: {
performances: [
{
finalPlacement: 1,
initialSeed: 6,
tournament: {
image:
'https://images.start.gg/images/tournament/859066/image-43bf8c3e41734e140ca74f737cb290a8.png',
name: 'Weekly Smash Party ~スマパ~ #212',
date: 'Dec 10',
location: '中野区',
attendees: 67
}
},
{
finalPlacement: 1,
initialSeed: 5,
tournament: {
image:
'https://images.start.gg/images/tournament/818138/image-6a76a77f0c823891314780af67cc07bc.png',
name: 'Weekly Smash Party ~スマパ~ #200',
date: 'Aug 20',
location: '中野区',
attendees: 74
}
},
{
finalPlacement: 1,
initialSeed: 3,
tournament: {
image:
'https://images.start.gg/images/tournament/744261/image-15889b625c0ffff5782ab0121f1d3baa.png?ehk=eiZqMk05g3xoE9caLksE%2Bs0hPuuvwLB59tFDT1DADIg%3D&ehkOptimized=owOSUNfFqiXK%2FHtrsiuh9e8ld6NNDSqbSIesV5Kcciw%3D',
name: 'Riptide 2025',
date: 'Sep 05',
location: 'Sandusky',
attendees: 2069
}
},
{
finalPlacement: 1,
initialSeed: 3,
tournament: {
image:
'https://images.start.gg/images/tournament/777707/image-e88c178c13f6cbf9d3b7dac31f08d3b5.png',
name: 'Supernova 2025',
date: 'Aug 07',
location: 'Chantilly',
attendees: 4590
}
},
{
finalPlacement: 1,
initialSeed: 3,
tournament: {
image:
'https://images.start.gg/images/tournament/726021/image-c931b2a168829adc629e3606ec2d3402.png?ehk=75YXN5HE3y3Uu1p4sHj7k5gJg9xxoNihutOIIDu90bI%3D&ehkOptimized=cjg547%2Frbtz8zx9UrIxWLq4Kp9wl3oHbUz%2FVBbLNka0%3D',
name: 'Battle of BC 7',
date: 'Mar 28',
location: 'Vancouver',
attendees: 1756
}
}
]
performances: PERFORMANCES
},
favouriteCharactersProps: {
characters: [
{
name: 'Mr. Game & Watch',
count: 412,
image: '/images/chara_1/mr_game_and_watch.webp'
},
{ name: 'Steve', count: 74, image: '/images/chara_1/steve.webp' },
{ name: 'Wolf', count: 30, image: '/images/chara_1/wolf.webp' }
]
},
highestUpsetProps: {
tournament: {
name: 'Weekly Smash Party ~スマパ~ #200',
date: 'Aug 20',
image:
'https://images.start.gg/images/tournament/818138/image-6a76a77f0c823891314780af67cc07bc.png'
},
opponent: {
gamerTag: 'KEN',
prefix: 'SBI',
avatar:
'https://images.start.gg/images/user/285335/image-e1a02071945fd348b4394738062c870a.JPG?ehk=T0rBWYQc9hoht0TmQFLEliIS%2Be%2BOkECZaa0wb2iNfF8%3D&ehkOptimized=geSClQnm454a4zK%2F7h9sNCirGu%2Beb1UaNBAJpB6Wjss%3D'
},
match: { score: '2 - 0', factor: 4, round: 'Winners Semi-Final' }
characters: FAVOURITE_CHARACTERS
},
game5WarriorProps: { totalSets: 333, wins: 73, winRate: 71.23287671232876 },
highestUpsetProps: HIGHEST_UPSET,
rivalryProps: RIVALRY_STATS,
gauntletProps: GAUNTLET_STATS,
game5WarriorProps: GAME_5_STATS,
cleanSweepProps: CLEAN_SWEEP_STATS,
dqProps: DQ_STATS,
worstMatchupsProps: {
matchups: [
{
characterName: 'Steve',
count: 55,
winCount: 33,
lossCount: 22,
looseRate: 40,
image: '/images/chara_1/steve.webp'
},
{
characterName: 'Olimar',
count: 33,
winCount: 21,
lossCount: 12,
looseRate: 36.36363636363637,
image: '/images/chara_1/olimar.webp'
},
{
characterName: 'Sonic',
count: 42,
winCount: 31,
lossCount: 11,
looseRate: 26.190476190476193,
image: '/images/chara_1/sonic.webp'
}
]
},
gauntletProps: {
encountered: [
'Dr. Mario',
'Steve',
'Olimar',
'Min Min',
'R.O.B.',
'Sonic',
'Sora',
'Joker',
'Kazuya',
'Pac-Man',
'Samus',
'Captain Falcon',
'Zelda',
'Snake',
'Rosalina',
'Duck Hunt',
'Yoshi',
'Wario',
'Hero',
'Luigi',
'Ice Climbers',
'Pichu',
'Daisy',
'Chrom',
'Roy',
'Pyra & Mythra',
'Falco',
'Corrin',
'Mega Man',
'Palutena',
'Fox',
'Cloud',
'Pikachu',
'Mario',
'Peach',
'Wii Fit Trainer',
'Marth',
'Ike',
'Bayonetta',
'Mii Brawler',
'Donkey Kong',
'Diddy Kong',
'Incineroar',
'Villager',
'Greninja',
'Piranha Plant',
'Shulk',
'Zero Suit Samus',
'Wolf',
'Young Link',
'Sephiroth',
'Jigglypuff',
'Mr. Game & Watch',
'Isabelle',
'Banjo-Kazooie',
'Lucario'
]
},
cleanSweepProps: { totalSets: 333, totalSweeps: 193 },
dqProps: { totalDQs: 2 },
dayOfWeekActivityProps: {
activity: [
{ day: 'Mon', count: 5 },
{ day: 'Tue', count: 1 },
{ day: 'Wed', count: 1 },
{ day: 'Thu', count: 7 },
{ day: 'Fri', count: 3 },
{ day: 'Sat', count: 11 },
{ day: 'Sun', count: 11 }
]
},
busterRunProps: {
finalPlacement: 33,
initialSeed: 1,
spr: -10,
tournament: {
image:
'https://images.start.gg/images/tournament/763140/image-0215d294f4b532a9023c2a1273d246eb.png?ehk=8xaz2MgSf6ULriCk%2F7t7AAqPkUy7RVNBrQR1wqRY4Cw%3D&ehkOptimized=PUQT05Fk4x%2B7elotCACZd%2F6WQRQQpVi0n%2FUsHMCK%2FpA%3D',
name: 'Weekly Smash Party ~スマパ~ #177',
date: 'Mar 05',
location: '中野区',
attendees: 69
}
},
rivalryProps: {
rival: {
gamerTag: 'KEN',
wins: 9,
losses: 3,
image:
'https://images.start.gg/images/user/285335/image-e1a02071945fd348b4394738062c870a.JPG?ehk=T0rBWYQc9hoht0TmQFLEliIS%2Be%2BOkECZaa0wb2iNfF8%3D&ehkOptimized=geSClQnm454a4zK%2F7h9sNCirGu%2Beb1UaNBAJpB6Wjss%3D'
},
nemesis: {
gamerTag: 'あcola',
wins: 1,
losses: 4,
image:
'https://images.start.gg/images/user/1787719/image-35fd5b39c6aaedb64a3aefce818370c2.jpg?ehk=X%2FEHj7gWLTCd9d8AatiRAHg7ohd2%2FtruyLEalBfmdhs%3D&ehkOptimized=pdf7tlJy0ZqW6An9C6TUbZJ8jkLSM9Ajfd77fVgJ6a0%3D'
}
matchups: WORST_MATCHUPS
},
gameStats: { won: 765, lost: 220, winRate: 77.66497461928934 },
setsPlayed: 333
dayOfWeekActivityProps: DAY_OF_WEEK_STATS,
busterRunProps: BUSTER_RUN_STATS,
gameStats: GAME_STATS,
setsPlayed: TOTAL_SETS_MOCK
}}
/>
</>
Expand Down
Loading
Loading