This commit is contained in:
Daniel Shleifman
2021-05-31 15:33:12 +03:00
parent aab85cc366
commit 92bc874e7f

View File

@@ -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}>
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
full full
</Button> </Button>
<Button variant='contained' color='primary' size='large'> </a>
<a style={{ textDecoration: 'none' }} href={partialPlaylistLink}>
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
from latest file from latest file
</Button> </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}>
<Button style={{ width: '100%' }} variant='contained' color='primary' size='large'>
download playlist download playlist
</Button> </Button>
</a>
)} )}
<CopyToClipboard text={hash}> <CopyToClipboard text={hash}>
<Button variant='contained' color='primary' size='large'> <Button variant='contained' color='primary' size='large'>