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