Skip to content

Commit

Permalink
refactor(music): update server exclusive song list
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaroma committed Jun 4, 2024
1 parent 5bd039a commit 897123d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/components/blocks/MoviePlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const MoviePlayer: React.FC<
const buildDataUrl = await getRemoteAssetURL(
`${path}/moviebundlebuilddata.asset`,
undefined,
"minio"
"minio",
region
);
const buildData = (
await axios.get(buildDataUrl, { responseType: "json" })
Expand Down
46 changes: 35 additions & 11 deletions src/pages/music/MusicDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ import PaperContainer from "../../components/styled/PaperContainer";
import GridOut from "../../components/styled/GridOut";
import EmbedVideoPlayer from "../../components/blocks/EmbedVideoPlayer";

const KR_EXCLUSIVE_IDS = [10001, 10002, 371, 387, 420, 464];
const EN_EXCLUSIVE_IDS = [420, 445, 453, 459, 464];
const TW_EXCLUSIVE_IDS = [371, 387, 420, 464];

const MusicDetail: React.FC<unknown> = observer(() => {
const { t } = useTranslation();
const { getTranslated } = useAssetI18n();
Expand Down Expand Up @@ -180,7 +184,11 @@ const MusicDetail: React.FC<unknown> = observer(() => {

useEffect(() => {
if (music && musicVocal && musicVocal[selectedPreviewVocalType]) {
if ([420, 445, 453, 459, 464, 10001, 10002].includes(music.id)) {
if (
(TW_EXCLUSIVE_IDS.includes(music.id) && region === "tw") ||
(EN_EXCLUSIVE_IDS.includes(music.id) && region === "en") ||
(KR_EXCLUSIVE_IDS.includes(music.id) && region === "kr")
) {
// handle server exclusive music
getRemoteAssetURL(
`music/long/${musicVocal[selectedPreviewVocalType].assetbundleName}_rip/${musicVocal[selectedPreviewVocalType].assetbundleName}.${format}`,
Expand Down Expand Up @@ -229,17 +237,33 @@ const MusicDetail: React.FC<unknown> = observer(() => {
musicVocal[selectedPreviewVocalType] &&
(vocalPreviewVal === "original" || vocalPreviewVal === "mv_2d")
) {
setMusicVideoURL(
`live/2dmode/${
vocalPreviewVal === "original"
? "original_mv"
: vocalPreviewVal === "mv_2d"
? "sekai_mv"
: ""
}/${String(music.id).padStart(4, "0")}_rip`
);
if (
(TW_EXCLUSIVE_IDS.includes(music.id) && region === "tw") ||
(EN_EXCLUSIVE_IDS.includes(music.id) && region === "en") ||
(KR_EXCLUSIVE_IDS.includes(music.id) && region === "kr")
) {
setMusicVideoURL(
`live/2dmode/${
vocalPreviewVal === "original"
? "original_mv"
: vocalPreviewVal === "mv_2d"
? "sekai_mv"
: ""
}/${String(music.id).padStart(4, "0")}_rip`
);
} else {
setMusicVideoURL(
`live/2dmode/${
vocalPreviewVal === "original"
? "original_mv"
: vocalPreviewVal === "mv_2d"
? "sekai_mv"
: ""
}/${String(music.id).padStart(4, "0")}_rip`
);
}
}
}, [music, musicVocal, selectedPreviewVocalType, vocalPreviewVal]);
}, [music, musicVocal, region, selectedPreviewVocalType, vocalPreviewVal]);

const getVocalCharaIcons: (index: number) => JSX.Element = useCallback(
(index: number) => {
Expand Down

0 comments on commit 897123d

Please sign in to comment.