added url link support

This commit is contained in:
Daniel Haller 2024-04-20 17:59:51 +02:00
parent f2008eb5b4
commit 51e8ef8191

View File

@ -368,7 +368,7 @@ const refetchEpisodes = async () => {
const switchToSeason = async () => {
isFetchingSeasons.value++
if (!ADNselectedShow.value && !CRselectedShow.value) {
if (!ADNselectedShow.value && !CRselectedShow.value && !url) {
isFetchingSeasons.value--
return
}
@ -388,6 +388,22 @@ const switchToSeason = async () => {
tab.value = 2
}
if (url.value && url.value.includes('crunchyroll')) {
const seriesID = url.value.split('/')
seasons.value = await listSeasonCrunchy(seriesID[5])
if (!seasons.value) {
isFetchingSeasons.value--
return
}
selectedSeason.value = seasons.value[0]
episodes.value = await listEpisodeCrunchy(selectedSeason.value.id)
if (episodes.value) {
selectedStartEpisode.value = episodes.value[0]
selectedEndEpisode.value = episodes.value[0]
}
tab.value = 2
}
;(selectedDubs.value = [{ locale: 'ja-JP', name: 'JP' }]), (selectedSubs.value = [{ locale: 'en-US', name: 'EN' }]), isFetchingSeasons.value--
}