Show.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <f7-page name="show">
  3. <f7-preloader v-if="loading_meta" />
  4. <f7-block v-else>
  5. <f7-block-title>{{ ShowBasicInfo.name }}</f7-block-title>
  6. <f7-block-header>{{ Radio.name }}</f7-block-header>
  7. </f7-block>
  8. <div v-if="loading" strong class="text-align-center">
  9. <f7-preloader />
  10. </div>
  11. <f7-list media-list v-else>
  12. <f7-list-item
  13. v-for="episode in Show.episodes"
  14. :key="episode.url"
  15. :title="episode.title"
  16. :after="new Date(episode.pubDate).toLocaleString()"
  17. link="#"
  18. @click="play(episode)"
  19. >
  20. <small v-html="episode.description" />
  21. <!--
  22. - l'html della descrizione va tagliato e filtato
  23. - qua ci sta mettere l'immagine se c'e', nelle f7-list c'e' uno slot media apposito
  24. -->
  25. </f7-list-item>
  26. </f7-list>
  27. </f7-page>
  28. </template>
  29. <script>
  30. import radiomanifest from "../js/radiomanifest";
  31. import getPodcast from "../js/podcast";
  32. import eventBus from "../js/eventBus";
  33. export default {
  34. name: "radio",
  35. data() {
  36. return {
  37. loading_meta: true,
  38. loading: true,
  39. radioId: null,
  40. showId: null,
  41. Show: null,
  42. };
  43. },
  44. props: { f7route: Object, f7router: Object },
  45. async mounted() {
  46. this.radioId = this.f7route.params.radioId;
  47. this.showId = this.f7route.params.showId;
  48. this.ShowBasicInfo = {};
  49. try {
  50. this.Radio = await radiomanifest.get(this.f7route.params.radioId);
  51. this.ShowBasicInfo = this.Radio.getShowByName(this.showId);
  52. this.loading_meta = false;
  53. this.Show = await getPodcast(this.ShowBasicInfo.getFeed());
  54. console.log("Show =", this.Show);
  55. this.loading = false;
  56. } catch (e) {
  57. console.error("le cose non vanno mai sempre bene!", e);
  58. }
  59. },
  60. methods: {
  61. play: function (episode) {
  62. eventBus.$emit("play:now", episode.enclosure.url, {
  63. live: false,
  64. title: episode.title,
  65. });
  66. },
  67. },
  68. };
  69. </script>