radiomanifest.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import radiomanifest from "radiomanifest";
  2. const cachedRadiomanifest = {};
  3. const RM = {
  4. radio: {
  5. ROR: {
  6. name: "Radio Onda Rossa",
  7. description: "un segnale che disturba",
  8. url: "https://www.ondarossa.info",
  9. },
  10. Spore: {
  11. name: "Radio Spore",
  12. description: "una voce senza padrone",
  13. url: "https://radiospore.oziosi.org",
  14. },
  15. Wombat: { name: "Radio Wombat", url: "https://radiowombat.net" },
  16. Gramma: {
  17. name: "Radio Gramma",
  18. description: "supporto parziale!",
  19. url: "https://test.radiogramma.org",
  20. },
  21. // 'RBO': { }
  22. },
  23. currentRadio: null,
  24. async get(id) {
  25. // check if this radio id exists
  26. if (!RM.radio[id]) {
  27. throw new Error("This radio id does not exists!");
  28. }
  29. // check if is cached, load it otherwise
  30. if (!cachedRadiomanifest[id]) {
  31. const radio = RM.radio[id];
  32. cachedRadiomanifest[id] = await radiomanifest.get(radio.url);
  33. }
  34. this.currentRadio = cachedRadiomanifest[id];
  35. return cachedRadiomanifest[id];
  36. },
  37. };
  38. export default RM;