(trunk web) show relevant status and progress bar for when a magnetized torrent is still waiting for metadata

This commit is contained in:
Kevin Glowacz 2009-12-04 04:31:29 +00:00
parent 1efceb021c
commit 900b8d966f
3 changed files with 57 additions and 28 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -30,7 +30,7 @@ Torrent._ErrLocalError = 3;
Torrent._StaticFields = [ 'addedDate', 'comment', 'creator', 'dateCreated', Torrent._StaticFields = [ 'addedDate', 'comment', 'creator', 'dateCreated',
'hashString', 'id', 'isPrivate', 'name', 'totalSize', 'pieceCount', 'pieceSize' ] 'hashString', 'id', 'isPrivate', 'name', 'totalSize', 'pieceCount', 'pieceSize' ]
Torrent._DynamicFields = [ 'downloadedEver', 'error', 'errorString', 'eta', Torrent._DynamicFields = [ 'downloadedEver', 'error', 'errorString', 'eta',
'haveUnchecked', 'haveValid', 'leftUntilDone', 'peersConnected', 'haveUnchecked', 'haveValid', 'leftUntilDone', 'metadataPercentComplete', 'peersConnected',
'peersGettingFromUs', 'peersSendingToUs', 'rateDownload', 'rateUpload', 'peersGettingFromUs', 'peersSendingToUs', 'rateDownload', 'rateUpload',
'recheckProgress', 'sizeWhenDone', 'status', 'recheckProgress', 'sizeWhenDone', 'status',
'uploadedEver', 'uploadRatio', 'seedRatioLimit', 'seedRatioMode', 'downloadDir' ] 'uploadedEver', 'uploadRatio', 'seedRatioLimit', 'seedRatioMode', 'downloadDir' ]
@ -185,6 +185,7 @@ Torrent.prototype =
name: function() { return this._name; }, name: function() { return this._name; },
peersSendingToUs: function() { return this._peers_sending_to_us; }, peersSendingToUs: function() { return this._peers_sending_to_us; },
peersGettingFromUs: function() { return this._peers_getting_from_us; }, peersGettingFromUs: function() { return this._peers_getting_from_us; },
needsMetaData: function(){ return this._metadataPercentComplete < 1 },
getPercentDone: function() { getPercentDone: function() {
if( !this._sizeWhenDone ) return 1.0; if( !this._sizeWhenDone ) return 1.0;
if( !this._leftUntilDone ) return 1.0; if( !this._leftUntilDone ) return 1.0;
@ -331,6 +332,7 @@ Torrent.prototype =
this._eta = data.eta; this._eta = data.eta;
this._state = data.status; this._state = data.status;
this._download_dir = data.downloadDir; this._download_dir = data.downloadDir;
this._metadataPercentComplete = data.metadataPercentComplete;
if (data.fileStats) if (data.fileStats)
this.refreshFileModel( data ); this.refreshFileModel( data );
@ -425,7 +427,24 @@ Torrent.prototype =
if( this._state === Torrent._StatusSeeding ) if( this._state === Torrent._StatusSeeding )
notDone = false ; notDone = false ;
if( notDone ) if( this.needsMetaData() ){
var metaPercentComplete = this._metadataPercentComplete * 1000 / 100
progress_details = "Magnetized transfer - retrieving metadata (";
progress_details += metaPercentComplete;
progress_details += "%)";
var empty = "";
if(metaPercentComplete == 0)
empty = "empty";
root._progress_complete_container.style.width = metaPercentComplete + "%";
root._progress_complete_container.className = 'torrent_progress_bar in_progress meta ' + empty;
root._progress_incomplete_container.style.width = 100 - metaPercentComplete + "%"
root._progress_incomplete_container.className = 'torrent_progress_bar incomplete meta';
root._progress_incomplete_container.style.display = 'block';
}
else if( notDone )
{ {
var eta = ''; var eta = '';
@ -462,11 +481,7 @@ Torrent.prototype =
// Update the 'incomplete' bar // Update the 'incomplete' bar
e = root._progress_incomplete_container; e = root._progress_incomplete_container;
if( e.className.indexOf( 'incomplete' ) === -1 ) e.className = 'torrent_progress_bar incomplete'
e.className = 'torrent_progress_bar in_progress';
// Clear the 'seeding' tag
if( e.className.indexOf( 'seeding' ) != -1 )
e.className = 'torrent_progress_bar incomplete';
e.style.width = (MaxBarWidth - css_completed_width) + '%'; e.style.width = (MaxBarWidth - css_completed_width) + '%';
e.style.display = 'block'; e.style.display = 'block';
} }

View File

@ -466,6 +466,20 @@ ul.torrent_list li.torrent div.torrent_progress_bar.empty {
border-color: #c8cacd; border-color: #c8cacd;
} }
ul.torrent_list li.torrent div.torrent_progress_bar.incomplete.meta {
background-position: left -50px;
border: 1px solid #cc6068;
}
ul.torrent_list li.torrent div.torrent_progress_bar.in_progress.meta {
background-position: left -20px;
border-color: #c8cacd;
}
ul.torrent_list li.torrent div.torrent_progress_bar.in_progress.meta.empty {
border: 0 none;
}
li.torrent a div { li.torrent a div {
float: right; float: right;
position: relative; position: relative;