Skip to content

Commit 13d112a

Browse files
authored
Merge pull request #252 from lahmacunradio/#174-new-api
#174 new api
2 parents 1bd768b + 53af75f commit 13d112a

23 files changed

Lines changed: 371 additions & 232 deletions

app/components/BottomArcsiPlayer.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,14 @@ export default {
5555
isArcsiPlaying: 'getArcsiPlayState'
5656
5757
}),
58-
arcsiList () {
59-
return [...this.$store.getters.returnArcsiShows]
60-
},
6158
arcsiAudio () {
62-
if (!this.arcsiEpisode?.archive_lahmastore_canonical_url || !this.arcsiList) {
59+
if (!this.arcsiEpisode?.play_file_name) {
6360
return false
6461
}
65-
const showID = this.arcsiEpisode?.shows?.[0].id
66-
const showObject = this.arcsiList?.find(show => show.id === showID)
67-
return `${mediaServerURL}${showObject?.archive_lahmastore_base_url}/${this.arcsiEpisode?.archive_lahmastore_canonical_url}`
62+
const showSlug = this.arcsiEpisode.shows?.[0].archive_lahmastore_base_url
63+
const episodeNumber = this.arcsiEpisode.number
64+
const fileName = this.arcsiEpisode.play_file_name
65+
return `${mediaServerURL}${showSlug}/${episodeNumber}/${fileName}`
6866
}
6967
},
7068
methods: {

app/components/HeaderBlock.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</template>
2424

2525
<script>
26-
import { streamServer, arcsiServerURL, rareShowsURL, customScheduleURL } from '~/constants'
26+
import { streamServer, rareShowsURL, customScheduleURL, arcsiShowsBaseURL } from '~/constants'
2727
2828
export default {
2929
data () {
@@ -55,27 +55,27 @@ export default {
5555
5656
// refresh arcsiShows every 10 minutes
5757
if (minutes % 10 === 0) {
58-
this.refreshArcsiShows()
58+
this.refreshAllShows()
5959
}
6060
61-
// refresh arcsiShows every 3 minutes
61+
// refresh rareShows every 3 minutes
6262
if (minutes % 3 === 0) {
6363
this.refreshRareShows()
6464
}
6565
66-
// refresh arcsiShows every 4 minutes
66+
// refresh customSchedule every 4 minutes
6767
if (minutes % 4 === 0) {
6868
this.refreshCustomSchedule()
6969
}
7070
},
71-
async refreshArcsiShows () {
72-
await this.$axios.get(arcsiServerURL)
71+
async refreshAllShows () {
72+
await this.$axios.get(arcsiShowsBaseURL + '/all_without_items')
7373
.then((res) => {
74-
this.$store.commit('refreshArcsiShows', res.data)
74+
this.$store.commit('refreshAllShowsList', res.data)
7575
})
7676
.catch((e) => {
7777
this.$sentry.captureException(e)
78-
this.error({ statusCode: 404, message: 'Latest news not found' })
78+
this.error({ statusCode: 404, message: 'All shows endpoint not found' })
7979
})
8080
},
8181
async refreshRareShows () {
@@ -95,7 +95,7 @@ export default {
9595
})
9696
.catch((e) => {
9797
this.$sentry.captureException(e)
98-
this.error({ statusCode: 404, message: 'Rare Shows not found' })
98+
this.error({ statusCode: 404, message: 'Custom schedule not found' })
9999
})
100100
}
101101

app/components/Pagination.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div v-if="totalCount > itemsCount && !isLoading" class="p-4 text-center load-more-container">
44
<a href="#" @click.prevent="onClick">
55
<div class="load-more">
6-
LOAD MORE
6+
LOAD MORE
77
</div>
88
</a>
99
</div>
@@ -29,11 +29,11 @@ export default {
2929
totalCount: {
3030
type: Number,
3131
required: true
32-
},
32+
}
3333
},
3434
methods: {
35-
async onClick() {
36-
this.$emit('click');
35+
async onClick () {
36+
this.$emit('click')
3737
}
3838
}
3939
}

app/components/TagBlock.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export default {
1010
tag: {
1111
type: Object,
1212
required: true
13-
},
14-
},
13+
}
14+
}
1515
}
1616
</script>
1717

app/components/TagList.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<div class="tag-list">
33
<TagBlock
4-
v-for="(tag, index) in tags" :key="`${tag.id}-${index}`"
4+
v-for="(tag, index) in tags"
5+
:key="`${tag.id}-${index}`"
56
:tag="tag"
67
class="tag"
78
/>
@@ -15,8 +16,8 @@ export default {
1516
tags: {
1617
type: Array,
1718
required: true
18-
},
19-
},
19+
}
20+
}
2021
}
2122
</script>
2223

app/components/arcsi/EpisodeBlock.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
22
<div v-if="episode" class="latest-arcsi-blokk">
3-
<NuxtLink :to="`/shows/${showslug}/${episode.id}`" class="relative block w-full mb-2">
3+
<NuxtLink :to="`/shows/${showslug}/${episodeLink}`" class="relative block w-full mb-2">
44
<div class="absolute bottom-0 z-10 w-full p-2 text-center text-white bg-black">
55
<b>{{ episode.shows[0].name }}</b>
66
</div>
77
<div class="arcsi-img aspect-ratio-1/1">
88
<img class="block" :src="episodeImage" :alt="episode.name">
99
</div>
1010
</NuxtLink>
11-
<NuxtLink :to="`/shows/${showslug}/${episode.id}`">
11+
<NuxtLink :to="`/shows/${showslug}/${episodeLink}`">
1212
<h5>{{ episode.name }}</h5>
1313
</NuxtLink>
1414
<NuxtLink :to="`/shows/${showslug}`">
@@ -51,6 +51,12 @@ export default {
5151
computed: {
5252
episodeImage () {
5353
return this.episode.image_url.length > 0 ? this.episode.image_url : this.arcsilist.find(item => item.id === this.episode.shows[0].id).cover_image_url
54+
},
55+
episodeLink () {
56+
if (!this.episode.name_slug) {
57+
return false
58+
}
59+
return this.episode.name_slug
5460
}
5561
},
5662
created () {

app/components/arcsi/Latest.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default {
5858
data () {
5959
return {
6060
startIndex: 0,
61-
numberOfEpisodes: 9,
61+
numberOfEpisodes: 12,
6262
visibleEpisodes: 3,
6363
sliderPosition: 0,
6464
episodeWidth: 300,
@@ -67,7 +67,7 @@ export default {
6767
}
6868
},
6969
async fetch () {
70-
this.arcsiEpisodes = await this.$axios.get(arcsiItemBaseURL + '/all')
70+
this.arcsiEpisodes = await this.$axios.get(`${arcsiItemBaseURL}/latest?size=${this.startNumberofEpisodes}&page=${this.startIndex}`)
7171
.then(res => res.data)
7272
.catch((error) => {
7373
this.$sentry.captureException(new Error('Arcsi latest not found ', error))
@@ -91,6 +91,7 @@ export default {
9191
return showslist
9292
.filter(item => item.play_date < this.getToday)
9393
.filter(item => item.archived === true)
94+
.filter(item => item.name_slug !== null)
9495
.sort((a, b) => new Date(b.play_date) - new Date(a.play_date))
9596
.slice(this.startIndex, this.numberOfEpisodes)
9697
}
@@ -105,6 +106,7 @@ export default {
105106
window.addEventListener('resize', this.changeBreakpoint, { passive: true })
106107
setTimeout(() => {
107108
this.changeBreakpoint()
109+
this.numberOfEpisodes = this.arcsiEpisodesListSortedLatest?.length
108110
}, 3000)
109111
}
110112
},

app/components/arcsi/LatestBlock.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div v-if="episode" class="latest-arcsi-blokk">
3-
<NuxtLink :to="`/shows/${showslug}/${episode.id}`">
3+
<NuxtLink :to="`/shows/${showslug}/${episodeLink}`">
44
<div class="mb-4 arcsi-img aspect-ratio-1/1">
55
<img class="block" :src="episodeImage">
66
</div>
77
</NuxtLink>
8-
<NuxtLink :to="`/shows/${showslug}/${episode.id}`">
8+
<NuxtLink :to="`/shows/${showslug}/${episodeLink}`">
99
<h5>{{ episode.name }}</h5>
1010
</NuxtLink>
1111
<NuxtLink :to="`/shows/${showslug}`">
@@ -48,6 +48,12 @@ export default {
4848
computed: {
4949
episodeImage () {
5050
return this.episode.image_url.length > 0 ? this.episode.image_url : this.arcsilist.find(item => item.id === this.episode.shows[0].id).cover_image_url
51+
},
52+
episodeLink () {
53+
if (!this.episode.name_slug) {
54+
return false
55+
}
56+
return this.episode.name_slug
5157
}
5258
},
5359
created () {

app/components/arcsi/Player.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{{ episode.shows[0].name }}
3939
</NuxtLink>
4040
<span> - </span>
41-
<NuxtLink :to="`/shows/${arcsiShow.archive_lahmastore_base_url}/${episode.id}`">
41+
<NuxtLink :to="`/shows/${arcsiShow.archive_lahmastore_base_url}/${episode.name_slug}`">
4242
{{ episode.name }}
4343
</NuxtLink>
4444
</h5>

app/components/itemList/ItemList.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
</div>
1717
</article>
1818
<Pagination
19-
:itemsCount="items.length"
20-
:totalCount="totalCount"
21-
:isLoading="isLoading"
19+
:items-count="items.length"
20+
:total-count="totalCount"
21+
:is-loading="isLoading"
2222
@click="callback"
2323
/>
2424
</div>
@@ -28,7 +28,7 @@
2828
<script>
2929
3030
export default {
31-
props : {
31+
props: {
3232
items: {
3333
type: Array,
3434
request: true
@@ -51,13 +51,13 @@ export default {
5151
isFilter: {
5252
type: Boolean,
5353
default: true
54-
},
54+
}
5555
},
5656
methods: {
57-
onChange(event) {
57+
onChange (event) {
5858
this.$emit('search', event.target.value)
5959
}
60-
},
60+
}
6161
}
6262
</script>
6363

0 commit comments

Comments
 (0)