mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
add download all tv series episodes
This commit is contained in:
parent
dde4a924ef
commit
b537b0edd2
@ -42,5 +42,6 @@ async function downloadMedia(mediaId: number, mediaSlug: string, mediaType: stri
|
||||
}
|
||||
|
||||
export const downloadFilm = (mediaId: number, mediaSlug: string) => downloadMedia(mediaId, mediaSlug, 'MOVIE');
|
||||
export const downloadTvSeries = (mediaId: number, mediaSlug: string, downloadId: number) => downloadMedia(mediaId, mediaSlug, 'TV', downloadId);
|
||||
export const downloadAnimeFilm = (mediaId: number, mediaSlug: string) => downloadMedia(mediaId, mediaSlug, 'OVA');
|
||||
export const downloadAnimeSeries = (mediaId: number, mediaSlug: string, downloadId: number) => downloadMedia(mediaId, mediaSlug, 'OVA', downloadId);
|
@ -2,7 +2,7 @@
|
||||
import { useRoute } from 'vue-router'
|
||||
import type {DownloadResponse, Episode, MediaItem, Season, SeasonResponse} from "@/api/interfaces";
|
||||
import { onMounted, ref } from "vue";
|
||||
import {downloadAnimeFilm, downloadAnimeSeries, downloadFilm, getEpisodesInfo} from "@/api/api";
|
||||
import {downloadAnimeFilm, downloadAnimeSeries, downloadFilm, downloadTvSeries, getEpisodesInfo} from "@/api/api";
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
@ -55,6 +55,8 @@ const toggleEpisodeSelection = () => {
|
||||
const downloadItems = async () => {
|
||||
try {
|
||||
switch (item.type) {
|
||||
case 'TV':
|
||||
await handleTVDownload();
|
||||
case 'MOVIE':
|
||||
await handleMovieDownload();
|
||||
break;
|
||||
@ -73,6 +75,15 @@ const downloadItems = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleTVDownload = async () => {
|
||||
alertDownload();
|
||||
for (const season of tvShowEpisodes.value) {
|
||||
const i = tvShowEpisodes.value.indexOf(season);
|
||||
const res = (await downloadTvSeries(item.id, item.slug, i)).data;
|
||||
handleDownloadError(res);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMovieDownload = async () => {
|
||||
alertDownload();
|
||||
const res = (await downloadFilm(item.id, item.slug)).data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user