Show.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. <f7-preloader v-if='loading' />
  9. <f7-list v-else>
  10. <a @click="play(episode)" v-for='episode in Show.episodes' :key='episode.url' >
  11. <f7-list-item :title='episode.title' :footer='episode.text' />
  12. </a>
  13. </f7-list>
  14. </f7-page>
  15. </template>
  16. <script>
  17. import radiomanifest from '../js/radiomanifest'
  18. import getPodcast from '../js/podcast'
  19. import eventBus from '../js/eventBus'
  20. export default {
  21. name: 'radio',
  22. data () {
  23. return {
  24. loading_meta: true,
  25. loading: true,
  26. radioId: null,
  27. showId: null,
  28. Show: null,
  29. }
  30. },
  31. props: { f7route: Object, f7router: Object },
  32. async mounted () {
  33. this.radioId = this.f7route.params.radioId
  34. this.showId = this.f7route.params.showId
  35. this.ShowBasicInfo = {}
  36. try {
  37. this.Radio = await radiomanifest.get(this.f7route.params.radioId)
  38. this.ShowBasicInfo = this.Radio.getShowByName(this.showId)
  39. this.loading_meta = false
  40. this.Show = await getPodcast(this.ShowBasicInfo.getFeed())
  41. console.log('Show =', this.Show)
  42. this.loading = false
  43. } catch (e) {
  44. console.error('le cose non vanno mai sempre bene!', e)
  45. }
  46. },
  47. methods: {
  48. play: function(episode) {
  49. eventBus.$emit('play:now', episode.enclosure.url)
  50. }
  51. }
  52. }
  53. </script>