- Introduced a new HTML documentation page for the oradio API, including a JavaScript file to handle dynamic content and API requests. - Added a CSS file for styling the documentation page. - Implemented an underground station importer script that fetches data from Radio-Browser and writes it to a JSON file. - Created a stats module to compute and manage vote and play statistics for radio stations. - Added a polyfill for modulepreload to ensure compatibility with older browsers.
13 lines
505 B
JavaScript
13 lines
505 B
JavaScript
import 'dotenv/config';
|
|
import Database from 'better-sqlite3';
|
|
const db = new Database(process.env.DB_PATH || './data/db/oradio.sqlite');
|
|
const rows = db.prepare(`
|
|
SELECT s.name, st.format, st.url, st.last_status
|
|
FROM streams st JOIN stations s ON s.id = st.station_id
|
|
ORDER BY (st.last_status = 'up'), s.name
|
|
`).all();
|
|
for (const r of rows) {
|
|
const tag = r.last_status === 'up' ? 'OK ' : 'BAD';
|
|
console.log(tag, (r.last_status || '').padEnd(14), r.format.padEnd(5), r.name, '->', r.url);
|
|
}
|