mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
large snake added
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { memo } from 'react'
|
||||
import isEqual from 'lodash/isEqual'
|
||||
|
||||
import { useCreateCacheMap } from '../customHooks'
|
||||
import LargeSnake from './LargeSnake'
|
||||
import DefaultSnake from './DefaultSnake'
|
||||
|
||||
const TorrentCache = memo(
|
||||
({ cache, isMini }) => {
|
||||
const cacheMap = useCreateCacheMap(cache)
|
||||
|
||||
const preloadPiecesAmount = Math.round(cache.Capacity / cache.PiecesLength - 1)
|
||||
const isSnakeLarge = cacheMap.length > 7000
|
||||
|
||||
return isMini ? (
|
||||
<DefaultSnake isMini cacheMap={cacheMap} preloadPiecesAmount={preloadPiecesAmount} />
|
||||
) : isSnakeLarge ? (
|
||||
<LargeSnake cacheMap={cacheMap} />
|
||||
) : (
|
||||
<DefaultSnake cacheMap={cacheMap} preloadPiecesAmount={preloadPiecesAmount} />
|
||||
)
|
||||
},
|
||||
(prev, next) => isEqual(prev.cache.Pieces, next.cache.Pieces) && isEqual(prev.cache.Readers, next.cache.Readers),
|
||||
)
|
||||
|
||||
export default TorrentCache
|
||||
Reference in New Issue
Block a user