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