[packages] transmission: make scrape-paused-torrents optional
git-svn-id: svn://svn.openwrt.org/openwrt/packages@27020 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
ee70604bf2
commit
d1bb58c28b
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=transmission
|
PKG_NAME:=transmission
|
||||||
PKG_VERSION:=2.31
|
PKG_VERSION:=2.31
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
PKG_SOURCE_URL:=http://mirrors.m0k.org/transmission/files
|
PKG_SOURCE_URL:=http://mirrors.m0k.org/transmission/files
|
||||||
|
@ -60,5 +60,6 @@ config transmission
|
|||||||
option umask 18
|
option umask 18
|
||||||
option upload_slots_per_torrent 14
|
option upload_slots_per_torrent 14
|
||||||
option utp_enabled true
|
option utp_enabled true
|
||||||
|
option scrape_paused_torrents true
|
||||||
option watch_dir_enabled false
|
option watch_dir_enabled false
|
||||||
option watch_dir ''
|
option watch_dir ''
|
||||||
|
@ -65,7 +65,8 @@ start_service() {
|
|||||||
rpc_enabled rpc_port rpc_whitelist_enabled script_torrent_done_enabled \
|
rpc_enabled rpc_port rpc_whitelist_enabled script_torrent_done_enabled \
|
||||||
speed_limit_down speed_limit_down_enabled speed_limit_up \
|
speed_limit_down speed_limit_down_enabled speed_limit_up \
|
||||||
speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
|
speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
|
||||||
umask upload_slots_per_torrent utp_enabled watch_dir_enabled
|
umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \
|
||||||
|
watch_dir_enabled
|
||||||
|
|
||||||
append_params_quotes "$s" \
|
append_params_quotes "$s" \
|
||||||
blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
|
blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
|
||||||
|
131
net/transmission/patches/010-opt_scrape_paused.patch
Normal file
131
net/transmission/patches/010-opt_scrape_paused.patch
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
Index: transmission-2.31/libtransmission/announcer.c
|
||||||
|
===================================================================
|
||||||
|
--- transmission-2.31.orig/libtransmission/announcer.c 2011-05-23 13:34:54.000000000 +0200
|
||||||
|
+++ transmission-2.31/libtransmission/announcer.c 2011-05-23 13:48:03.000000000 +0200
|
||||||
|
@@ -1433,11 +1433,13 @@
|
||||||
|
tor = NULL;
|
||||||
|
while(( tor = tr_torrentNext( announcer->session, tor ))) {
|
||||||
|
struct tr_torrent_tiers * tt = tor->tiers;
|
||||||
|
+ const bool paused = !tor->isRunning;
|
||||||
|
+ const bool scrapePaused = tr_sessionGetScrapePaused( announcer->session );
|
||||||
|
for( i=0; tt && i<tt->tier_count; ++i ) {
|
||||||
|
tr_tier * tier = &tt->tiers[i];
|
||||||
|
if( tierNeedsToAnnounce( tier, now ) )
|
||||||
|
tr_ptrArrayAppend( &announceMe, tier );
|
||||||
|
- else if( tierNeedsToScrape( tier, now ) )
|
||||||
|
+ else if( tierNeedsToScrape( tier, now ) && ( !paused || scrapePaused ) )
|
||||||
|
tr_ptrArrayAppend( &scrapeMe, tier );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1505,6 +1507,7 @@
|
||||||
|
tr_tracker_stat * ret;
|
||||||
|
struct tr_torrent_tiers * tt;
|
||||||
|
const time_t now = tr_time( );
|
||||||
|
+ bool scrapePaused;
|
||||||
|
|
||||||
|
assert( tr_isTorrent( torrent ) );
|
||||||
|
assert( tr_torrentIsLocked( torrent ) );
|
||||||
|
@@ -1515,6 +1518,8 @@
|
||||||
|
*setmeTrackerCount = tt->tracker_count;
|
||||||
|
ret = tr_new0( tr_tracker_stat, tt->tracker_count );
|
||||||
|
|
||||||
|
+ scrapePaused = tr_sessionGetScrapePaused( torrent->session );
|
||||||
|
+
|
||||||
|
/* populate the stats */
|
||||||
|
for( i=0; i<tt->tier_count; ++i )
|
||||||
|
{
|
||||||
|
@@ -1559,7 +1564,7 @@
|
||||||
|
|
||||||
|
if( tier->isScraping )
|
||||||
|
st->scrapeState = TR_TRACKER_ACTIVE;
|
||||||
|
- else if( !tier->scrapeAt )
|
||||||
|
+ else if( !tier->scrapeAt || ( !torrent->isRunning && !scrapePaused ) )
|
||||||
|
st->scrapeState = TR_TRACKER_INACTIVE;
|
||||||
|
else if( tier->scrapeAt > now )
|
||||||
|
{
|
||||||
|
Index: transmission-2.31/libtransmission/session.c
|
||||||
|
===================================================================
|
||||||
|
--- transmission-2.31.orig/libtransmission/session.c 2011-05-23 13:41:05.000000000 +0200
|
||||||
|
+++ transmission-2.31/libtransmission/session.c 2011-05-23 13:50:23.000000000 +0200
|
||||||
|
@@ -359,6 +359,7 @@
|
||||||
|
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4, TR_DEFAULT_BIND_ADDRESS_IPV4 );
|
||||||
|
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6, TR_DEFAULT_BIND_ADDRESS_IPV6 );
|
||||||
|
tr_bencDictAddBool( d, TR_PREFS_KEY_START, true );
|
||||||
|
+ tr_bencDictAddBool( d, TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS, true );
|
||||||
|
tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -424,6 +425,7 @@
|
||||||
|
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV4, tr_address_to_string( &s->public_ipv4->addr ) );
|
||||||
|
tr_bencDictAddStr ( d, TR_PREFS_KEY_BIND_ADDRESS_IPV6, tr_address_to_string( &s->public_ipv6->addr ) );
|
||||||
|
tr_bencDictAddBool( d, TR_PREFS_KEY_START, !tr_sessionGetPaused( s ) );
|
||||||
|
+ tr_bencDictAddBool( d, TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS, tr_sessionGetScrapePaused( s ) );
|
||||||
|
tr_bencDictAddBool( d, TR_PREFS_KEY_TRASH_ORIGINAL, tr_sessionGetDeleteSource( s ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -776,6 +778,8 @@
|
||||||
|
tr_blocklistSetURL( session, str );
|
||||||
|
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_START, &boolVal ) )
|
||||||
|
tr_sessionSetPaused( session, !boolVal );
|
||||||
|
+ if( tr_bencDictFindBool( settings, TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS, &boolVal ) )
|
||||||
|
+ tr_sessionSetScrapePaused( session, boolVal );
|
||||||
|
if( tr_bencDictFindBool( settings, TR_PREFS_KEY_TRASH_ORIGINAL, &boolVal) )
|
||||||
|
tr_sessionSetDeleteSource( session, boolVal );
|
||||||
|
|
||||||
|
@@ -1636,6 +1640,22 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+tr_sessionSetScrapePaused( tr_session * session, bool enable )
|
||||||
|
+{
|
||||||
|
+ assert( tr_isSession( session ) );
|
||||||
|
+
|
||||||
|
+ session->scrapePausedTorrents = enable;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+bool
|
||||||
|
+tr_sessionGetScrapePaused( const tr_session * session )
|
||||||
|
+{
|
||||||
|
+ assert( tr_isSession( session ) );
|
||||||
|
+
|
||||||
|
+ return session->scrapePausedTorrents;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
tr_sessionSetDeleteSource( tr_session * session, bool deleteSource )
|
||||||
|
{
|
||||||
|
assert( tr_isSession( session ) );
|
||||||
|
Index: transmission-2.31/libtransmission/session.h
|
||||||
|
===================================================================
|
||||||
|
--- transmission-2.31.orig/libtransmission/session.h 2011-05-23 13:45:30.000000000 +0200
|
||||||
|
+++ transmission-2.31/libtransmission/session.h 2011-05-23 13:46:12.000000000 +0200
|
||||||
|
@@ -106,6 +106,7 @@
|
||||||
|
bool isIdleLimited;
|
||||||
|
bool isIncompleteDirEnabled;
|
||||||
|
bool pauseAddedTorrent;
|
||||||
|
+ bool scrapePausedTorrents;
|
||||||
|
bool deleteSourceTorrent;
|
||||||
|
|
||||||
|
tr_benc removedTorrents;
|
||||||
|
Index: transmission-2.31/libtransmission/transmission.h
|
||||||
|
===================================================================
|
||||||
|
--- transmission-2.31.orig/libtransmission/transmission.h 2011-05-23 13:48:11.000000000 +0200
|
||||||
|
+++ transmission-2.31/libtransmission/transmission.h 2011-05-23 13:49:15.000000000 +0200
|
||||||
|
@@ -213,6 +213,7 @@
|
||||||
|
#define TR_PREFS_KEY_UMASK "umask"
|
||||||
|
#define TR_PREFS_KEY_UPLOAD_SLOTS_PER_TORRENT "upload-slots-per-torrent"
|
||||||
|
#define TR_PREFS_KEY_START "start-added-torrents"
|
||||||
|
+#define TR_PREFS_KEY_SCRAPE_PAUSED_TORRENTS "scrape-paused-torrents"
|
||||||
|
#define TR_PREFS_KEY_TRASH_ORIGINAL "trash-original-torrent-files"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -731,6 +732,9 @@
|
||||||
|
void tr_sessionSetPaused ( tr_session *, bool isPaused );
|
||||||
|
bool tr_sessionGetPaused ( const tr_session * );
|
||||||
|
|
||||||
|
+void tr_sessionSetScrapePaused ( tr_session *, bool enable );
|
||||||
|
+bool tr_sessionGetScrapePaused ( const tr_session * );
|
||||||
|
+
|
||||||
|
void tr_sessionSetDeleteSource ( tr_session *, bool deleteSource );
|
||||||
|
bool tr_sessionGetDeleteSource ( const tr_session * );
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user