Add editable weather captions and manage Threads scheduling with PM2
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
Reference in New Issue
Block a user