Elffuss BraidHub

kikocis/osiris public

09d1cb3093e4 · 1.9 KiBRawPermalink
1import type { CctvCamera } from './types';
2import { BULGARIA_FWCBG_CAMERAS } from './bulgaria-fwcbg.generated';
3
4const BULGARIA_MANUAL: CctvCamera[] = [
5 {
6 id: 'bg-sofia-tsarigradsko-uab',
7 lat: 42.662, lng: 23.376,
8 name: 'Tsarigradsko Shose (UAB)', city: 'Sofia', country: 'Bulgaria',
9 feed_url: 'https://cdn.uab.org/images/cctv/images/cctv/cctv_103/cctv.jpg',
10 source: 'UAB / KAMEPA',
11 },
12 {
13 id: 'bg-sofia-banishora',
14 lat: 42.704, lng: 23.327,
15 name: 'Banishora / Opalchenska', city: 'Sofia', country: 'Bulgaria',
16 feed_url: 'https://meteo.chavo.biz/Camera_streem/live_snap.jpg',
17 source: 'meteo.chavo.biz',
18 },
19
20 {
21 id: 'bg-gkpp-makaza-1',
22 lat: 41.297, lng: 24.133,
23 name: 'GKPP Makaza – Nymfea (cam 1)', city: 'Makaza', country: 'Bulgaria',
24 stream_url: 'https://www.youtube.com/embed/pnr0lhrqRAc?autoplay=1&mute=1',
25 stream_type: 'iframe',
26 external_url: 'https://weather-webcam.eu/ueb-kameri-ot-gkpp-makaza-nimfeya/',
27 source: 'YouTube / GKPP',
28 },
29 {
30 id: 'bg-burgas-center',
31 lat: 42.497, lng: 27.47,
32 name: 'Burgas Center (Smart Burgas HLS)', city: 'Burgas', country: 'Bulgaria',
33 stream_url: 'https://pics.smartburgas.eu/m3u8/burgas_town_Center.m3u8',
34 stream_type: 'hls',
35 external_url: 'https://www.weather-webcam.eu/cams/burgas-centar.html',
36 source: 'Smart Burgas',
37 },
38];
39
40function cameraKey(cam: CctvCamera): string {
41 return (cam.stream_url || cam.feed_url || cam.external_url || cam.id).split('?')[0];
42}
43
44export async function fetchBulgariaCameras(): Promise<CctvCamera[]> {
45 const seen = new Set<string>();
46 const merged: CctvCamera[] = [];
47
48 for (const cam of [...BULGARIA_MANUAL, ...BULGARIA_FWCBG_CAMERAS]) {
49 if (!cam.feed_url && !cam.stream_url && !cam.external_url) continue;
50 const key = cameraKey(cam);
51 if (seen.has(key)) continue;
52 seen.add(key);
53 merged.push(cam);
54 }
55
56 return merged;
57}