feat(downloading): download speed
This commit is contained in:
@ -167,9 +167,9 @@ export default class Torrent extends Component {
|
||||
super(props)
|
||||
if(props.download)
|
||||
{
|
||||
const { progress, downloaded, speed } = props.download
|
||||
const { progress, downloaded, downloadSpeed } = props.download
|
||||
this.state.downloadProgress = {
|
||||
progress, downloaded, speed
|
||||
progress, downloaded, downloadSpeed
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -268,15 +268,6 @@ export default class Torrent extends Component {
|
||||
formatBytes(torrent.size, 1) + ' (' + torrent.files + ' files)'
|
||||
}
|
||||
</div>
|
||||
{
|
||||
this.state.downloading
|
||||
&&
|
||||
<LinearProgress
|
||||
style={{width: '44%', marginLeft: 20}}
|
||||
mode="determinate"
|
||||
value={this.state.downloadProgress && (this.state.downloadProgress.progress ? this.state.downloadProgress.progress : 0) * 100}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
{
|
||||
torrent.path && torrent.path.length > 0
|
||||
@ -311,6 +302,20 @@ export default class Torrent extends Component {
|
||||
}}
|
||||
/>
|
||||
<div className='row center pad0-5 fs0-85 text-nowrap' style={{color: torrentRating >= 50 ? '#00E676' : '#FF3D00', width: '190px'}}>{__('Torrent rating')}: {torrentRating}%</div>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
this.state.downloading
|
||||
&&
|
||||
<div className='row w100p inline text-nowrap' style={{maxWidth: 580}}>
|
||||
<div style={{marginRight: 5, color: 'rgb(0, 188, 212)'}}>{__('downloading')}: </div>
|
||||
<LinearProgress
|
||||
style={{height: '5px', width: '44%', marginTop: 2}}
|
||||
mode="determinate"
|
||||
value={this.state.downloadProgress && (this.state.downloadProgress.progress ? this.state.downloadProgress.progress : 0) * 100}
|
||||
/>
|
||||
<div className='pad0-75' style={{marginLeft: 20}} style={{color: 'rgb(0, 188, 212)'}}>{this.state.downloadProgress && (this.state.downloadProgress.progress * 100).toFixed(1)}%</div>
|
||||
<div style={{marginLeft: 5, color: 'rgb(0, 188, 212)'}}>{this.state.downloadProgress && formatBytes(this.state.downloadProgress.downloadSpeed || 0, 0)}/s</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
@ -606,7 +606,7 @@ module.exports = async ({
|
||||
send('downloadProgress', torrent.infoHash, {
|
||||
received: bytes,
|
||||
downloaded: torrent.downloaded,
|
||||
speed: torrent.downloadSpeed,
|
||||
downloadSpeed: torrent.downloadSpeed,
|
||||
progress: torrent.progress,
|
||||
timeRemaining: torrent.timeRemaining
|
||||
})
|
||||
@ -648,7 +648,7 @@ module.exports = async ({
|
||||
received: torrent.received,
|
||||
downloaded: torrent.downloaded,
|
||||
progress: torrent.progress,
|
||||
speed: torrent.downloadSpeed
|
||||
downloadSpeed: torrent.downloadSpeed
|
||||
})))
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user