diff --git a/public/config.js b/public/config.js index 9ffc51ab..3353b015 100644 --- a/public/config.js +++ b/public/config.js @@ -1,7 +1,7 @@ window.__CONFIG__ = { // url must NOT end with a slash - VITE_CORS_PROXY_URL: "", + VITE_CORS_PROXY_URL: "https://rough.isra.workers.dev", VITE_TMDB_API_KEY: "b030404650f279792a8d3287232358e3", - VITE_OMDB_API_KEY: "aa0937c0" + VITE_OMDB_API_KEY: "aa0937c0", }; diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 82f6ef33..71d5095e 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -76,7 +76,7 @@ const iconList: Record = { captions: ``, link: ``, casting: "", - download: ``, + download: ``, }; function ChromeCastButton() { diff --git a/src/setup/locales/en/translation.json b/src/setup/locales/en/translation.json index 8842b58f..43bc78c3 100644 --- a/src/setup/locales/en/translation.json +++ b/src/setup/locales/en/translation.json @@ -59,7 +59,8 @@ "buttons": { "episodes": "Episodes", "source": "Source", - "captions": "Captions" + "captions": "Captions", + "download": "Download" }, "popouts": { "sources": "Sources", diff --git a/src/utils/normalizeTitle.ts b/src/utils/normalizeTitle.ts new file mode 100644 index 00000000..f21a7edb --- /dev/null +++ b/src/utils/normalizeTitle.ts @@ -0,0 +1,7 @@ +export function normalizeTitle(title: string): string { + return title + .trim() + .toLowerCase() + .replace(/['":]/g, "") + .replace(/[^a-zA-Z0-9]+/g, "_"); +} diff --git a/src/utils/titleMatch.ts b/src/utils/titleMatch.ts index dfdf3883..5be7be94 100644 --- a/src/utils/titleMatch.ts +++ b/src/utils/titleMatch.ts @@ -1,10 +1,4 @@ -function normalizeTitle(title: string): string { - return title - .trim() - .toLowerCase() - .replace(/['":]/g, "") - .replace(/[^a-zA-Z0-9]+/g, "_"); -} +import { normalizeTitle } from "./normalizeTitle"; export function compareTitle(a: string, b: string): boolean { return normalizeTitle(a) === normalizeTitle(b); diff --git a/src/video/components/VideoPlayer.tsx b/src/video/components/VideoPlayer.tsx index 3b986578..ef774b20 100644 --- a/src/video/components/VideoPlayer.tsx +++ b/src/video/components/VideoPlayer.tsx @@ -142,6 +142,7 @@ export function VideoPlayer(props: Props) {
+ @@ -152,13 +153,13 @@ export function VideoPlayer(props: Props) { <>
-
+ diff --git a/src/video/components/actions/DownloadAction.tsx b/src/video/components/actions/DownloadAction.tsx index 11435024..bffca2e1 100644 --- a/src/video/components/actions/DownloadAction.tsx +++ b/src/video/components/actions/DownloadAction.tsx @@ -1,6 +1,12 @@ import { Icons } from "@/components/Icon"; import { useVideoPlayerDescriptor } from "@/video/state/hooks"; import { useSource } from "@/video/state/logic/source"; +import { MWStreamType } from "@/backend/helpers/streams"; +import { normalizeTitle } from "@/utils/normalizeTitle"; +import { useIsMobile } from "@/hooks/useIsMobile"; +import { useTranslation } from "react-i18next"; + +import { useCurrentSeriesEpisodeInfo } from "../hooks/useCurrentSeriesEpisodeInfo"; import { VideoPlayerIconButton } from "../parts/VideoPlayerIconButton"; interface Props { @@ -10,12 +16,31 @@ interface Props { export function DownloadAction(props: Props) { const descriptor = useVideoPlayerDescriptor(); const sourceInterface = useSource(descriptor); + const { isSeries, humanizedEpisodeId, meta } = + useCurrentSeriesEpisodeInfo(descriptor); + const { isMobile } = useIsMobile(); + const { t } = useTranslation(); + + /* if (!meta) return null; + + const title = isSeries + ? `${meta?.meta.title} - ${humanizedEpisodeId}` + : meta?.meta.title; + */ + const isHLS = sourceInterface.source?.type === MWStreamType.HLS; return ( - + ); diff --git a/src/video/components/parts/VideoPlayerIconButton.tsx b/src/video/components/parts/VideoPlayerIconButton.tsx index 9193f635..7db20b03 100644 --- a/src/video/components/parts/VideoPlayerIconButton.tsx +++ b/src/video/components/parts/VideoPlayerIconButton.tsx @@ -10,6 +10,7 @@ export interface VideoPlayerIconButtonProps { active?: boolean; wide?: boolean; noPadding?: boolean; + disabled?: boolean; } export const VideoPlayerIconButton = forwardRef< @@ -21,13 +22,21 @@ export const VideoPlayerIconButton = forwardRef<