Add editable weather captions and manage Threads scheduling with PM2

This commit is contained in:
2026-11-02 04:07:40 +09:00
parent 8c2113a323
commit 6ce32d33fe
17 changed files with 305 additions and 50 deletions
+18
View File
@@ -0,0 +1,18 @@
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 } = 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}`);
}