mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
table now has real data
This commit is contained in:
@@ -37,8 +37,6 @@ import {
|
|||||||
} from './style'
|
} from './style'
|
||||||
import StatisticsField from './StatisticsField'
|
import StatisticsField from './StatisticsField'
|
||||||
|
|
||||||
ptt.addHandler('part', /Part[. ]([0-9])/i, { type: 'integer' })
|
|
||||||
|
|
||||||
const shortenText = (text, count) => text.slice(0, count) + (text.length > count ? '...' : '')
|
const shortenText = (text, count) => text.slice(0, count) + (text.length > count ? '...' : '')
|
||||||
|
|
||||||
export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
||||||
@@ -76,6 +74,10 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
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 fileHasEpisodeText = !!playableFileList?.find(({ path }) => ptt.parse(path).episode)
|
||||||
|
const fileHasSeasonText = !!playableFileList?.find(({ path }) => ptt.parse(path).season)
|
||||||
|
const fileHasResolutionText = !!playableFileList?.find(({ path }) => ptt.parse(path).resolution)
|
||||||
|
|
||||||
const { Capacity, PiecesCount, PiecesLength, Filled } = cache
|
const { Capacity, PiecesCount, PiecesLength, Filled } = cache
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -220,24 +222,6 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</CopyToClipboard>
|
</CopyToClipboard>
|
||||||
</MainSectionButtonGroup>
|
</MainSectionButtonGroup>
|
||||||
|
|
||||||
{/* <MainSectionButtonGroup>
|
|
||||||
<Button variant='contained' color='primary' size='large'>
|
|
||||||
copy hash
|
|
||||||
</Button>
|
|
||||||
<Button variant='contained' color='primary' size='large'>
|
|
||||||
remove views
|
|
||||||
</Button>
|
|
||||||
<Button variant='contained' color='primary' size='large'>
|
|
||||||
drop torrent
|
|
||||||
</Button>
|
|
||||||
<Button variant='contained' color='primary' size='large'>
|
|
||||||
download full playlist
|
|
||||||
</Button>
|
|
||||||
<Button variant='contained' color='primary' size='large'>
|
|
||||||
download playlist after last view
|
|
||||||
</Button>
|
|
||||||
</MainSectionButtonGroup> */}
|
|
||||||
</div>
|
</div>
|
||||||
</MainSection>
|
</MainSection>
|
||||||
|
|
||||||
@@ -269,113 +253,61 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
<TorrentFilesSection>
|
<TorrentFilesSection>
|
||||||
<SectionTitle mb={20}>Torrent Content</SectionTitle>
|
<SectionTitle mb={20}>Torrent Content</SectionTitle>
|
||||||
|
|
||||||
<Table>
|
{!playableFileList?.length ? (
|
||||||
<thead>
|
'No playable files in this torrent'
|
||||||
<tr>
|
) : (
|
||||||
<th style={{ width: '0' }}>viewed</th>
|
<>
|
||||||
<th>name</th>
|
<Table>
|
||||||
<th style={{ width: '0' }}>season</th>
|
<thead>
|
||||||
<th style={{ width: '0' }}>episode</th>
|
<tr>
|
||||||
<th style={{ width: '0' }}>resolution</th>
|
<th style={{ width: '0' }}>viewed</th>
|
||||||
<th style={{ width: '100px' }}>size</th>
|
<th>name</th>
|
||||||
<th style={{ width: '400px' }}>actions</th>
|
{fileHasSeasonText && <th style={{ width: '0' }}>season</th>}
|
||||||
</tr>
|
{fileHasEpisodeText && <th style={{ width: '0' }}>episode</th>}
|
||||||
</thead>
|
{fileHasResolutionText && <th style={{ width: '0' }}>resolution</th>}
|
||||||
|
<th style={{ width: '100px' }}>size</th>
|
||||||
|
<th style={{ width: '400px' }}>actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr className='viewed-file-row'>
|
{playableFileList.map(({ id, path, length }) => {
|
||||||
<td className='viewed-file-indicator' />
|
const { title, resolution, episode, season } = ptt.parse(path)
|
||||||
<td>Jupiters Legacy</td>
|
const isViewed = viewedFileList?.includes(id)
|
||||||
<td>3</td>
|
const link = getFileLink(path, id)
|
||||||
<td>1</td>
|
|
||||||
<td>1080p</td>
|
|
||||||
<td>945,41 MB</td>
|
|
||||||
<td className='button-cell'>
|
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
|
||||||
Preload
|
|
||||||
</Button>
|
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
|
||||||
Open link
|
|
||||||
</Button>
|
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
|
||||||
Copy link
|
|
||||||
</Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr className='viewed-file-row'>
|
return (
|
||||||
<td className='viewed-file-indicator' />
|
<tr key={id} className={isViewed ? 'viewed-file-row' : null}>
|
||||||
<td>Jupiters Legacy</td>
|
<td className={isViewed ? 'viewed-file-indicator' : null} />
|
||||||
<td>3</td>
|
<td>{title}</td>
|
||||||
<td>2</td>
|
{fileHasSeasonText && <td>{season}</td>}
|
||||||
<td>1080p</td>
|
{fileHasEpisodeText && <td>{episode}</td>}
|
||||||
<td>712,47 MB</td>
|
{fileHasResolutionText && <td>{resolution}</td>}
|
||||||
<td className='button-cell'>
|
<td>{humanizeSize(length)}</td>
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
<td className='button-cell'>
|
||||||
Preload
|
<Button onClick={() => preloadBuffer(id)} variant='outlined' color='primary' size='small'>
|
||||||
</Button>
|
Preload
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
</Button>
|
||||||
Open link
|
|
||||||
</Button>
|
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
|
||||||
Copy link
|
|
||||||
</Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
<a style={{ textDecoration: 'none' }} href={link} target='_blank' rel='noreferrer'>
|
||||||
<td />
|
<Button style={{ width: '100%' }} variant='outlined' color='primary' size='small'>
|
||||||
<td>Jupiters Legacy</td>
|
Open link
|
||||||
<td>3</td>
|
</Button>
|
||||||
<td>3</td>
|
</a>
|
||||||
<td>1080p</td>
|
|
||||||
<td>687,44 MB</td>
|
|
||||||
<td className='button-cell'>
|
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
|
||||||
Preload
|
|
||||||
</Button>
|
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
|
||||||
Open link
|
|
||||||
</Button>
|
|
||||||
<Button variant='outlined' color='primary' size='small'>
|
|
||||||
Copy link
|
|
||||||
</Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</Table>
|
|
||||||
|
|
||||||
{!playableFileList?.length
|
<CopyToClipboard text={link}>
|
||||||
? 'No playable files in this torrent'
|
<Button variant='outlined' color='primary' size='small'>
|
||||||
: playableFileList.map(({ id, path, length }) => {
|
Copy link
|
||||||
{
|
</Button>
|
||||||
/* console.log(ptt.parse(path)) */
|
</CopyToClipboard>
|
||||||
}
|
</td>
|
||||||
{
|
</tr>
|
||||||
/* console.log({ title: ptt.parse(path).title })
|
)
|
||||||
console.log({ resolution: ptt.parse(path).resolution })
|
})}
|
||||||
console.log({ episode: ptt.parse(path).episode })
|
</tbody>
|
||||||
console.log({ season: ptt.parse(path).season }) */
|
</Table>
|
||||||
}
|
</>
|
||||||
|
)}
|
||||||
return (
|
|
||||||
<ButtonGroup key={id} disableElevation variant='contained' color='primary'>
|
|
||||||
<Button>
|
|
||||||
<a href={getFileLink(path, id)}>
|
|
||||||
<Typography>
|
|
||||||
{path.split('\\').pop().split('/').pop()} | {humanizeSize(length)}{' '}
|
|
||||||
{viewedFileList && viewedFileList?.indexOf(id) !== -1 && '| ✓'}
|
|
||||||
</Typography>
|
|
||||||
</a>
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button onClick={() => preloadBuffer(id)}>
|
|
||||||
<CachedIcon />
|
|
||||||
<Typography>Preload</Typography>
|
|
||||||
</Button>
|
|
||||||
</ButtonGroup>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</TorrentFilesSection>
|
</TorrentFilesSection>
|
||||||
</DialogContentGrid>
|
</DialogContentGrid>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -213,7 +213,6 @@ export const Table = styled.table`
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.viewed-file-row {
|
&.viewed-file-row {
|
||||||
color: lightgray;
|
|
||||||
background: #f3f3f3;
|
background: #f3f3f3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user