radiomanifest.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import radiomanifest from "@radiomanifest/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. name: "Radio Blackout",
  23. url: "https://radioblackout.org",
  24. },
  25. },
  26. currentRadio: null,
  27. async get(id) {
  28. // check if this radio id exists
  29. if (!RM.radio[id]) {
  30. throw new Error("This radio id does not exists!");
  31. }
  32. // check if is cached, load it otherwise
  33. if (!cachedRadiomanifest[id]) {
  34. const radio = RM.radio[id];
  35. cachedRadiomanifest[id] = await radiomanifest.get(radio.url);
  36. }
  37. this.currentRadio = cachedRadiomanifest[id];
  38. return cachedRadiomanifest[id];
  39. },
  40. };
  41. export default RM;