| 123456789101112131415161718 |
- #!/usr/bin/env bun
- // Publish the built playlist + guide to chillidonut.com's junk drawer on GCS.
- // Uses `cp` (NOT `rsync`) so it only adds/overwrites these two objects — anything
- // else already in the bucket's junk/ is left untouched (never synced or deleted).
- // `-Z` gzips on upload and sets Content-Encoding: gzip (served compressed on the
- // wire; ~32 MB guide -> ~3-4 MB). url-tvg stays …/guide.xml — do NOT pre-gzip.
- import { $ } from 'bun';
- import { existsSync } from 'node:fs';
- const HERE = import.meta.dir;
- const DEST = 'gs://chillidonut.com/junk/iptv/';
- const files = ['iptv.m3u', 'guide.xml'].map((f) => `${HERE}/${f}`);
- for (const f of files)
- if (!existsSync(f)) { console.error(`missing ${f} — run \`bun refresh.ts\` first`); process.exit(1); }
- await $`gsutil -m -h ${'Cache-Control:public,max-age=3600'} cp -Z ${files} ${DEST}`;
- console.log(`uploaded ${files.length} files -> ${DEST} (gzipped, Content-Encoding: gzip)`);
|