mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
refactor
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
|||||||
ViewAgenda as ViewAgendaIcon,
|
ViewAgenda as ViewAgendaIcon,
|
||||||
} from '@material-ui/icons'
|
} from '@material-ui/icons'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { streamHost, torrentsHost, viewedHost } from 'utils/Hosts'
|
import { playlistTorrHost, streamHost, torrentsHost, viewedHost } from 'utils/Hosts'
|
||||||
import { GETTING_INFO, IN_DB } from 'torrentStates'
|
import { GETTING_INFO, IN_DB } from 'torrentStates'
|
||||||
|
|
||||||
import { useUpdateCache, useCreateCacheMap, useGetSettings } from './customHooks'
|
import { useUpdateCache, useCreateCacheMap, useGetSettings } from './customHooks'
|
||||||
@@ -72,6 +72,8 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
const preloadBuffer = fileId => fetch(`${streamHost()}?link=${hash}&index=${fileId}&preload`)
|
const preloadBuffer = fileId => fetch(`${streamHost()}?link=${hash}&index=${fileId}&preload`)
|
||||||
const getFileLink = (path, id) =>
|
const getFileLink = (path, id) =>
|
||||||
`${streamHost()}/${encodeURIComponent(path.split('\\').pop().split('/').pop())}?link=${hash}&index=${id}&play`
|
`${streamHost()}/${encodeURIComponent(path.split('\\').pop().split('/').pop())}?link=${hash}&index=${id}&play`
|
||||||
|
const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(name || title || 'file')}.m3u?link=${hash}&m3u`
|
||||||
|
const partialPlaylistLink = `${fullPlaylistLink}&fromlast`
|
||||||
|
|
||||||
const fileHasEpisodeText = !!playableFileList?.find(({ path }) => ptt.parse(path).episode)
|
const fileHasEpisodeText = !!playableFileList?.find(({ path }) => ptt.parse(path).episode)
|
||||||
const fileHasSeasonText = !!playableFileList?.find(({ path }) => ptt.parse(path).season)
|
const fileHasSeasonText = !!playableFileList?.find(({ path }) => ptt.parse(path).season)
|
||||||
@@ -185,12 +187,17 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
</SectionSubName>
|
</SectionSubName>
|
||||||
|
|
||||||
<MainSectionButtonGroup>
|
<MainSectionButtonGroup>
|
||||||
<Button variant='contained' color='primary' size='large'>
|
<a style={{ textDecoration: 'none' }} href={fullPlaylistLink}>
|
||||||
full
|
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
|
||||||
</Button>
|
full
|
||||||
<Button variant='contained' color='primary' size='large'>
|
</Button>
|
||||||
from latest file
|
</a>
|
||||||
</Button>
|
|
||||||
|
<a style={{ textDecoration: 'none' }} href={partialPlaylistLink}>
|
||||||
|
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
|
||||||
|
from latest file
|
||||||
|
</Button>
|
||||||
|
</a>
|
||||||
</MainSectionButtonGroup>
|
</MainSectionButtonGroup>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -210,9 +217,11 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
|
|
||||||
<MainSectionButtonGroup>
|
<MainSectionButtonGroup>
|
||||||
{(isOnlyOnePlayableFile || !viewedFileList?.length) && (
|
{(isOnlyOnePlayableFile || !viewedFileList?.length) && (
|
||||||
<Button variant='contained' color='primary' size='large'>
|
<a style={{ textDecoration: 'none' }} href={fullPlaylistLink}>
|
||||||
download playlist
|
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
|
||||||
</Button>
|
download playlist
|
||||||
|
</Button>
|
||||||
|
</a>
|
||||||
)}
|
)}
|
||||||
<CopyToClipboard text={hash}>
|
<CopyToClipboard text={hash}>
|
||||||
<Button variant='contained' color='primary' size='large'>
|
<Button variant='contained' color='primary' size='large'>
|
||||||
|
|||||||
Reference in New Issue
Block a user