mirror of
https://github.com/transmission/transmission
synced 2024-12-27 01:57:52 +00:00
add tr_torrentGetFileStatus() for BentMyWookie
This commit is contained in:
parent
f8fa5dc7a4
commit
4311b160b5
2 changed files with 39 additions and 8 deletions
|
@ -1265,3 +1265,30 @@ tr_torrentSetFileDLs ( tr_torrent_t * tor,
|
||||||
|
|
||||||
tr_torrentWriterUnlock( tor );
|
tr_torrentWriterUnlock( tor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cp_status_t
|
||||||
|
tr_torrentGetFileStatus( const tr_torrent_t * tor, int fileIndex )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int isComplete;
|
||||||
|
const tr_file_t * file;
|
||||||
|
|
||||||
|
assert( tor != NULL );
|
||||||
|
assert( 0<=fileIndex );
|
||||||
|
assert( fileIndex<tor->info.fileCount );
|
||||||
|
|
||||||
|
file = &tor->info.files[fileIndex];
|
||||||
|
|
||||||
|
isComplete = TRUE;
|
||||||
|
for( i=file->firstPiece; isComplete && i<=file->lastPiece; ++i )
|
||||||
|
if( !tr_cpPieceIsComplete( tor->completion, i ) )
|
||||||
|
isComplete = FALSE;
|
||||||
|
|
||||||
|
if( isComplete )
|
||||||
|
return TR_CP_COMPLETE;
|
||||||
|
|
||||||
|
if( file->dnd )
|
||||||
|
return TR_CP_DONE;
|
||||||
|
|
||||||
|
return TR_CP_INCOMPLETE;
|
||||||
|
}
|
||||||
|
|
|
@ -246,6 +246,18 @@ void tr_torrentSetFileDLs ( tr_torrent_t * tor,
|
||||||
void tr_torrentSetFileDL( tr_torrent_t *, int file, int do_download );
|
void tr_torrentSetFileDL( tr_torrent_t *, int file, int do_download );
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
TR_CP_INCOMPLETE, /* doesn't have all the desired pieces */
|
||||||
|
TR_CP_DONE, /* has all the pieces but the DND ones */
|
||||||
|
TR_CP_COMPLETE /* has every piece */
|
||||||
|
}
|
||||||
|
cp_status_t;
|
||||||
|
|
||||||
|
cp_status_t tr_torrentGetFileStatus( const tr_torrent_t * tor,
|
||||||
|
int fileIndex );
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* tr_torrentRates
|
* tr_torrentRates
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
|
@ -534,14 +546,6 @@ struct tr_info_s
|
||||||
tr_file_t * files;
|
tr_file_t * files;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
TR_CP_INCOMPLETE, /* doesn't have all the desired pieces */
|
|
||||||
TR_CP_DONE, /* has all the pieces but the DND ones */
|
|
||||||
TR_CP_COMPLETE /* has every piece */
|
|
||||||
}
|
|
||||||
cp_status_t;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TR_STATUS_CHECK_WAIT = (1<<0), /* Waiting in queue to check files */
|
TR_STATUS_CHECK_WAIT = (1<<0), /* Waiting in queue to check files */
|
||||||
|
|
Loading…
Reference in a new issue