20 lines
1.1 KiB
TypeScript
20 lines
1.1 KiB
TypeScript
import { loadCaptions, renderCaption } from './captions.ts';
|
|
import { dailySchedule } from './publisher.ts';
|
|
import { loadThreadsConfig } from './config.ts';
|
|
import type { WeatherSample } from '../../src/weather/weather.ts';
|
|
|
|
const config = loadCaptions();
|
|
const site = loadThreadsConfig(undefined, true);
|
|
const base = { cloudCover: 0, rain: 0, snowfall: 0, visibility: 20000 };
|
|
const samples: Record<string, WeatherSample | null> = {
|
|
clear: base, partlyCloudy: { ...base, cloudCover: config.thresholds.partlyCloudyPercent },
|
|
cloudy: { ...base, cloudCover: config.thresholds.cloudyPercent }, fog: { ...base, visibility: 0 },
|
|
rain: { ...base, rain: 1 }, snow: { ...base, snowfall: 1 }, unknown: null,
|
|
};
|
|
for (const [condition, weather] of Object.entries(samples)) {
|
|
const { text, replyText } = renderCaption(config, { weather, capturedAt: new Date().toISOString(),
|
|
sunrise: dailySchedule(new Date()).sunrise.toISOString(), url: new URL(site.siteUrl).origin, test: false });
|
|
console.log(`\n[${condition}]\n${text}`);
|
|
if (replyText) console.log(`\n[댓글]\n${replyText}`);
|
|
}
|