Compare commits
9 Commits
52db5633c8
...
main
Author | SHA1 | Date | |
---|---|---|---|
11ee140064 | |||
5dc7aff7ed | |||
32e03ad0f7
|
|||
c6296003af
|
|||
1e604922b9 | |||
030fde7348 | |||
c2316a672d
|
|||
2f735587c3 | |||
8d21620295 |
@ -56,7 +56,7 @@ onMounted(async () => {
|
|||||||
<h3 class="text-2xl font-semibold tracking-tight">
|
<h3 class="text-2xl font-semibold tracking-tight">
|
||||||
{{ props.item.title }}
|
{{ props.item.title }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-sm">
|
<p class="text-sm line-clamp-5">
|
||||||
{{ props.item.material_data?.description }}
|
{{ props.item.material_data?.description }}
|
||||||
</p>
|
</p>
|
||||||
<div class="flex items-center pt-2">
|
<div class="flex items-center pt-2">
|
||||||
|
@ -1,15 +1,29 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Icon } from '@iconify/vue'
|
import { Icon } from '@iconify/vue'
|
||||||
|
import type { RouteLocationNormalized } from 'vue-router'
|
||||||
|
import { updateUrlParameter } from '~/components/util/route'
|
||||||
|
|
||||||
|
const props = defineProps<Props>();
|
||||||
|
const route = useRoute()
|
||||||
|
const currentEpisode = computed(() => Number(route.query.episode as string))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
function changeEpisode(route: RouteLocationNormalized, props: Props, currentEpisode: number) {
|
||||||
|
let episodeOffset = 0
|
||||||
|
if (props.type == EpisodeChangeType.NEXT) {
|
||||||
|
episodeOffset = 1
|
||||||
|
}
|
||||||
|
if (props.type == EpisodeChangeType.PREVIOUS) {
|
||||||
|
episodeOffset = -1
|
||||||
|
}
|
||||||
|
updateUrlParameter(route, 'episode', String(currentEpisode + episodeOffset))
|
||||||
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
type: EpisodeChangeType;
|
type: EpisodeChangeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export enum EpisodeChangeType {
|
export enum EpisodeChangeType {
|
||||||
NEXT = "mage:next-fill",
|
NEXT = "mage:next-fill",
|
||||||
PREVIOUS = "mage:previous-fill",
|
PREVIOUS = "mage:previous-fill",
|
||||||
@ -17,7 +31,7 @@ export enum EpisodeChangeType {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UiButton variant="borderless" size="icon">
|
<UiButton v-on:click="changeEpisode(route, props, currentEpisode)" variant="borderless" size="icon">
|
||||||
<Icon :icon="props.type" class="size-5" />
|
<Icon :icon="props.type" class="size-5" />
|
||||||
</UiButton>
|
</UiButton>
|
||||||
</template>
|
</template>
|
||||||
|
@ -6,8 +6,7 @@ import { EpisodeChangeType } from "./ChangeEpisodeButton.vue";
|
|||||||
import { UiPlayerChangeEpisodeButton } from "#components";
|
import { UiPlayerChangeEpisodeButton } from "#components";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
urls: any;
|
urls: any[];
|
||||||
id: string;
|
|
||||||
episodeButton: boolean;
|
episodeButton: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,36 +16,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
const emit = defineEmits(['get-instance'])
|
const emit = defineEmits(['get-instance'])
|
||||||
|
|
||||||
const options = computed(() => {
|
const options = computed(() => {
|
||||||
const controls = []
|
|
||||||
if (props.episodeButton) {
|
|
||||||
controls.push(
|
|
||||||
createVueControlSmart(UiPlayerChangeEpisodeButton, {
|
|
||||||
name: "next-episode",
|
|
||||||
index: 50,
|
|
||||||
tooltip: "Next episode",
|
|
||||||
type: EpisodeChangeType.NEXT
|
|
||||||
}, {
|
|
||||||
click: () => console.log("NEXT")
|
|
||||||
})
|
|
||||||
)
|
|
||||||
controls.push(
|
|
||||||
createVueControlSmart(UiPlayerChangeEpisodeButton, {
|
|
||||||
name: "previous-episode",
|
|
||||||
index: 50,
|
|
||||||
tooltip: "Previous episode",
|
|
||||||
type: EpisodeChangeType.PREVIOUS
|
|
||||||
}, {
|
|
||||||
click: () => console.log("Previous")
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
url: props.urls[0].url || '',
|
url: props.urls[0].url || '',
|
||||||
type: 'm3u8',
|
type: 'm3u8',
|
||||||
customType: {
|
customType: {
|
||||||
m3u8: playM3u8,
|
m3u8: playM3u8,
|
||||||
},
|
},
|
||||||
quality: props.urls,
|
|
||||||
autoSize: true,
|
autoSize: true,
|
||||||
autoMini: true,
|
autoMini: true,
|
||||||
playbackRate: true,
|
playbackRate: true,
|
||||||
@ -56,8 +31,6 @@ const options = computed(() => {
|
|||||||
lock: true,
|
lock: true,
|
||||||
autoOrientation: true,
|
autoOrientation: true,
|
||||||
autoPlayback: true,
|
autoPlayback: true,
|
||||||
id: props.id,
|
|
||||||
controls: controls,
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const artplayerRef = ref();
|
const artplayerRef = ref();
|
||||||
@ -83,6 +56,24 @@ onMounted(() => {
|
|||||||
container: artplayerRef.value,
|
container: artplayerRef.value,
|
||||||
...options.value,
|
...options.value,
|
||||||
})
|
})
|
||||||
|
if (props.episodeButton) {
|
||||||
|
instance.value.controls.add(
|
||||||
|
createVueControlSmart(UiPlayerChangeEpisodeButton, {
|
||||||
|
name: "next-episode",
|
||||||
|
index: 50,
|
||||||
|
tooltip: "Next episode",
|
||||||
|
type: EpisodeChangeType.NEXT,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
instance.value.controls.add(
|
||||||
|
createVueControlSmart(UiPlayerChangeEpisodeButton, {
|
||||||
|
name: "previous-episode",
|
||||||
|
index: 50,
|
||||||
|
tooltip: "Previous episode",
|
||||||
|
type: EpisodeChangeType.PREVIOUS,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
emit('get-instance')
|
emit('get-instance')
|
||||||
})
|
})
|
||||||
@ -93,6 +84,14 @@ onBeforeUnmount(() => {
|
|||||||
instance.value.destroy(false)
|
instance.value.destroy(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch([instance, () => props.urls], async ([artplayer, urls]) => {
|
||||||
|
if (!artplayer) return;
|
||||||
|
urls = urls.reverse()
|
||||||
|
artplayer.quality = urls;
|
||||||
|
artplayer.switch = urls[0].url;
|
||||||
|
instance.value = artplayer;
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -14,8 +14,6 @@ export function createVueControlSmart(component, props = {}, events = {}) {
|
|||||||
const container = $control.querySelector('.vue-control-wrapper')
|
const container = $control.querySelector('.vue-control-wrapper')
|
||||||
|
|
||||||
if (container && !vueApp) {
|
if (container && !vueApp) {
|
||||||
|
|
||||||
console.log("111")
|
|
||||||
vueApp = createApp({
|
vueApp = createApp({
|
||||||
render() {
|
render() {
|
||||||
return h(component, {
|
return h(component, {
|
||||||
|
9
app/components/util/route.js
Normal file
9
app/components/util/route.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export const updateUrlParameter = async (route, paramName, newValue) => {
|
||||||
|
await navigateTo({
|
||||||
|
path: route.path,
|
||||||
|
query: {
|
||||||
|
...route.query,
|
||||||
|
[paramName]: newValue
|
||||||
|
}
|
||||||
|
}, { replace: true })
|
||||||
|
}
|
@ -8,8 +8,7 @@
|
|||||||
<p>Episode: {{ episode }}</p>
|
<p>Episode: {{ episode }}</p>
|
||||||
|
|
||||||
<div v-if="hlsUrls">
|
<div v-if="hlsUrls">
|
||||||
<Player :id="mediaId.toString().concat(episode?.toString() || '')" :urls="hlsUrls" :episode="episode"
|
<Player :urls="hlsUrls" :episode="episode" :episodeButton="true" />
|
||||||
:episodeButton="true" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Loading and Error States -->
|
<!-- Loading and Error States -->
|
||||||
@ -28,10 +27,10 @@ import { Player } from '~/components/ui/player'
|
|||||||
import { video, type KodikVideoLinks } from '~/openapi/extractor'
|
import { video, type KodikVideoLinks } from '~/openapi/extractor'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const mediaType = route.query.mediaType
|
const mediaType = computed(() => route.query.mediaType as string)
|
||||||
const mediaId = route.query.mediaId
|
const mediaId = computed(() => route.query.mediaId as string)
|
||||||
const mediaHash = route.query.mediaHash
|
const mediaHash = computed(() => route.query.mediaHash as string)
|
||||||
const episode = route.query.episode
|
const episode = computed(() => Number(route.query.episode as string))
|
||||||
|
|
||||||
const results = ref<KodikVideoLinks | null>(null)
|
const results = ref<KodikVideoLinks | null>(null)
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
@ -39,17 +38,15 @@ const error = ref<unknown>(null)
|
|||||||
const hlsUrls = ref<any>(null)
|
const hlsUrls = ref<any>(null)
|
||||||
|
|
||||||
watchEffect(async () => {
|
watchEffect(async () => {
|
||||||
if (!mediaType || !mediaId || !mediaHash || !episode) return
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
const videoParams: any = {
|
const videoParams: any = {
|
||||||
mediaType: mediaType as string,
|
mediaType: mediaType.value,
|
||||||
mediaId: mediaId as string,
|
mediaId: mediaId.value,
|
||||||
mediaHash: mediaHash as string,
|
mediaHash: mediaHash.value,
|
||||||
episode: Number(episode as string),
|
episode: episode.value,
|
||||||
quality: '360',
|
quality: '360',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,11 +54,13 @@ watchEffect(async () => {
|
|||||||
results.value = response?.data || null
|
results.value = response?.data || null
|
||||||
|
|
||||||
if (results.value?.links) {
|
if (results.value?.links) {
|
||||||
hlsUrls.value = Object.entries(results.value.links).map(([quality, links], index) => {
|
console.log(results.value.links)
|
||||||
|
hlsUrls.value = Object.entries(results.value.links).map(([quality, links], index, arr) => {
|
||||||
|
const isLatest = index === arr.length - 1
|
||||||
return {
|
return {
|
||||||
html: quality,
|
html: quality,
|
||||||
url: links.find(link => link.src?.includes('.m3u8') || link.type?.includes('hls'))?.src,
|
url: links.find(link => link.src?.includes('.m3u8') || link.type?.includes('hls'))?.src,
|
||||||
default: index === 0
|
default: isLatest
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
3
bun.lock
3
bun.lock
@ -29,6 +29,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/heroicons": "^1.2.2",
|
"@iconify-json/heroicons": "^1.2.2",
|
||||||
|
"@iconify-json/mage": "^1.2.4",
|
||||||
"@nuxtjs/color-mode": "^3.5.2",
|
"@nuxtjs/color-mode": "^3.5.2",
|
||||||
"orval": "^7.10.0",
|
"orval": "^7.10.0",
|
||||||
},
|
},
|
||||||
@ -227,6 +228,8 @@
|
|||||||
|
|
||||||
"@iconify-json/heroicons": ["@iconify-json/heroicons@1.2.2", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-qoW4pXr5kTTL6juEjgTs83OJIwpePu7q1tdtKVEdj+i0zyyVHgg/dd9grsXJQnpTpBt6/VwNjrXBvFjRsKPENg=="],
|
"@iconify-json/heroicons": ["@iconify-json/heroicons@1.2.2", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-qoW4pXr5kTTL6juEjgTs83OJIwpePu7q1tdtKVEdj+i0zyyVHgg/dd9grsXJQnpTpBt6/VwNjrXBvFjRsKPENg=="],
|
||||||
|
|
||||||
|
"@iconify-json/mage": ["@iconify-json/mage@1.2.4", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-QZnjHtV/RP9/bF6n7bHSnXMPX/MW5dpHqOH2pEHiEytUx76OKrUZ55YBFwrAxPz5f3BoCeWMY1wyEQQD36Bkkw=="],
|
||||||
|
|
||||||
"@iconify/collections": ["@iconify/collections@1.0.569", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-PclOVcAlvv55Fv5kRJmxk/KMoFLNBMLh0q9LDMlonIPJMUu958VsNw7F7CVurfyEbCf/54i7eF+q6LHqJxeQvg=="],
|
"@iconify/collections": ["@iconify/collections@1.0.569", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-PclOVcAlvv55Fv5kRJmxk/KMoFLNBMLh0q9LDMlonIPJMUu958VsNw7F7CVurfyEbCf/54i7eF+q6LHqJxeQvg=="],
|
||||||
|
|
||||||
"@iconify/types": ["@iconify/types@2.0.0", "", {}, "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="],
|
"@iconify/types": ["@iconify/types@2.0.0", "", {}, "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="],
|
||||||
|
@ -4,7 +4,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
- anyame
|
- anyame-shared
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
anyame:
|
anyame-shared:
|
||||||
driver: bridge
|
external: true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
import withNuxt from '.nuxt/eslint.config.mjs'
|
import withNuxt from './.nuxt/eslint.config.mjs'
|
||||||
|
|
||||||
export default withNuxt(
|
export default withNuxt(
|
||||||
// Your custom configs here
|
// Your custom configs here
|
||||||
)
|
)
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/heroicons": "^1.2.2",
|
"@iconify-json/heroicons": "^1.2.2",
|
||||||
|
"@iconify-json/mage": "^1.2.4",
|
||||||
"@nuxtjs/color-mode": "^3.5.2",
|
"@nuxtjs/color-mode": "^3.5.2",
|
||||||
"orval": "^7.10.0"
|
"orval": "^7.10.0"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user