Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Feb 14, 2025
1 parent 1837d20 commit 4f2ddbb
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 97 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"bulma-switch": "^2.0.4",
"bulma-tooltip": "^3.0.2",
"classnames": "^2.5.1",
"lodash.groupby": "^4.6.0",
"query-string": "^9.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/index/src/components/comment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const Comment = ({ comments, onFocus, onBlur, postId, player, setMetaInfo }: Com
{comments.map((item, i) => (
<li key={item.ID} className={classNames('comment-item')}>
<div className="comment-item__head">
<img className="comment-item__avatar" src={'/ic_launcher_round.png'} alt="" />
<img className="comment-item__avatar" src={'https://www.loliapi.com/acg/pp/'} alt="" />
<div>
<span className="comment-item__name">#{comments.length - i}</span>
<p className="comment-item__time">{getTimeDistance(item.createdAt)}</p>
Expand Down
118 changes: 23 additions & 95 deletions packages/index/src/enime.adp.ts
Original file line number Diff line number Diff line change
@@ -1,92 +1,32 @@
export const enimeAdapter = (item: any) => {
if (!item.anime) item.anime = item
return {
...item,
enime: true,
adp: true,
ID: item.anime?.slug,
Cover: item.anime?.coverImage || '',
Title: item.anime?.title.native || '',
Content: item.description || '',
Tags: '其他',
Type: 'video',
CreatedAt: item.createdAt,
UpdatedAt: item.updatedAt,
Meta: {
TitleJapanese: '',
TitleRomanji: '',
Genre: item.genre?.toString(),
Region: 'enime',
Episodes: 13,
IsEnd: 2,
PublishDate: '2015-01-01T08:00:00+08:00',
UpdatedDate: null
},
Creator: {
ID: 1,
Name: 'enime.moe',
Nickname: 'enime',
Avatar: 'https://q1.qlogo.cn/g?b=qq&nk=7619376472&s=640',
Bio: '这个人很酷,什么都没有留下'
},
episodes: item.anime?.episodes?.map((ep: any) => ({
ID: ep.id,
Episode: ep.number,
Cover: ep.image,
Title: ep.title,
TitleJapanese: '',
TitleRomanji: '',
VideoUrl: '',
Synopsis: '',
Uid: 1,
Pid: item.anime?.slug,
CreatedAt: ep.airedAt || ep.createdAt,
UpdatedAt: ep.updatedAt
}))
}
}

export const enimesAdapter = (data: any[] = []) => data.map(enimeAdapter)

export const enimeSearchAdapter = (data: any[] = []) => {
return data.map((item) => ({
...item,
enime: true,
ID: item?.slug,
Cover: item?.coverImage || '',
Title: item?.title.native || '',
Content: item.description || '',
Tags: '其他',
Type: 'video',
CreatedAt: item.createdAt,
UpdatedAt: item.updatedAt,
Meta: {
TitleJapanese: '',
TitleRomanji: '',
Genre: item.genre?.toString(),
Region: 'enime',
Episodes: 13,
IsEnd: 2,
PublishDate: '2015-01-01T08:00:00+08:00',
UpdatedDate: null
},
Creator: {
ID: 1,
Name: 'enime.moe',
Nickname: 'enime',
Avatar: 'https://q1.qlogo.cn/g?b=qq&nk=7619376472&s=640',
Bio: '这个人很酷,什么都没有留下'
}
}))
}
import groupBy from 'lodash.groupby'

export function getSuo(content) {
if (!content) return 'https://ae01.alicdn.com/kf/U6751d35799cc4d06965aa7b1879e0fc6i.jpg'
let m = content.match(/suo(.+?)\)/i)
return m ? m[1].slice(2) : 'https://cdn-us.imgs.moe/2023/02/27/63fcb180cbb30.jpg'
}

const getVideos = (s: string) => {
return s
.split('\n')
.filter(Boolean)
.map((v, i) => {
const [chunkString, src] = v.split('$')
const [Episode, Title] = chunkString.split(' ')
return {
Episode: i,
Title: Title || Episode,
VideoUrl: src,
title: Title || Episode,
src,
poster: 'https://www.loliapi.com/acg/pc/'
}
})
}

export const clicliAdapter = (item: any) => {
const Episodes = getVideos(item.videos)

return {
...item,
adp: true,
Expand Down Expand Up @@ -116,20 +56,8 @@ export const clicliAdapter = (item: any) => {
Avatar: 'https://q1.qlogo.cn/g?b=qq&nk=7619376472&s=640',
Bio: '这个人很酷,什么都没有留下'
},
Episodes: item.videos
.split('\n')
.filter(Boolean)
.map((v, i) => {
const [chunkString, src] = v.split('$')
const [Episode, Title] = chunkString.split(' ')
return {
Episode: Title ? Episode : i,
Title: Title || Episode,
VideoUrl: src,
title: Title || Episode,
src
}
})
Episodes,
EpisodesGroup: groupBy(Episodes, (v) => v.Title)
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/index/src/pages/player/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function PlayerPage({ id }: any) {

const player = useRef<Player>(null)
const [isAdp, setIsAdp] = useState(false)
const [source, _] = useState<any>({ poster: 'https://api.imlazy.ink/img', title: 'LOADING ...' })
const [source, _] = useState<any>({ poster: 'https://www.loliapi.com/acg/pc/', title: 'LOADING ...' })
const [displayEpBar, setDisplayEpBar] = useState(false)

const [metaInfo, setMetaInfo] = useState<{ like: number; comment?: any[] }>({ like: 0 })
Expand Down Expand Up @@ -106,6 +106,8 @@ export default function PlayerPage({ id }: any) {
.then((it) => {
setState(it)
setVideo(it.Episodes)
// const groupIndex = localStorage.getItem('video_group') || 1

player.current?.context.playlist.changeSourceList(it.Episodes)
})
}, [isAdp])
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4f2ddbb

Please sign in to comment.