12345678910111213141516171819202122232425262728293031323334 |
- import radiomanifest from 'radiomanifest'
- const cachedRadiomanifest = {}
- const RM = {
- radio: {
- 'ROR': { name: 'Radio Onda Rossa', description: 'un segnale che disturba', url: 'https://www.ondarossa.info' },
- 'Spore': { name: 'Radio Spore', description: 'una voce senza padrone', url: 'https://radiospore.oziosi.org' },
- 'Wombat': { name: 'Radio Wombat', url: 'https://radiowombat.net' },
- 'Gramma': { name: 'Radio Gramma', description: 'supporto parziale!', url: 'https://test.radiogramma.org' },
- 'Blackout': { name: 'Radio Blackout', description: 'in test!', url: 'https://radioblackout.org' },
- },
- currentRadio : null,
- async get (id) {
- // check if this radio id exists
- if (!RM.radio[id]) {
- throw new Error('This radio id does not exists!')
- }
- // check if is cached, load it otherwise
- if (!cachedRadiomanifest[id]) {
- const radio = RM.radio[id]
- cachedRadiomanifest[id] = await radiomanifest.get(radio.url)
- }
- this.currentRadio = cachedRadiomanifest[id]
- return cachedRadiomanifest[id]
- }
- }
- export default RM
|