1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-14 03:52:22 -05:00

Added per-provider options search mode and search fallback.

Search mode allows you to choose season packs only or episodes only which controls how backlogs search for data.

Search fallback if selected will attempt a 2nd search this time using the alternative search mode to see if it can get results if the previous attempt failed.

Provider settings are now read and stored dynamically instead of always having to retrieve them by there static names, this will allow for dropping in new provider modules easier to intergrate with existing options already present.

Fixed search code to not perform dupe searches by mistake.

Cache stores a list of shows we have rejected so that next time around we don't have to process them to know we don't like em.
This commit is contained in:
echel0n 2014-05-16 22:23:11 -07:00
parent 816a3d9572
commit e96035ff4f
25 changed files with 754 additions and 934 deletions

View File

@ -115,8 +115,8 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
<span class="component-title jumbo">Configure Provider:</span> <span class="component-title jumbo">Configure Provider:</span>
<span class="component-desc"> <span class="component-desc">
#set $provider_config_list = [] #set $provider_config_list = []
#for $cur_provider in ("thepiratebay", "tvtorrents", "btn", "torrentleech", "iptorrents", "omgwtfnzbs", "kickasstorrents", "sceneaccess", "hdbits", "nextgen", "speedcd"): #for $curProvider in $sickbeard.providers.sortedProviderList():
#set $cur_provider_obj = $sickbeard.providers.getProviderClass($cur_provider) #set $cur_provider_obj = $sickbeard.providers.getProviderClass($curProvider.getID())
#if $cur_provider_obj.providerType == $GenericProvider.NZB and not $sickbeard.USE_NZBS: #if $cur_provider_obj.providerType == $GenericProvider.NZB and not $sickbeard.USE_NZBS:
#continue #continue
#elif $cur_provider_obj.providerType == $GenericProvider.TORRENT and not $sickbeard.USE_TORRENTS: #elif $cur_provider_obj.providerType == $GenericProvider.TORRENT and not $sickbeard.USE_TORRENTS:
@ -140,8 +140,9 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
<!-- start div for editing providers //--> <!-- start div for editing providers //-->
#for $curNewznabProvider in [$curProvider for $curProvider in $sickbeard.newznabProviderList if $curProvider.default and $curProvider.needs_auth]: #for $curNewznabProvider in [$curProvider for $curProvider in $sickbeard.newznabProviderList]:
<div class="providerDiv" id="${curNewznabProvider.getID()}Div"> <div class="providerDiv" id="${curNewznabProvider.getID()}Div">
#if $curProvider.default and $curProvider.needs_auth
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <label class="clearfix">
<span class="component-title">URL:</span> <span class="component-title">URL:</span>
@ -154,6 +155,34 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
<input class="component-desc newznab_key" type="text" id="${curNewznabProvider.getID()}_hash" value="$curNewznabProvider.key" newznab_name="${curNewznabProvider.getID()}_hash" size="40" /> <input class="component-desc newznab_key" type="text" id="${curNewznabProvider.getID()}_hash" value="$curNewznabProvider.key" newznab_name="${curNewznabProvider.getID()}_hash" size="40" />
</label> </label>
</div> </div>
#end if
#if $hasattr($curNewznabProvider, 'search_fallback'):
<div class="field-pair">
<input type="checkbox" name="${curNewznabProvider.getID()}_search_fallback" id="${curNewznabProvider.getID()}_search_fallback" #if $curNewznabProvider.search_fallback then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="${curNewznabProvider.getID()}_search_fallback">
<span class="component-title">Search Fallback</span>
<span class="component-desc">This will restart the search using the alternative method from Search Mode if first attempt fails to return any results to snatch.</span>
</label>
</div>
#end if
#if $hasattr($curNewznabProvider, 'search_mode'):
<div class="field-pair">
<label class="nocheck clearfix">
<span class="component-title">Search Mode</span>
<span class="component-desc">
<input type="radio" name="${curNewznabProvider.getID()}_search_mode" id="${curNewznabProvider.getID()}_search_mode_sponly" value="sponly" class="radio" #if $curNewznabProvider.search_mode=="sponly" then "checked=\"checked\"" else ""# />Season Packs ONLY!<br />
</span>
</label>
<label class="nocheck clearfix">
<span class="component-title"></span>
<span class="component-desc">
<input type="radio" name="${curNewznabProvider.getID()}_search_mode" id="${curNewznabProvider.getID()}_search_mode_eponly" value="eponly" class="radio" #if $curNewznabProvider.search_mode=="eponly" then "checked=\"checked\"" else ""# />Episodes ONLY!<br />
</span>
</label>
</div>
#end if
</div> </div>
#end for #end for
@ -172,304 +201,171 @@ var show_nzb_providers = #if $sickbeard.USE_NZBS then "true" else "false"#;
</div> </div>
</div><!-- /omgwtfnzbsDiv //--> </div><!-- /omgwtfnzbsDiv //-->
<div class="providerDiv" id="ezrssDiv"> #for $curTorrentProvider in [$curProvider for $curProvider in $sickbeard.providers.sortedProviderList() if $curProvider.providerType == $GenericProvider.TORRENT]:
<div class="providerDiv" id="${curTorrentProvider.getID()}Div">
#if $hasattr($curTorrentProvider, 'api_key'):
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <label class="clearfix">
<span class="component-title" id="ezrss_ratio_desc">Seed Ratio:</span> <span class="component-title">Api Key:</span>
<input type="text" name="ezrss_ratio" id="ezrss_ratio" value="$sickbeard.EZRSS_RATIO" size="40" /> <input class="component-desc" type="text" name="${curTorrentProvider.getID()}_api_key" id="${curTorrentProvider.getID()}_api_key" value="$curTorrentProvider.api_key" size="40" />
</label> </label>
</div> </div>
</div> #end if
<div class="providerDiv" id="tvtorrentsDiv"> #if $hasattr($curTorrentProvider, 'digest'):
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <label class="clearfix">
<span class="component-title">Digest:</span> <span class="component-title">Digest:</span>
<input class="component-desc" type="text" name="tvtorrents_digest" value="$sickbeard.TVTORRENTS_DIGEST" size="40" /> <input class="component-desc" type="text" name="${curTorrentProvider.getID()}_digest" id="${curTorrentProvider.getID()}_digest" value="$curTorrentProvider.digest" size="40" />
</label> </label>
</div> </div>
#end if
#if $hasattr($curTorrentProvider, 'hash'):
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <label class="clearfix">
<span class="component-title">Hash:</span> <span class="component-title">Hash:</span>
<input class="component-desc" type="text" name="tvtorrents_hash" value="$sickbeard.TVTORRENTS_HASH" size="40" /> <input class="component-desc" type="text" name="${curTorrentProvider.getID()}_hash" id="${curTorrentProvider.getID()}_hash" value="$curTorrentProvider.hash" size="40" />
</label> </label>
</div> </div>
#end if
<div class="field-pair"> #if $hasattr($curTorrentProvider, 'options'):
<div style="width: 340px; padding-bottom: 10px !important;">
<input type="hidden" id="tvtorrents_option_string" />
<fieldset style="display: block; border-width: 1px !important; border-radius: 5px !important; border-color: #D0D0D0 !important; border-style: solid !important;">
<legend id="seed_options">Advanced Options</legend>
<div class="field-pair" style="margin-top: -2px !important;">
<label class="clearfix" > <label class="clearfix" >
<span class="component-title" id="tvtorrents_ratio_desc">Seed Ratio:</span> <span class="component-title" style="width: 130px !important;">Seeding Goal Ratio(%):</span>
<input type="text" name="tvtorrents_ratio" id="tvtorrents_ratio" value="$sickbeard.TVTORRENTS_RATIO" size="40" /> <input class="seed_option" type="text" id="tvtorrents_seed_ratio" size="5" style="margin-left: -5px !important;"/>
</label> </label>
</div> </div>
</div> <div class="field-pair" style="margin-top: -10px !important;">
<div class="providerDiv" id="thepiratebayDiv">
<div class="field-pair">
<label class="clearfix"> <label class="clearfix">
<span class="component-title" id="thepiratebay_ratio_desc">Seed Ratio:</span> <span class="component-title" style="width: 130px !important;">Seeding Goal Time(h):</span>
<input type="text" name="thepiratebay_ratio" id="thepiratebay_ratio" value="$sickbeard.THEPIRATEBAY_RATIO" size="40" /> <input class="seed_option" type="text" id="tvtorrents_seed_time" size="5" style="margin-left: -5px !important;" />
</label> </label>
</div> </div>
<div style="display: block; text-align: center;margin-top: -10px !important;" class="float-left">
<div class="field-pair">
<input type="checkbox" class="enabler" name="thepiratebay_proxy" id="thepiratebay_proxy" #if $sickbeard.THEPIRATEBAY_PROXY then "checked=\"checked\"" else ""#/>
<label class="clearfix"> <label class="clearfix">
<span class="component-title">Access TPB via Proxy</span> <span class="component-title" style="margin-left: -49px !important; width: 201px !important;">Process Method:</span>
<select class="seed_option" id="tvtorrents_process_method" class="input-medium" >
#set $process_method_text = {'': "", 'copy': "Copy", 'move': "Move", 'hardlink': "Hard Link", 'symlink' : "Symbolic Link"}
#for $curAction in ('', 'copy', 'move', 'hardlink', 'symlink'):
#set $process_method = ""
<option class="seed_option" value="$curAction" $process_method>$process_method_text[$curAction]</option>
#end for
</select>
</label>
</div>
</fieldset>
</div>
#end if
#if $hasattr($curTorrentProvider, 'username'):
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Username:</span>
<input class="component-desc" type="text" name="${curTorrentProvider.getID()}_username" id="${curTorrentProvider.getID()}_username" value="$curTorrentProvider.username" size="40" />
</label>
</div>
#end if
#if $hasattr($curTorrentProvider, 'password'):
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="${curTorrentProvider.getID()}_password" id="${curTorrentProvider.getID()}_password" value="$curTorrentProvider.password" size="40" />
</label>
</div>
#end if
#if $hasattr($curTorrentProvider, 'ratio'):
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="${curTorrentProvider.getID()}_ratio_desc">Seed Ratio:</span>
<input type="text" name="${curTorrentProvider.getID()}_ratio" id="${curTorrentProvider.getID()}_ratio" value="$curTorrentProvider.ratio" size="40" />
</label>
</div>
#end if
#if $hasattr($curTorrentProvider, 'proxy'):
<div class="field-pair">
<input type="checkbox" class="enabler" name="${curTorrentProvider.getID()}_proxy" id="${curTorrentProvider.getID()}_proxy" #if $curTorrentProvider.proxy then "checked=\"checked\"" else ""#/>
<label class="clearfix">
<span class="component-title">Access Provider via Proxy</span>
<span class="component-desc">To bypass Country Blocking Mechanism</span> <span class="component-desc">To bypass Country Blocking Mechanism</span>
</label> </label>
</div> </div>
#end if
<div class="field-pair content_thepiratebay_proxy" id="content_thepiratebay_proxy"> #if $hasattr($curTorrentProvider, 'proxy_url'):
<div class="field-pair content_${curTorrentProvider.getID()}_proxy" id="content_${curTorrentProvider.getID()}_proxy">
<label class="nocheck clearfix"> <label class="nocheck clearfix">
<span class="component-title">Proxy URL:</span> <span class="component-title">Proxy URL:</span>
<span class="component-desc"> <span class="component-desc">
<select name="thepiratebay_proxy_url" id="thepiratebay_proxy_url"> <select name="${curTorrentProvider.getID()}_proxy_url" id="${curTorrentProvider.getID()}_proxy_url">
#for $i in $thepiratebay.proxy_dict.keys(): #for $i in $curTorrentProvider.proxy_dict.keys():
<option value="$thepiratebay.proxy_dict[$i]" #if $thepiratebay.proxy_dict[$i] == $sickbeard.THEPIRATEBAY_PROXY_URL then "selected=\"selected\"" else ""#>$i</option> <option value="$curTorrentProvider.proxy_dict[$i]" #if $curTorrentProvider.proxy_dict[$i] == $curTorrentProvider.proxy_url then "selected=\"selected\"" else ""#>$i</option>
#end for #end for
</select> </select>
</span> </span>
</label> </label>
</div> </div>
#end if
#if $hasattr($curTorrentProvider, 'confirmed'):
<div class="field-pair"> <div class="field-pair">
<input type="checkbox" name="thepiratebay_trusted" id="thepiratebay_trusted" #if $sickbeard.THEPIRATEBAY_TRUSTED then "checked=\"checked\"" else ""#/> <input type="checkbox" name="${curTorrentProvider.getID()}_confirmed" id="${curTorrentProvider.getID()}_confirmed" #if $curTorrentProvider.confirmed then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="thepiratebay_trusted"> <label class="clearfix" for="${curTorrentProvider.getID()}_confirmed">
<span class="component-title">Trusted Download</span> <span class="component-title">Confirmed Download</span>
<span class="component-desc">Download torrent only from trusted uploaders?</span> <span class="component-desc">Download torrent only from trusted/verified uploaders?</span>
</label> </label>
</div> </div>
</div> #end if
<div class="providerDiv" id="kickasstorrentsDiv"> #if $hasattr($curTorrentProvider, 'freeleech'):
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <input type="checkbox" name="${curTorrentProvider.getID()}_freeleech" id="${curTorrentProvider.getID()}_freeleech" #if $curTorrentProvider.freeleech then "checked=\"checked\"" else ""#/>
<span class="component-title" id="kat_ratio_desc">Seed Ratio:</span> <label class="clearfix" for="${curTorrentProvider.getID()}_freeleech">
<input type="text" name="kat_ratio" id="kat_ratio" value="$sickbeard.KAT_RATIO" size="40" />
</label>
</div>
<div class="field-pair">
<input type="checkbox" name="kat_verified" id="kat_verified" #if $sickbeard.KAT_VERIFIED then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="kat_verified">
<span class="component-title">Verified Only</span>
<span class="component-desc">Download only verified torrent?</span>
</label>
</div>
</div>
<div class="providerDiv" id="publichdDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="publichd_ratio_desc">Seed Ratio:</span>
<input type="text" name="publichd_ratio" id="publichd_ratio" value="$sickbeard.PUBLICHD_RATIO" size="40" />
</label>
</div>
</div>
<div class="providerDiv btn" id="btnDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Api Key:</span>
<input class="component-desc" type="text" name="btn_api_key" value="$sickbeard.BTN_API_KEY" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="btn_ratio_desc">Seed Ratio:</span>
<input type="text" name="btn_ratio" id="btn_ratio" value="$sickbeard.BTN_RATIO" size="40" />
</label>
</div>
</div>
<div class="providerDiv" id="torrentleechDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Username:</span>
<input class="component-desc" type="text" name="torrentleech_username" value="$sickbeard.TORRENTLEECH_USERNAME" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="torrentleech_password" value="$sickbeard.TORRENTLEECH_PASSWORD" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="torrentleech_ratio_desc">Seed Ratio:</span>
<input type="text" name="torrentleech_ratio" id="torrentleech_ratio" value="$sickbeard.TORRENTLEECH_RATIO" size="40" />
</label>
</div>
</div>
<div class="providerDiv" id="iptorrentsDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Username:</span>
<input class="component-desc" type="text" name="iptorrents_username" value="$sickbeard.IPTORRENTS_USERNAME" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="iptorrents_password" value="$sickbeard.IPTORRENTS_PASSWORD" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="iptorrents_ratio_desc">Seed Ratio:</span>
<input type="text" name="iptorrents_ratio" id="iptorrents_ratio" value="$sickbeard.IPTORRENTS_RATIO" size="40" />
</label>
</div>
<div class="field-pair">
<input type="checkbox" name="iptorrents_freeleech" id="iptorrents_freeleech" #if $sickbeard.IPTORRENTS_FREELEECH then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="iptorrents_freeleech">
<span class="component-title">FreeLeech</span> <span class="component-title">FreeLeech</span>
<span class="component-desc">This will only download <b>[FreeLeech]</b> torrents.</span> <span class="component-desc">This will only download <b>[FreeLeech]</b> torrents.</span>
</label> </label>
</div> </div>
</div><!-- /iptorrentsDiv //--> #end if
<div class="providerDiv" id="sceneaccessDiv"> #if $hasattr($curTorrentProvider, 'search_fallback'):
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <input type="checkbox" name="${curTorrentProvider.getID()}_search_fallback" id="${curTorrentProvider.getID()}_search_fallback" #if $curTorrentProvider.search_fallback then "checked=\"checked\"" else ""#/>
<span class="component-title">Username:</span> <label class="clearfix" for="${curTorrentProvider.getID()}_search_fallback">
<input class="component-desc" type="text" name="scc_username" value="$sickbeard.SCC_USERNAME" size="40" /> <span class="component-title">Search Fallback</span>
<span class="component-desc">This will restart the search using the alternative method from Search Mode if first attempt fails to return any results to snatch.</span>
</label> </label>
</div> </div>
<div class="field-pair"> #end if
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="scc_password" value="$sickbeard.SCC_PASSWORD" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="scc_ratio_desc">Seed Ratio:</span>
<input type="text" name="scc_ratio" id="scc_ratio" value="$sickbeard.SCC_RATIO" size="40" />
</label>
</div>
</div><!-- /sceneaccessDiv //-->
<div class="providerDiv" id="hdtorrentsDiv"> #if $hasattr($curTorrentProvider, 'search_mode'):
<div class="field-pair"> <div class="field-pair">
<label class="clearfix"> <label class="nocheck clearfix">
<span class="component-title">Username:</span> <span class="component-title">Search Mode</span>
<input class="component-desc" type="text" name="hdtorrents_username" value="$sickbeard.HDTORRENTS_USERNAME" size="40" /> <span class="component-desc">
<input type="radio" name="${curTorrentProvider.getID()}_search_mode" id="${curTorrentProvider.getID()}_search_mode_sponly" value="sponly" class="radio" #if $curTorrentProvider.search_mode=="sponly" then "checked=\"checked\"" else ""# />Season Packs ONLY!<br />
</span>
</label>
<label class="nocheck clearfix">
<span class="component-title"></span>
<span class="component-desc">
<input type="radio" name="${curTorrentProvider.getID()}_search_mode" id="${curTorrentProvider.getID()}_search_mode_eponly" value="eponly" class="radio" #if $curTorrentProvider.search_mode=="eponly" then "checked=\"checked\"" else ""# />Episodes ONLY!<br />
</span>
</label> </label>
</div> </div>
<div class="field-pair"> #end if
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="hdtorrents_password" value="$sickbeard.HDTORRENTS_PASSWORD" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="hdtorrents_ratio_desc">Seed Ratio:</span>
<input type="text" name="hdtorrents_ratio" id="hdtorrents_ratio" value="$sickbeard.HDTORRENTS_RATIO" size="40" />
</label>
</div>
</div><!-- /sceneaccessDiv //-->
<div class="providerDiv" id="torrentdayDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Username:</span>
<input class="component-desc" type="text" name="torrentday_username" value="$sickbeard.TORRENTDAY_USERNAME" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="torrentday_password" value="$sickbeard.TORRENTDAY_PASSWORD" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="torrentday_ratio_desc">Seed Ratio:</span>
<input type="text" name="torrentday_ratio" id="torrentday_ratio" value="$sickbeard.TORRENTDAY_RATIO" size="40" />
</label>
</div>
<div class="field-pair">
<input type="checkbox" name="torrentday_freeleech" id="torrentday_freeleech" #if $sickbeard.TORRENTDAY_FREELEECH then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="torrentday_freeleech">
<span class="component-title">FreeLeech</span>
<span class="component-desc">This will only download <b>[FreeLeech]</b> torrents.</span>
</label>
</div>
</div><!-- /torrentsDayDiv //-->
<div class="providerDiv" id="nextgenDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Username:</span>
<input class="component-desc" type="text" name="nextgen_username" value="$sickbeard.NEXTGEN_USERNAME" size="40" />
</label>
</div> </div>
<div class="field-pair"> #end for
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="nextgen_password" value="$sickbeard.NEXTGEN_PASSWORD" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="nextgen_ratio_desc">Seed Ratio:</span>
<input type="text" name="nextgen_ratio" id="nextgen_ratio" value="$sickbeard.NEXTGEN_RATIO" size="40" />
</label>
</div>
</div><!-- /nextgenDiv //-->
<div class="providerDiv" id="hdbitsDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Username:</span>
<input class="component-desc" type="text" name="hdbits_username" value="$sickbeard.HDBITS_USERNAME" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Passkey:</span>
<input class="component-desc" type="text" name="hdbits_passkey" value="$sickbeard.HDBITS_PASSKEY" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="hdbits_ratio_desc">Seed Ratio:</span>
<input type="text" name="hdbits_ratio" id="hdbits_ratio" value="$sickbeard.HDBITS_RATIO" size="40" />
</label>
</div>
</div><!-- /hdbitsDiv //-->
<div class="providerDiv" id="speedcdDiv">
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Username:</span>
<input class="component-desc" type="text" name="speedcd_username" value="$sickbeard.SPEEDCD_USERNAME" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title">Password:</span>
<input class="component-desc" type="password" name="speedcd_password" value="$sickbeard.SPEEDCD_PASSWORD" size="40" />
</label>
</div>
<div class="field-pair">
<label class="clearfix">
<span class="component-title" id="speedcd_ratio_desc">Seed Ratio:</span>
<input type="text" name="speedcd_ratio" id="speedcd_ratio" value="$sickbeard.SPEEDCD_RATIO" size="40" />
</label>
</div>
<div class="field-pair">
<input type="checkbox" name="speedcd_freeleech" id="speedcd_freeleech" #if $sickbeard.SPEEDCD_FREELEECH then "checked=\"checked\"" else ""#/>
<label class="clearfix" for="iptorrents_freeleech">
<span class="component-title">FreeLeech</span>
<span class="component-desc">This will only download <b>[FreeLeech]</b> torrents.</span>
</label>
</div>
</div><!-- /speedcdDiv //-->
<!-- end div for editing providers --> <!-- end div for editing providers -->

View File

@ -63,10 +63,12 @@ $(document).ready(function(){
} }
$.fn.updateProvider = function (id, url, key) { $.fn.updateProvider = function (id, url, key, search_mode, search_fallback) {
newznabProviders[id][1][1] = url; newznabProviders[id][1][1] = url;
newznabProviders[id][1][2] = key; newznabProviders[id][1][2] = key;
newznabProviders[id][1][3] = search_mode;
newznabProviders[id][1][4] = search_fallback;
$(this).populateNewznabSection(); $(this).populateNewznabSection();
@ -297,8 +299,10 @@ $(document).ready(function(){
var url = $('#'+provider_id+'_url').val(); var url = $('#'+provider_id+'_url').val();
var key = $(this).val(); var key = $(this).val();
var search_mode = $('#'+provider_id+'_search_mode').val();
var search_fallback = $('#'+provider_id+'_search_fallback').val();
$(this).updateProvider(provider_id, url, key); $(this).updateProvider(provider_id, url, key, search_mode, search_fallback);
}); });
@ -311,8 +315,10 @@ $(document).ready(function(){
var url = $('#newznab_url').val(); var url = $('#newznab_url').val();
var key = $('#newznab_key').val(); var key = $('#newznab_key').val();
var search_mode = 'eponly';
var search_fallback = 0;
$(this).updateProvider(selectedProvider, url, key); $(this).updateProvider(selectedProvider, url, key, search_mode, search_fallback);
}); });

View File

@ -30,9 +30,11 @@ from threading import Lock
# apparently py2exe won't build these unless they're imported somewhere # apparently py2exe won't build these unless they're imported somewhere
from sickbeard import providers, metadata, config from sickbeard import providers, metadata, config
from sickbeard.providers.generic import GenericProvider
from providers import ezrss, tvtorrents, btn, newznab, womble, thepiratebay, torrentleech, kat, publichd, iptorrents, \ from providers import ezrss, tvtorrents, btn, newznab, womble, thepiratebay, torrentleech, kat, publichd, iptorrents, \
omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, nextgen, speedcd omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, nextgen, speedcd
from sickbeard.config import CheckSection, check_setting_int, check_setting_str, check_setting_float, ConfigMigrator, naming_ep_type from sickbeard.config import CheckSection, check_setting_int, check_setting_str, check_setting_float, ConfigMigrator, \
naming_ep_type
from sickbeard import searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, \ from sickbeard import searchBacklog, showUpdater, versionChecker, properFinder, autoPostProcesser, \
subtitles, traktWatchListChecker subtitles, traktWatchListChecker
from sickbeard import helpers, db, exceptions, show_queue, search_queue, scheduler, show_name_helpers from sickbeard import helpers, db, exceptions, show_queue, search_queue, scheduler, show_name_helpers
@ -191,83 +193,6 @@ MIN_UPDATE_FREQUENCY = 1
DEFAULT_SEARCH_FREQUENCY = 40 DEFAULT_SEARCH_FREQUENCY = 40
DEFAULT_UPDATE_FREQUENCY = 12 DEFAULT_UPDATE_FREQUENCY = 12
EZRSS = False
EZRSS_RATIO = None
TVTORRENTS = False
TVTORRENTS_DIGEST = None
TVTORRENTS_HASH = None
TVTORRENTS_RATIO = None
BTN = False
BTN_API_KEY = None
BTN_RATIO = None
NEWZNAB_DATA = None
THEPIRATEBAY = False
THEPIRATEBAY_RATIO = None
THEPIRATEBAY_TRUSTED = False
THEPIRATEBAY_PROXY = False
THEPIRATEBAY_PROXY_URL = None
THEPIRATEBAY_BLACKLIST = None
TORRENTLEECH = False
TORRENTLEECH_KEY = None
TORRENTLEECH_USERNAME = None
TORRENTLEECH_PASSWORD = None
TORRENTLEECH_RATIO = None
IPTORRENTS = False
IPTORRENTS_USERNAME = None
IPTORRENTS_PASSWORD = None
IPTORRENTS_RATIO = None
IPTORRENTS_FREELEECH = False
NEXTGEN = False
NEXTGEN_USERNAME = None
NEXTGEN_PASSWORD = None
NEXTGEN_RATIO = None
NEXTGEN_FREELEECH = False
KAT = None
KAT_RATIO = None
KAT_VERIFIED = False
PUBLICHD = None
PUBLICHD_RATIO = None
SCC = False
SCC_USERNAME = None
SCC_PASSWORD = None
SCC_RATIO = None
HDTORRENTS = False
HDTORRENTS_USERNAME = None
HDTORRENTS_PASSWORD = None
HDTORRENTS_RATIO = None
HDTORRENTS_UID = None
HDTORRENTS_HASH = None
TORRENTDAY = None
TORRENTDAY_USERNAME = None
TORRENTDAY_PASSWORD = None
TORRENTDAY_RATIO = None
TORRENTDAY_UID = None
TORRENTDAY_HASH = None
TORRENTDAY_FREELEECH = None
HDBITS = False
HDBITS_USERNAME = None
HDBITS_PASSKEY = None
HDBITS_RATIO = None
SPEEDCD = False
SPEEDCD_USERNAME = None
SPEEDCD_PASSWORD = None
SPEEDCD_RATIO = None
SPEEDCD_FREELEECH = None
ADD_SHOWS_WO_DIR = None ADD_SHOWS_WO_DIR = None
CREATE_MISSING_SHOW_DIRS = None CREATE_MISSING_SHOW_DIRS = None
RENAME_EPISODES = False RENAME_EPISODES = False
@ -502,12 +427,7 @@ def initialize(consoleLogging=True):
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \ USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, \ PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \ showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, EZRSS, TVTORRENTS, TVTORRENTS_DIGEST, TVTORRENTS_HASH, TVTORRENTS_OPTIONS, BTN, BTN_API_KEY, BTN_OPTIONS, \ NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH,\
THEPIRATEBAY, THEPIRATEBAY_TRUSTED, THEPIRATEBAY_PROXY, THEPIRATEBAY_PROXY_URL, THEPIRATEBAY_BLACKLIST, THEPIRATEBAY_OPTIONS, TORRENTLEECH, TORRENTLEECH_USERNAME, TORRENTLEECH_PASSWORD, TORRENTLEECH_OPTIONS, \
IPTORRENTS, IPTORRENTS_USERNAME, IPTORRENTS_PASSWORD, IPTORRENTS_FREELEECH, IPTORRENTS_OPTIONS, KAT, KAT_VERIFIED, KAT_OPTIONS, PUBLICHD, PUBLICHD_OPTIONS, SCC, SCC_USERNAME, SCC_PASSWORD, SCC_OPTIONS, HDTORRENTS, HDTORRENTS_USERNAME, HDTORRENTS_PASSWORD, HDTORRENTS_UID, HDTORRENTS_HASH, HDTORRENTS_OPTIONS, TORRENTDAY, TORRENTDAY_USERNAME, TORRENTDAY_PASSWORD, TORRENTDAY_UID, TORRENTDAY_HASH, TORRENTDAY_FREELEECH, TORRENTDAY_OPTIONS, \
HDBITS, HDBITS_USERNAME, HDBITS_PASSKEY, HDBITS_OPTIONS, TORRENT_DIR, USENET_RETENTION, SOCKET_TIMEOUT, RSSUPDATE_FREQUENCY, DEFAULT_SEARCH_FREQUENCY, BACKLOG_FREQUENCY, BACKLOG_STARTUP, INDEXER_DEFAULT, RSSUPDATE_STARTUP, \
NEXTGEN, NEXTGEN_USERNAME, NEXTGEN_PASSWORD, NEXTGEN_FREELEECH, NEXTGEN_OPTIONS, SPEEDCD, SPEEDCD_USERNAME, SPEEDCD_PASSWORD, SPEEDCD_FREELEECH, \
EZRSS_RATIO, TVTORRENTS_RATIO, BTN_RATIO, THEPIRATEBAY_RATIO, TORRENTLEECH_RATIO, IPTORRENTS_RATIO, KAT_RATIO, PUBLICHD_RATIO, TORRENTDAY_RATIO, SCC_RATIO, HDTORRENTS_RATIO, HDBITS_RATIO, NEXTGEN_RATIO, SPEEDCD_RATIO, \
QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, \ QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, \
GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, \ GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, \
USE_GROWL, GROWL_HOST, GROWL_PASSWORD, USE_PROWL, PROWL_NOTIFY_ONSNATCH, PROWL_NOTIFY_ONDOWNLOAD, PROWL_NOTIFY_ONSUBTITLEDOWNLOAD, PROWL_API, PROWL_PRIORITY, PROG_DIR, \ USE_GROWL, GROWL_HOST, GROWL_PASSWORD, USE_PROWL, PROWL_NOTIFY_ONSNATCH, PROWL_NOTIFY_ONDOWNLOAD, PROWL_NOTIFY_ONSUBTITLEDOWNLOAD, PROWL_API, PROWL_PRIORITY, PROG_DIR, \
@ -709,89 +629,6 @@ def initialize(consoleLogging=True):
CREATE_MISSING_SHOW_DIRS = check_setting_int(CFG, 'General', 'create_missing_show_dirs', 0) CREATE_MISSING_SHOW_DIRS = check_setting_int(CFG, 'General', 'create_missing_show_dirs', 0)
ADD_SHOWS_WO_DIR = check_setting_int(CFG, 'General', 'add_shows_wo_dir', 0) ADD_SHOWS_WO_DIR = check_setting_int(CFG, 'General', 'add_shows_wo_dir', 0)
EZRSS = bool(check_setting_int(CFG, 'General', 'use_torrent', 0))
if not EZRSS:
EZRSS = bool(check_setting_int(CFG, 'EZRSS', 'ezrss', 0))
EZRSS_RATIO = check_setting_float(CFG, 'EZRSS', 'ezrss_ratio', 0)
TVTORRENTS = bool(check_setting_int(CFG, 'TVTORRENTS', 'tvtorrents', 0))
TVTORRENTS_DIGEST = check_setting_str(CFG, 'TVTORRENTS', 'tvtorrents_digest', '')
TVTORRENTS_HASH = check_setting_str(CFG, 'TVTORRENTS', 'tvtorrents_hash', '')
TVTORRENTS_RATIO = check_setting_float(CFG, 'TVTORRENTS', 'tvtorrents_ratio', 0)
TVTORRENTS_OPTIONS = check_setting_str(CFG, 'TVTORRENTS', 'tvtorrents_options', '')
BTN = bool(check_setting_int(CFG, 'BTN', 'btn', 0))
BTN_API_KEY = check_setting_str(CFG, 'BTN', 'btn_api_key', '')
BTN_RATIO = check_setting_float(CFG, 'BTN', 'btn_ratio', 0)
BTN_OPTIONS = check_setting_str(CFG, 'BTN', 'btn_options', '')
THEPIRATEBAY = bool(check_setting_int(CFG, 'THEPIRATEBAY', 'thepiratebay', 1))
THEPIRATEBAY_RATIO = check_setting_float(CFG, 'THEPIRATEBAY', 'thepiratebay_ratio', 0)
THEPIRATEBAY_TRUSTED = bool(check_setting_int(CFG, 'THEPIRATEBAY', 'thepiratebay_trusted', 1))
THEPIRATEBAY_PROXY = bool(check_setting_int(CFG, 'THEPIRATEBAY', 'thepiratebay_proxy', 0))
THEPIRATEBAY_PROXY_URL = check_setting_str(CFG, 'THEPIRATEBAY', 'thepiratebay_proxy_url', '')
THEPIRATEBAY_BLACKLIST = check_setting_str(CFG, 'THEPIRATEBAY', 'thepiratebay_blacklist', '')
THEPIRATEBAY_OPTIONS = check_setting_str(CFG, 'THEPIRATEBAY', 'thepiratebay_options', '')
TORRENTLEECH = bool(check_setting_int(CFG, 'TORRENTLEECH', 'torrentleech', 0))
TORRENTLEECH_USERNAME = check_setting_str(CFG, 'TORRENTLEECH', 'torrentleech_username', '')
TORRENTLEECH_PASSWORD = check_setting_str(CFG, 'TORRENTLEECH', 'torrentleech_password', '')
TORRENTLEECH_RATIO = check_setting_float(CFG, 'TORRENTLEECH', 'torrentleech_ratio', 0)
TORRENTLEECH_OPTIONS = check_setting_str(CFG, 'TORRENTLEECH', 'torrentleech_options', '')
IPTORRENTS = bool(check_setting_int(CFG, 'IPTORRENTS', 'iptorrents', 0))
IPTORRENTS_USERNAME = check_setting_str(CFG, 'IPTORRENTS', 'iptorrents_username', '')
IPTORRENTS_PASSWORD = check_setting_str(CFG, 'IPTORRENTS', 'iptorrents_password', '')
IPTORRENTS_RATIO = check_setting_float(CFG, 'IPTORRENTS', 'iptorrents_ratio', 0)
IPTORRENTS_FREELEECH = bool(check_setting_int(CFG, 'IPTORRENTS', 'iptorrents_freeleech', 0))
IPTORRENTS_OPTIONS = check_setting_str(CFG, 'IPTORRENTS', 'iptorrents_options', '')
NEXTGEN = bool(check_setting_int(CFG, 'NEXTGEN', 'nextgen', 0))
NEXTGEN_USERNAME = check_setting_str(CFG, 'NEXTGEN', 'nextgen_username', '')
NEXTGEN_PASSWORD = check_setting_str(CFG, 'NEXTGEN', 'nextgen_password', '')
NEXTGEN_RATIO = check_setting_float(CFG, 'NEXTGEN', 'nextgen_ratio', 0)
NEXTGEN_OPTIONS = check_setting_str(CFG, 'NEXTGEN', 'nextgen_options', '')
KAT = bool(check_setting_int(CFG, 'KAT', 'kat', 0))
KAT_RATIO = check_setting_float(CFG, 'KAT', 'kat_ratio', 0)
KAT_VERIFIED = bool(check_setting_int(CFG, 'KAT', 'kat_verified', 1))
KAT_OPTIONS = check_setting_str(CFG, 'KAT', 'kat_options', '')
PUBLICHD = bool(check_setting_int(CFG, 'PUBLICHD', 'publichd', 0))
PUBLICHD_RATIO = check_setting_float(CFG, 'PUBLICHD', 'publichd_ratio', 0)
PUBLICHD_OPTIONS = check_setting_str(CFG, 'PUBLICHD', 'publichd_options', '')
SCC = bool(check_setting_int(CFG, 'SCC', 'scc', 0))
SCC_USERNAME = check_setting_str(CFG, 'SCC', 'scc_username', '')
SCC_PASSWORD = check_setting_str(CFG, 'SCC', 'scc_password', '')
SCC_RATIO = check_setting_float(CFG, 'SCC', 'scc_ratio', 0)
SCC_OPTIONS = check_setting_str(CFG, 'SCC', 'scc_options', '')
HDTORRENTS = bool(check_setting_int(CFG, 'HDTORRENTS', 'hdtorrents', 0))
HDTORRENTS_USERNAME = check_setting_str(CFG, 'HDTORRENTS', 'hdtorrents_username', '')
HDTORRENTS_PASSWORD = check_setting_str(CFG, 'HDTORRENTS', 'hdtorrents_password', '')
HDTORRENTS_RATIO = check_setting_float(CFG, 'HDTORRENTS', 'hdtorrents_ratio', 0)
HDTORRENTS_OPTIONS = check_setting_str(CFG, 'HDTORRENTS', 'hdtorrents_options', '')
TORRENTDAY = bool(check_setting_int(CFG, 'TORRENTDAY', 'torrentday', 0))
TORRENTDAY_USERNAME = check_setting_str(CFG, 'TORRENTDAY', 'torrentday_username', '')
TORRENTDAY_PASSWORD = check_setting_str(CFG, 'TORRENTDAY', 'torrentday_password', '')
TORRENTDAY_RATIO = check_setting_float(CFG, 'TORRENTDAY', 'torrentday_ratio', 0)
TORRENTDAY_FREELEECH = bool(check_setting_int(CFG, 'TORRENTDAY', 'torrentday_freeleech', 0))
TORRENTDAY_OPTIONS = check_setting_str(CFG, 'TORRENTDAY', 'torrentday_options', '')
HDBITS = bool(check_setting_int(CFG, 'HDBITS', 'hdbits', 0))
HDBITS_USERNAME = check_setting_str(CFG, 'HDBITS', 'hdbits_username', '')
HDBITS_PASSKEY = check_setting_str(CFG, 'HDBITS', 'hdbits_passkey', '')
HDBITS_RATIO = check_setting_float(CFG, 'HDBITS', 'hdbits_ratio', 0)
HDBITS_OPTIONS = check_setting_str(CFG, 'HDBITS', 'hdbits_options', '')
SPEEDCD = bool(check_setting_int(CFG, 'SPEEDCD', 'speedcd', 0))
SPEEDCD_USERNAME = check_setting_str(CFG, 'SPEEDCD', 'speedcd_username', '')
SPEEDCD_PASSWORD = check_setting_str(CFG, 'SPEEDCD', 'speedcd_password', '')
SPEEDCD_RATIO = check_setting_float(CFG, 'SPEEDCD', 'speedcd_ratio', 0)
SPEEDCD_FREELEECH = bool(check_setting_int(CFG, 'SPEEDCD', 'speedcd_freeleech', 0))
NZBS = bool(check_setting_int(CFG, 'NZBs', 'nzbs', 0)) NZBS = bool(check_setting_int(CFG, 'NZBs', 'nzbs', 0))
NZBS_UID = check_setting_str(CFG, 'NZBs', 'nzbs_uid', '') NZBS_UID = check_setting_str(CFG, 'NZBs', 'nzbs_uid', '')
NZBS_HASH = check_setting_str(CFG, 'NZBs', 'nzbs_hash', '') NZBS_HASH = check_setting_str(CFG, 'NZBs', 'nzbs_hash', '')
@ -1145,6 +982,70 @@ def initialize(consoleLogging=True):
showList = [] showList = []
loadingShowList = {} loadingShowList = {}
# dynamically load provider settings
for curTorrentProvider in [curProvider for curProvider in providers.sortedProviderList() if
curProvider.providerType == GenericProvider.TORRENT]:
curTorrentProvider.enabled = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID(), 0))
if hasattr(curTorrentProvider, 'api_key'):
curTorrentProvider.api_key = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_api_key', '')
if hasattr(curTorrentProvider, 'hash'):
curTorrentProvider.hash = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_hash', '')
if hasattr(curTorrentProvider, 'digest'):
curTorrentProvider.digest = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_digest', '')
if hasattr(curTorrentProvider, 'username'):
curTorrentProvider.username = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_username', '')
if hasattr(curTorrentProvider, 'password'):
curTorrentProvider.password = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_password', '') or \
check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_passkey', '')
if hasattr(curTorrentProvider, 'proxy'):
curTorrentProvider.proxy = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_proxy', 0))
if hasattr(curTorrentProvider, 'proxy_url'):
curTorrentProvider.proxy_url = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_proxy_url', '')
if hasattr(curTorrentProvider, 'confirmed'):
curTorrentProvider.confirmed = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_confirmed', 0)) or \
bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_trusted', 0)) or \
bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_verified', 0))
if hasattr(curTorrentProvider, 'options'):
curTorrentProvider.options = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_options', '')
if hasattr(curTorrentProvider, 'ratio'):
curTorrentProvider.ratio = float(check_setting_float(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_ratio', 0))
if hasattr(curTorrentProvider, 'freeleech'):
curTorrentProvider.freeleech = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_freeleech', 0))
if hasattr(curTorrentProvider, 'search_mode'):
curTorrentProvider.search_mode = check_setting_str(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_search_mode', 'eponly')
if hasattr(curTorrentProvider, 'search_fallback'):
curTorrentProvider.search_fallback = bool(check_setting_int(CFG, curTorrentProvider.getID().upper(),
curTorrentProvider.getID() + '_search_mode', 0))
try: try:
url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini' url = 'http://raw.github.com/echel0n/sickrage-init/master/settings.ini'
clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text clear_cache = ElementTree.XML(helpers.getURL(url)).find('cache/clear').text
@ -1154,7 +1055,8 @@ def initialize(consoleLogging=True):
curProvider.cache._clearCache() curProvider.cache._clearCache()
CLEAR_CACHE = clear_cache CLEAR_CACHE = clear_cache
save_config() save_config()
except:pass except:
pass
__INITIALIZED__ = True __INITIALIZED__ = True
return True return True
@ -1312,11 +1214,13 @@ def remove_pid_file(PIDFILE):
return True return True
def sig_handler(signum=None, frame=None): def sig_handler(signum=None, frame=None):
if type(signum) != type(None): if type(signum) != type(None):
logger.log(u"Signal %i caught, saving and exiting..." % int(signum)) logger.log(u"Signal %i caught, saving and exiting..." % int(signum))
saveAndShutdown() saveAndShutdown()
def saveAll(): def saveAll():
global showList global showList
@ -1494,100 +1398,37 @@ def save_config():
new_config['Blackhole']['nzb_dir'] = NZB_DIR new_config['Blackhole']['nzb_dir'] = NZB_DIR
new_config['Blackhole']['torrent_dir'] = TORRENT_DIR new_config['Blackhole']['torrent_dir'] = TORRENT_DIR
new_config['EZRSS'] = {} # dynamically save provider settings
new_config['EZRSS']['ezrss'] = int(EZRSS) for curTorrentProvider in [curProvider for curProvider in providers.sortedProviderList() if
new_config['EZRSS']['ezrss_ratio'] = float(EZRSS_RATIO) curProvider.providerType == GenericProvider.TORRENT]:
new_config[curTorrentProvider.getID().upper()] = {}
new_config['TVTORRENTS'] = {} new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID()] = int(curTorrentProvider.enabled)
new_config['TVTORRENTS']['tvtorrents'] = int(TVTORRENTS) if hasattr(curTorrentProvider, 'digest'):
new_config['TVTORRENTS']['tvtorrents_digest'] = TVTORRENTS_DIGEST new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_digest'] = curTorrentProvider.digest
new_config['TVTORRENTS']['tvtorrents_hash'] = TVTORRENTS_HASH if hasattr(curTorrentProvider, 'hash'):
new_config['TVTORRENTS']['tvtorrents_ratio'] = float(TVTORRENTS_RATIO) new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_hash'] = curTorrentProvider.hash
new_config['TVTORRENTS']['tvtorrents_options'] = TVTORRENTS_OPTIONS if hasattr(curTorrentProvider, 'api_key'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_api_key'] = curTorrentProvider.api_key
new_config['BTN'] = {} if hasattr(curTorrentProvider, 'username'):
new_config['BTN']['btn'] = int(BTN) new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_username'] = curTorrentProvider.username
new_config['BTN']['btn_api_key'] = BTN_API_KEY if hasattr(curTorrentProvider, 'password'):
new_config['BTN']['btn_ratio'] = float(BTN_RATIO) new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_password'] = curTorrentProvider.password
new_config['BTN']['btn_options'] = BTN_OPTIONS if hasattr(curTorrentProvider, 'confirmed'):
new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_confirmed'] = curTorrentProvider.confirmed
new_config['THEPIRATEBAY'] = {} if hasattr(curTorrentProvider, 'ratio'):
new_config['THEPIRATEBAY']['thepiratebay'] = int(THEPIRATEBAY) new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_ratio'] = float(curTorrentProvider.ratio)
new_config['THEPIRATEBAY']['thepiratebay_ratio'] = float(THEPIRATEBAY_RATIO) if hasattr(curTorrentProvider, 'options'):
new_config['THEPIRATEBAY']['thepiratebay_trusted'] = int(THEPIRATEBAY_TRUSTED) new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_options'] = curTorrentProvider.options
new_config['THEPIRATEBAY']['thepiratebay_proxy'] = int(THEPIRATEBAY_PROXY) if hasattr(curTorrentProvider, 'proxy'):
new_config['THEPIRATEBAY']['thepiratebay_proxy_url'] = THEPIRATEBAY_PROXY_URL new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_proxy'] = curTorrentProvider.proxy
new_config['THEPIRATEBAY']['thepiratebay_blacklist'] = THEPIRATEBAY_BLACKLIST if hasattr(curTorrentProvider, 'proxy_url'):
new_config['THEPIRATEBAY']['thepiratebay_options'] = THEPIRATEBAY_OPTIONS new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_proxy_url'] = curTorrentProvider.proxy_url
if hasattr(curTorrentProvider, 'freeleech'):
new_config['TORRENTLEECH'] = {} new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_freeleech'] = int(curTorrentProvider.freeleech)
new_config['TORRENTLEECH']['torrentleech'] = int(TORRENTLEECH) if hasattr(curTorrentProvider, 'search_mode'):
new_config['TORRENTLEECH']['torrentleech_username'] = TORRENTLEECH_USERNAME new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_search_mode'] = curTorrentProvider.search_mode
new_config['TORRENTLEECH']['torrentleech_password'] = helpers.encrypt(TORRENTLEECH_PASSWORD, ENCRYPTION_VERSION) if hasattr(curTorrentProvider, 'search_fallback'):
new_config['TORRENTLEECH']['torrentleech_ratio'] = float(TORRENTLEECH_RATIO) new_config[curTorrentProvider.getID().upper()][curTorrentProvider.getID() + '_search_fallback'] = int(curTorrentProvider.search_fallback)
new_config['TORRENTLEECH']['torrentleech_options'] = TORRENTLEECH_OPTIONS
new_config['IPTORRENTS'] = {}
new_config['IPTORRENTS']['iptorrents'] = int(IPTORRENTS)
new_config['IPTORRENTS']['iptorrents_username'] = IPTORRENTS_USERNAME
new_config['IPTORRENTS']['iptorrents_password'] = helpers.encrypt(IPTORRENTS_PASSWORD, ENCRYPTION_VERSION)
new_config['IPTORRENTS']['iptorrents_ratio'] = float(IPTORRENTS_RATIO)
new_config['IPTORRENTS']['iptorrents_freeleech'] = int(IPTORRENTS_FREELEECH)
new_config['IPTORRENTS']['iptorrents_options'] = IPTORRENTS_OPTIONS
new_config['NEXTGEN'] = {}
new_config['NEXTGEN']['nextgen'] = int(NEXTGEN)
new_config['NEXTGEN']['nextgen_username'] = NEXTGEN_USERNAME
new_config['NEXTGEN']['nextgen_password'] = helpers.encrypt(NEXTGEN_PASSWORD, ENCRYPTION_VERSION)
new_config['NEXTGEN']['nextgen_ratio'] = float(NEXTGEN_RATIO)
new_config['NEXTGEN']['nextgen_options'] = NEXTGEN_OPTIONS
new_config['KAT'] = {}
new_config['KAT']['kat'] = int(KAT)
new_config['KAT']['kat_ratio'] = float(KAT_RATIO)
new_config['KAT']['kat_verified'] = int(KAT_VERIFIED)
new_config['KAT']['kat_options'] = KAT_OPTIONS
new_config['PUBLICHD'] = {}
new_config['PUBLICHD']['publichd'] = int(PUBLICHD)
new_config['PUBLICHD']['publichd_ratio'] = float(PUBLICHD_RATIO)
new_config['PUBLICHD']['publichd_options'] = PUBLICHD_OPTIONS
new_config['SCC'] = {}
new_config['SCC']['scc'] = int(SCC)
new_config['SCC']['scc_username'] = SCC_USERNAME
new_config['SCC']['scc_password'] = helpers.encrypt(SCC_PASSWORD, ENCRYPTION_VERSION)
new_config['SCC']['scc_ratio'] = float(SCC_RATIO)
new_config['SCC']['scc_options'] = SCC_OPTIONS
new_config['HDTORRENTS'] = {}
new_config['HDTORRENTS']['hdtorrents'] = int(HDTORRENTS)
new_config['HDTORRENTS']['hdtorrents_username'] = HDTORRENTS_USERNAME
new_config['HDTORRENTS']['hdtorrents_password'] = helpers.encrypt(HDTORRENTS_PASSWORD, ENCRYPTION_VERSION)
new_config['HDTORRENTS']['hdtorrents_ratio'] = float(HDTORRENTS_RATIO)
new_config['HDTORRENTS']['hdtorrents_options'] = HDTORRENTS_OPTIONS
new_config['TORRENTDAY'] = {}
new_config['TORRENTDAY']['torrentday'] = int(TORRENTDAY)
new_config['TORRENTDAY']['torrentday_username'] = TORRENTDAY_USERNAME
new_config['TORRENTDAY']['torrentday_password'] = helpers.encrypt(TORRENTDAY_PASSWORD, ENCRYPTION_VERSION)
new_config['TORRENTDAY']['torrentday_ratio'] = float(TORRENTDAY_RATIO)
new_config['TORRENTDAY']['torrentday_freeleech'] = int(TORRENTDAY_FREELEECH)
new_config['TORRENTDAY']['torrentday_options'] = TORRENTDAY_OPTIONS
new_config['HDBITS'] = {}
new_config['HDBITS']['hdbits'] = int(HDBITS)
new_config['HDBITS']['hdbits_username'] = HDBITS_USERNAME
new_config['HDBITS']['hdbits_passkey'] = HDBITS_PASSKEY
new_config['HDBITS']['hdbits_ratio'] = float(HDBITS_RATIO)
new_config['HDBITS']['hdbits_options'] = HDBITS_OPTIONS
new_config['SPEEDCD'] = {}
new_config['SPEEDCD']['speedcd'] = int(SPEEDCD)
new_config['SPEEDCD']['speedcd_username'] = SPEEDCD_USERNAME
new_config['SPEEDCD']['speedcd_password'] = helpers.encrypt(SPEEDCD_PASSWORD, ENCRYPTION_VERSION)
new_config['SPEEDCD']['speedcd_ratio'] = float(SPEEDCD_RATIO)
new_config['SPEEDCD']['speedcd_freeleech'] = int(SPEEDCD_FREELEECH)
new_config['NZBs'] = {} new_config['NZBs'] = {}
new_config['NZBs']['nzbs'] = int(NZBS) new_config['NZBs']['nzbs'] = int(NZBS)

View File

@ -81,6 +81,8 @@ def getNewznabProviderList(data):
providerDict[curDefault.name].name = curDefault.name providerDict[curDefault.name].name = curDefault.name
providerDict[curDefault.name].url = curDefault.url providerDict[curDefault.name].url = curDefault.url
providerDict[curDefault.name].needs_auth = curDefault.needs_auth providerDict[curDefault.name].needs_auth = curDefault.needs_auth
providerDict[curDefault.name].search_mode = curDefault.search_mode
providerDict[curDefault.name].search_fallback = curDefault.search_fallback
return filter(lambda x: x, providerList) return filter(lambda x: x, providerList)
@ -89,6 +91,12 @@ def makeNewznabProvider(configString):
if not configString: if not configString:
return None return None
search_mode = 'eponly'
search_fallback = 0
try:
name, url, key, catIDs, enabled, search_mode, search_fallback = configString.split('|')
except ValueError:
try: try:
name, url, key, catIDs, enabled = configString.split('|') name, url, key, catIDs, enabled = configString.split('|')
except ValueError: except ValueError:
@ -97,8 +105,9 @@ def makeNewznabProvider(configString):
newznab = sys.modules['sickbeard.providers.newznab'] newznab = sys.modules['sickbeard.providers.newznab']
newProvider = newznab.NewznabProvider(name, url, key=key, catIDs=catIDs) newProvider = newznab.NewznabProvider(name, url, key=key, catIDs=catIDs, search_mode=search_mode, search_fallback=search_fallback)
newProvider.enabled = enabled == '1' newProvider.enabled = enabled == '1'
newProvider.search_fallback = search_fallback == '1'
return newProvider return newProvider
@ -123,7 +132,7 @@ def makeTorrentRssProvider(configString):
def getDefaultNewznabProviders(): def getDefaultNewznabProviders():
return 'Sick Beard Index|http://lolo.sickbeard.com/|0|5030,5040,5060|0!!!NZBs.org|https://nzbs.org/||5030,5040,5060,5070,5090|0!!!Usenet-Crawler|https://www.usenet-crawler.com/||5030,5040,5060|0' return 'Sick Beard Index|http://lolo.sickbeard.com/|0|5030,5040,5060|0|eponly|0!!!NZBs.org|https://nzbs.org/||5030,5040,5060,5070,5090|0|eponly|0!!!Usenet-Crawler|https://www.usenet-crawler.com/||5030,5040,5060|0|eponly|0'
def getProviderModule(name): def getProviderModule(name):

View File

@ -39,18 +39,23 @@ class BTNProvider(generic.TorrentProvider):
generic.TorrentProvider.__init__(self, "BTN") generic.TorrentProvider.__init__(self, "BTN")
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.api_key = None
self.ratio = None
self.cache = BTNCache(self) self.cache = BTNCache(self)
self.url = "http://broadcasthe.net" self.url = "http://broadcasthe.net"
def isEnabled(self): def isEnabled(self):
return sickbeard.BTN return self.enabled
def imageName(self): def imageName(self):
return 'btn.png' return 'btn.png'
def _checkAuth(self): def _checkAuth(self):
if not sickbeard.BTN_API_KEY: if not self.api_key:
raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.") raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
return True return True
@ -73,7 +78,7 @@ class BTNProvider(generic.TorrentProvider):
self._checkAuth() self._checkAuth()
params = {} params = {}
apikey = sickbeard.BTN_API_KEY apikey = self.api_key
# age in seconds # age in seconds
if age: if age:
@ -296,8 +301,7 @@ class BTNProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.BTN_RATIO return self.ratio
class BTNCache(tvcache.TVCache): class BTNCache(tvcache.TVCache):
def __init__(self, provider): def __init__(self, provider):

View File

@ -32,11 +32,16 @@ class DTTProvider(generic.TorrentProvider):
def __init__(self): def __init__(self):
generic.TorrentProvider.__init__(self, "DailyTvTorrents") generic.TorrentProvider.__init__(self, "DailyTvTorrents")
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.ratio = None
self.cache = DTTCache(self) self.cache = DTTCache(self)
self.url = 'http://www.dailytvtorrents.org/' self.url = 'http://www.dailytvtorrents.org/'
def isEnabled(self): def isEnabled(self):
return sickbeard.DTT return self.enabled
def imageName(self): def imageName(self):
return 'dailytvtorrents.gif' return 'dailytvtorrents.gif'
@ -46,8 +51,8 @@ class DTTProvider(generic.TorrentProvider):
quality = Quality.sceneQuality(url) quality = Quality.sceneQuality(url)
return quality return quality
def getSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False): def findSearchResults(self, show, season, episodes, search_mode, manualSearch=False):
return generic.TorrentProvider.findSearchResults(self, show, season, episodes, seasonSearch, manualSearch) return generic.TorrentProvider.findSearchResults(self, show, season, episodes, search_mode, manualSearch)
def _dtt_show_id(self, show_name): def _dtt_show_id(self, show_name):
return sanitizeSceneName(show_name).replace('.', '-').lower() return sanitizeSceneName(show_name).replace('.', '-').lower()

View File

@ -40,12 +40,15 @@ class EZRSSProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.ratio = None
self.cache = EZRSSCache(self) self.cache = EZRSSCache(self)
self.url = 'https://www.ezrss.it/' self.url = 'https://www.ezrss.it/'
def isEnabled(self): def isEnabled(self):
return sickbeard.EZRSS return self.enabled
def imageName(self): def imageName(self):
return 'ezrss.png' return 'ezrss.png'
@ -57,7 +60,7 @@ class EZRSSProvider(generic.TorrentProvider):
return quality return quality
def getSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False): def findSearchResults(self, show, season, episodes, search_mode, manualSearch=False):
self.show = show self.show = show
@ -68,7 +71,7 @@ class EZRSSProvider(generic.TorrentProvider):
logger.WARNING) logger.WARNING)
return results return results
results = generic.TorrentProvider.findSearchResults(self, show, season, episodes, seasonSearch, manualSearch) results = generic.TorrentProvider.findSearchResults(self, show, season, episodes, search_mode, manualSearch)
return results return results
@ -158,7 +161,7 @@ class EZRSSProvider(generic.TorrentProvider):
return None return None
def seedRatio(self): def seedRatio(self):
return sickbeard.EZRSS_RATIO return self.ratio
class EZRSSCache(tvcache.TVCache): class EZRSSCache(tvcache.TVCache):

View File

@ -52,7 +52,9 @@ class GenericProvider:
self.url = '' self.url = ''
self.show = None self.show = None
self.supportsBacklog = False self.supportsBacklog = False
self.search_mode = None self.search_mode = None
self.search_fallback = False self.search_fallback = False
@ -225,7 +227,7 @@ class GenericProvider:
return (title, url) return (title, url)
def findSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False): def findSearchResults(self, show, season, episodes, search_mode, manualSearch=False):
self._checkAuth() self._checkAuth()
self.show = show self.show = show
@ -236,7 +238,7 @@ class GenericProvider:
searched_scene_season = None searched_scene_season = None
for epObj in episodes: for epObj in episodes:
if seasonSearch and searched_scene_season: if search_mode == 'sponly' and searched_scene_season:
if searched_scene_season == epObj.scene_season: if searched_scene_season == epObj.scene_season:
continue continue
@ -254,7 +256,7 @@ class GenericProvider:
results.update({epObj.episode:cacheResult[epObj]}) results.update({epObj.episode:cacheResult[epObj]})
continue continue
if seasonSearch: if search_mode == 'sponly':
for curString in self._get_season_search_strings(epObj): for curString in self._get_season_search_strings(epObj):
itemList += self._doSearch(curString, len(episodes)) itemList += self._doSearch(curString, len(episodes))
else: else:
@ -289,7 +291,7 @@ class GenericProvider:
continue continue
if not (self.show.air_by_date or self.show.sports): if not (self.show.air_by_date or self.show.sports):
if seasonSearch and len(parse_result.episode_numbers): if search_mode == 'sponly' and len(parse_result.episode_numbers):
logger.log( logger.log(
u"This is supposed to be a season pack search but the result " + title + " is not a valid season pack, skipping it", u"This is supposed to be a season pack search but the result " + title + " is not a valid season pack, skipping it",
logger.DEBUG) logger.DEBUG)

View File

@ -40,6 +40,11 @@ class HDBitsProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.cache = HDBitsCache(self) self.cache = HDBitsCache(self)
self.url = 'https://hdbits.org' self.url = 'https://hdbits.org'
@ -48,11 +53,11 @@ class HDBitsProvider(generic.TorrentProvider):
self.download_url = 'http://hdbits.org/download.php?' self.download_url = 'http://hdbits.org/download.php?'
def isEnabled(self): def isEnabled(self):
return sickbeard.HDBITS return self.enabled
def _checkAuth(self): def _checkAuth(self):
if not sickbeard.HDBITS_USERNAME or not sickbeard.HDBITS_PASSKEY: if not self.username or not self.password:
raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.") raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
return True return True
@ -83,7 +88,7 @@ class HDBitsProvider(generic.TorrentProvider):
if title: if title:
title = title.replace(' ', '.') title = title.replace(' ', '.')
url = self.download_url + urllib.urlencode({'id': item['id'], 'passkey': sickbeard.HDBITS_PASSKEY}) url = self.download_url + urllib.urlencode({'id': item['id'], 'passkey': self.password})
return (title, url) return (title, url)
@ -141,8 +146,8 @@ class HDBitsProvider(generic.TorrentProvider):
def _make_post_data_JSON(self, show=None, episode=None, season=None, search_term=None): def _make_post_data_JSON(self, show=None, episode=None, season=None, search_term=None):
post_data = { post_data = {
'username': sickbeard.HDBITS_USERNAME, 'username': self.username,
'passkey': sickbeard.HDBITS_PASSKEY, 'passkey': self.password,
'category': [2], # TV Category 'category': [2], # TV Category
} }
@ -171,7 +176,7 @@ class HDBitsProvider(generic.TorrentProvider):
return json.dumps(post_data) return json.dumps(post_data)
def seedRatio(self): def seedRatio(self):
return sickbeard.HDBITS_RATIO return self.ratio
class HDBitsCache(tvcache.TVCache): class HDBitsCache(tvcache.TVCache):

View File

@ -56,6 +56,11 @@ class HDTorrentsProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.cache = HDTorrentsCache(self) self.cache = HDTorrentsCache(self)
self.url = self.urls['base_url'] self.url = self.urls['base_url']
@ -65,7 +70,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
self.cookies = None self.cookies = None
def isEnabled(self): def isEnabled(self):
return sickbeard.HDTORRENTS return self.enabled
def imageName(self): def imageName(self):
return 'hdtorrents.png' return 'hdtorrents.png'
@ -80,14 +85,14 @@ class HDTorrentsProvider(generic.TorrentProvider):
if any(requests.utils.dict_from_cookiejar(self.session.cookies).values()): if any(requests.utils.dict_from_cookiejar(self.session.cookies).values()):
return True return True
if sickbeard.HDTORRENTS_UID and sickbeard.HDTORRENTS_HASH: if self.uid and self.hash:
requests.utils.add_dict_to_cookiejar(self.session.cookies, self.cookies) requests.utils.add_dict_to_cookiejar(self.session.cookies, self.cookies)
else: else:
login_params = {'uid': sickbeard.HDTORRENTS_USERNAME, login_params = {'uid': self.username,
'pwd': sickbeard.HDTORRENTS_PASSWORD, 'pwd': self.password,
'submit': 'Confirm', 'submit': 'Confirm',
} }
@ -102,11 +107,11 @@ class HDTorrentsProvider(generic.TorrentProvider):
logger.log(u'Invalid username or password for ' + self.name + ' Check your settings', logger.ERROR) logger.log(u'Invalid username or password for ' + self.name + ' Check your settings', logger.ERROR)
return False return False
sickbeard.HDTORRENTS_UID = requests.utils.dict_from_cookiejar(self.session.cookies)['uid'] self.uid = requests.utils.dict_from_cookiejar(self.session.cookies)['uid']
sickbeard.HDTORRENTS_HASH = requests.utils.dict_from_cookiejar(self.session.cookies)['pass'] self.hash = requests.utils.dict_from_cookiejar(self.session.cookies)['pass']
self.cookies = {'uid': sickbeard.HDTORRENTS_UID, self.cookies = {'uid': self.uid,
'pass': sickbeard.HDTORRENTS_HASH 'pass': self.hash
} }
return True return True
@ -321,7 +326,7 @@ class HDTorrentsProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.HDTORRENTS_RATIO return self.ratio
class HDTorrentsCache(tvcache.TVCache): class HDTorrentsCache(tvcache.TVCache):

View File

@ -53,6 +53,12 @@ class IPTorrentsProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.freeleech = False
self.cache = IPTorrentsCache(self) self.cache = IPTorrentsCache(self)
self.url = self.urls['base_url'] self.url = self.urls['base_url']
@ -60,7 +66,7 @@ class IPTorrentsProvider(generic.TorrentProvider):
self.categorie = 'l73=1&l78=1&l66=1&l65=1&l79=1&l5=1&l4=1' self.categorie = 'l73=1&l78=1&l66=1&l65=1&l79=1&l5=1&l4=1'
def isEnabled(self): def isEnabled(self):
return sickbeard.IPTORRENTS return self.enabled
def imageName(self): def imageName(self):
return 'iptorrents.png' return 'iptorrents.png'
@ -72,8 +78,8 @@ class IPTorrentsProvider(generic.TorrentProvider):
def _doLogin(self): def _doLogin(self):
login_params = {'username': sickbeard.IPTORRENTS_USERNAME, login_params = {'username': self.username,
'password': sickbeard.IPTORRENTS_PASSWORD, 'password': self.password,
'login': 'submit', 'login': 'submit',
} }
@ -137,7 +143,7 @@ class IPTorrentsProvider(generic.TorrentProvider):
results = [] results = []
items = {'Season': [], 'Episode': [], 'RSS': []} items = {'Season': [], 'Episode': [], 'RSS': []}
freeleech = '&free=on' if sickbeard.IPTORRENTS_FREELEECH else '' freeleech = '&free=on' if self.freeleech else ''
if not self._doLogin(): if not self._doLogin():
return [] return []
@ -266,8 +272,7 @@ class IPTorrentsProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.IPTORRENTS_RATIO return self.ratio
class IPTorrentsCache(tvcache.TVCache): class IPTorrentsCache(tvcache.TVCache):
def __init__(self, provider): def __init__(self, provider):

View File

@ -56,6 +56,10 @@ class KATProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.confirmed = False
self.ratio = None
self.cache = KATCache(self) self.cache = KATCache(self)
self.url = 'http://kickass.to/' self.url = 'http://kickass.to/'
@ -63,7 +67,7 @@ class KATProvider(generic.TorrentProvider):
self.searchurl = self.url + 'usearch/%s/?field=seeders&sorder=desc' #order by seed self.searchurl = self.url + 'usearch/%s/?field=seeders&sorder=desc' #order by seed
def isEnabled(self): def isEnabled(self):
return sickbeard.KAT return self.enabled
def imageName(self): def imageName(self):
return 'kat.png' return 'kat.png'
@ -261,7 +265,7 @@ class KATProvider(generic.TorrentProvider):
if mode != 'RSS' and seeders == 0: if mode != 'RSS' and seeders == 0:
continue continue
if sickbeard.KAT_VERIFIED and not verified: if self.confirmed and not verified:
logger.log( logger.log(
u"KAT Provider found result " + title + " but that doesn't seem like a verified result so I'm ignoring it", u"KAT Provider found result " + title + " but that doesn't seem like a verified result so I'm ignoring it",
logger.DEBUG) logger.DEBUG)
@ -398,7 +402,7 @@ class KATProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.KAT_RATIO return self.ratio
class KATCache(tvcache.TVCache): class KATCache(tvcache.TVCache):

View File

@ -42,7 +42,7 @@ from sickbeard.exceptions import ex, AuthException
class NewznabProvider(generic.NZBProvider): class NewznabProvider(generic.NZBProvider):
def __init__(self, name, url, key='', catIDs='5030,5040,5060'): def __init__(self, name, url, key='', catIDs='5030,5040,5060', search_mode='eponly', search_fallback=False):
generic.NZBProvider.__init__(self, name) generic.NZBProvider.__init__(self, name)
@ -52,6 +52,14 @@ class NewznabProvider(generic.NZBProvider):
self.key = key self.key = key
self.search_mode = search_mode
self.search_fallback = search_fallback
if self.search_fallback == '0':
self.search_fallback = False
else:
self.search_fallback = True
# a 0 in the key spot indicates that no key is needed # a 0 in the key spot indicates that no key is needed
if self.key == '0': if self.key == '0':
self.needs_auth = False self.needs_auth = False
@ -69,7 +77,7 @@ class NewznabProvider(generic.NZBProvider):
self.default = False self.default = False
def configStr(self): def configStr(self):
return self.name + '|' + self.url + '|' + self.key + '|' + self.catIDs + '|' + str(int(self.enabled)) return self.name + '|' + self.url + '|' + self.key + '|' + self.catIDs + '|' + str(int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback))
def imageName(self): def imageName(self):
if ek.ek(os.path.isfile, if ek.ek(os.path.isfile,

View File

@ -56,6 +56,11 @@ class NextGenProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.cache = NextGenCache(self) self.cache = NextGenCache(self)
self.url = self.urls['base_url'] self.url = self.urls['base_url']
@ -67,7 +72,7 @@ class NextGenProvider(generic.TorrentProvider):
self.login_opener = None self.login_opener = None
def isEnabled(self): def isEnabled(self):
return sickbeard.NEXTGEN return self.enabled
def imageName(self): def imageName(self):
return 'nextgen.png' return 'nextgen.png'
@ -79,8 +84,8 @@ class NextGenProvider(generic.TorrentProvider):
def getLoginParams(self): def getLoginParams(self):
return { return {
'username': sickbeard.NEXTGEN_USERNAME, 'username': self.username,
'password': sickbeard.NEXTGEN_PASSWORD, 'password': self.password,
} }
def loginSuccess(self, output): def loginSuccess(self, output):
@ -315,7 +320,7 @@ class NextGenProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.NEXTGEN_RATIO return self.ratio
class NextGenCache(tvcache.TVCache): class NextGenCache(tvcache.TVCache):

View File

@ -39,12 +39,14 @@ class NyaaProvider(generic.TorrentProvider):
self.supportsAbsoluteNumbering = True self.supportsAbsoluteNumbering = True
self.enabled = False
self.cache = NyaaCache(self) self.cache = NyaaCache(self)
self.url = 'http://www.nyaa.eu/' self.url = 'http://www.nyaa.eu/'
def isEnabled(self): def isEnabled(self):
return sickbeard.NYAA return self.enabled
def imageName(self): def imageName(self):
return 'nyaatorrents.png' return 'nyaatorrents.png'
@ -54,9 +56,8 @@ class NyaaProvider(generic.TorrentProvider):
quality = Quality.sceneQuality(title) quality = Quality.sceneQuality(title)
return quality return quality
def getSearchResults(self, show, season, episodes, seasonSearch=False, manualSearch=False): def findSearchResults(self, show, season, episodes, search_mode, manualSearch=False):
results = generic.TorrentProvider.findSearchResults(self, show, season, episodes, seasonSearch, manualSearch) return generic.TorrentProvider.findSearchResults(self, show, season, episodes, search_mode, manualSearch)
return results
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
names = [] names = []

View File

@ -54,6 +54,9 @@ class PublicHDProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.ratio = None
self.cache = PublicHDCache(self) self.cache = PublicHDCache(self)
self.url = 'http://phdproxy.com/' self.url = 'http://phdproxy.com/'
@ -63,7 +66,7 @@ class PublicHDProvider(generic.TorrentProvider):
self.categories = {'Season': ['23'], 'Episode': ['7', '14', '24'], 'RSS': ['7', '14', '23', '24']} self.categories = {'Season': ['23'], 'Episode': ['7', '14', '24'], 'RSS': ['7', '14', '23', '24']}
def isEnabled(self): def isEnabled(self):
return sickbeard.PUBLICHD return self.enabled
def imageName(self): def imageName(self):
return 'publichd.png' return 'publichd.png'
@ -290,7 +293,7 @@ class PublicHDProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.PUBLICHD_RATIO return self.ratio
class PublicHDCache(tvcache.TVCache): class PublicHDCache(tvcache.TVCache):

View File

@ -58,6 +58,11 @@ class SCCProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.cache = SCCCache(self) self.cache = SCCCache(self)
self.url = self.urls['base_url'] self.url = self.urls['base_url']
@ -67,7 +72,7 @@ class SCCProvider(generic.TorrentProvider):
self.headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'} self.headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}
def isEnabled(self): def isEnabled(self):
return sickbeard.SCC return self.enabled
def imageName(self): def imageName(self):
return 'scc.png' return 'scc.png'
@ -79,8 +84,8 @@ class SCCProvider(generic.TorrentProvider):
def _doLogin(self): def _doLogin(self):
login_params = {'username': sickbeard.SCC_USERNAME, login_params = {'username': self.username,
'password': sickbeard.SCC_PASSWORD, 'password': self.password,
'submit': 'come on in', 'submit': 'come on in',
} }
@ -162,6 +167,8 @@ class SCCProvider(generic.TorrentProvider):
if isinstance(search_string, unicode): if isinstance(search_string, unicode):
search_string = unidecode(search_string) search_string = unidecode(search_string)
nonsceneSearchURL = None
foreignSearchURL = None
if mode == 'Season': if mode == 'Season':
searchURL = self.urls['archive'] % (search_string) searchURL = self.urls['archive'] % (search_string)
data = [self.getURL(searchURL, headers=self.headers)] data = [self.getURL(searchURL, headers=self.headers)]
@ -306,7 +313,7 @@ class SCCProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.SCC_RATIO return self.ratio
class SCCCache(tvcache.TVCache): class SCCCache(tvcache.TVCache):

View File

@ -52,6 +52,12 @@ class SpeedCDProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.freeleech = False
self.cache = SpeedCDCache(self) self.cache = SpeedCDCache(self)
self.url = self.urls['base_url'] self.url = self.urls['base_url']
@ -59,7 +65,7 @@ class SpeedCDProvider(generic.TorrentProvider):
self.categories = {'Season': {'c14':1}, 'Episode': {'c2':1, 'c49':1}, 'RSS': {'c14':1, 'c2':1, 'c49':1}} self.categories = {'Season': {'c14':1}, 'Episode': {'c2':1, 'c49':1}, 'RSS': {'c14':1, 'c2':1, 'c49':1}}
def isEnabled(self): def isEnabled(self):
return sickbeard.SPEEDCD return self.enabled
def imageName(self): def imageName(self):
return 'speedcd.png' return 'speedcd.png'
@ -71,12 +77,10 @@ class SpeedCDProvider(generic.TorrentProvider):
def _doLogin(self): def _doLogin(self):
login_params = {'username': sickbeard.SPEEDCD_USERNAME, login_params = {'username': self.username,
'password': sickbeard.SPEEDCD_PASSWORD 'password': self.password
} }
self.session = requests.Session()
try: try:
response = self.session.post(self.urls['login'], data=login_params, timeout=30, verify=False) response = self.session.post(self.urls['login'], data=login_params, timeout=30, verify=False)
except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e: except (requests.exceptions.ConnectionError, requests.exceptions.HTTPError), e:
@ -157,7 +161,7 @@ class SpeedCDProvider(generic.TorrentProvider):
for torrent in torrents: for torrent in torrents:
if sickbeard.SPEEDCD_FREELEECH and not torrent['free']: if self.freeleech and not torrent['free']:
continue continue
title = re.sub('<[^>]*>', '', torrent['name']) title = re.sub('<[^>]*>', '', torrent['name'])
@ -245,8 +249,7 @@ class SpeedCDProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.SPEEDCD_RATIO return self.ratio
class SpeedCDCache(tvcache.TVCache): class SpeedCDCache(tvcache.TVCache):

View File

@ -63,6 +63,10 @@ class ThePirateBayProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.ratio = None
self.confirmed = False
self.cache = ThePirateBayCache(self) self.cache = ThePirateBayCache(self)
self.proxy = ThePirateBayWebproxy() self.proxy = ThePirateBayWebproxy()
@ -74,7 +78,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
self.re_title_url = '/torrent/(?P<id>\d+)/(?P<title>.*?)//1".+?(?P<url>magnet.*?)//1".+?(?P<seeders>\d+)</td>.+?(?P<leechers>\d+)</td>' self.re_title_url = '/torrent/(?P<id>\d+)/(?P<title>.*?)//1".+?(?P<url>magnet.*?)//1".+?(?P<seeders>\d+)</td>.+?(?P<leechers>\d+)</td>'
def isEnabled(self): def isEnabled(self):
return sickbeard.THEPIRATEBAY return self.enabled
def imageName(self): def imageName(self):
return 'thepiratebay.png' return 'thepiratebay.png'
@ -257,7 +261,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
continue continue
#Accept Torrent only from Good People for every Episode Search #Accept Torrent only from Good People for every Episode Search
if sickbeard.THEPIRATEBAY_TRUSTED and re.search('(VIP|Trusted|Helper)', torrent.group(0)) is None: if self.confirmed and re.search('(VIP|Trusted|Helper)', torrent.group(0)) is None:
logger.log(u"ThePirateBay Provider found result " + torrent.group( logger.log(u"ThePirateBay Provider found result " + torrent.group(
'title') + " but that doesn't seem like a trusted result so I'm ignoring it", logger.DEBUG) 'title') + " but that doesn't seem like a trusted result so I'm ignoring it", logger.DEBUG)
continue continue
@ -390,7 +394,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.THEPIRATEBAY_RATIO return self.ratio
class ThePirateBayCache(tvcache.TVCache): class ThePirateBayCache(tvcache.TVCache):
@ -445,14 +449,16 @@ class ThePirateBayWebproxy:
self.Type = 'GlypeProxy' self.Type = 'GlypeProxy'
self.param = 'browse.php?u=' self.param = 'browse.php?u='
self.option = '&b=32' self.option = '&b=32'
self.proxy = False
self.proxy_url = None
def isEnabled(self): def isEnabled(self):
""" Return True if we Choose to call TPB via Proxy """ """ Return True if we Choose to call TPB via Proxy """
return sickbeard.THEPIRATEBAY_PROXY return self.proxy
def getProxyURL(self): def getProxyURL(self):
""" Return the Proxy URL Choosen via Provider Setting """ """ Return the Proxy URL Choosen via Provider Setting """
return str(sickbeard.THEPIRATEBAY_PROXY_URL) return str(self.proxy_url)
def _buildURL(self, url): def _buildURL(self, url):
""" Return the Proxyfied URL of the page """ """ Return the Proxyfied URL of the page """

View File

@ -53,6 +53,12 @@ class TorrentDayProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.freeleech = False
self.cache = TorrentDayCache(self) self.cache = TorrentDayCache(self)
self.url = self.urls['base_url'] self.url = self.urls['base_url']
@ -63,7 +69,7 @@ class TorrentDayProvider(generic.TorrentProvider):
'RSS': {'c2': 1, 'c26': 1, 'c7': 1, 'c24': 1, 'c14': 1}} 'RSS': {'c2': 1, 'c26': 1, 'c7': 1, 'c24': 1, 'c14': 1}}
def isEnabled(self): def isEnabled(self):
return sickbeard.TORRENTDAY return self.enabled
def imageName(self): def imageName(self):
return 'torrentday.png' return 'torrentday.png'
@ -78,14 +84,14 @@ class TorrentDayProvider(generic.TorrentProvider):
if any(requests.utils.dict_from_cookiejar(self.session.cookies).values()): if any(requests.utils.dict_from_cookiejar(self.session.cookies).values()):
return True return True
if sickbeard.TORRENTDAY_UID and sickbeard.TORRENTDAY_HASH: if self.uid and self.hash:
requests.utils.add_dict_to_cookiejar(self.session.cookies, self.cookies) requests.utils.add_dict_to_cookiejar(self.session.cookies, self.cookies)
else: else:
login_params = {'username': sickbeard.TORRENTDAY_USERNAME, login_params = {'username': self.username,
'password': sickbeard.TORRENTDAY_PASSWORD, 'password': self.password,
'submit.x': 0, 'submit.x': 0,
'submit.y': 0 'submit.y': 0
} }
@ -105,11 +111,11 @@ class TorrentDayProvider(generic.TorrentProvider):
return False return False
if requests.utils.dict_from_cookiejar(self.session.cookies)['uid'] and requests.utils.dict_from_cookiejar(self.session.cookies)['pass']: if requests.utils.dict_from_cookiejar(self.session.cookies)['uid'] and requests.utils.dict_from_cookiejar(self.session.cookies)['pass']:
sickbeard.TORRENTDAY_UID = requests.utils.dict_from_cookiejar(self.session.cookies)['uid'] self.uid = requests.utils.dict_from_cookiejar(self.session.cookies)['uid']
sickbeard.TORRENTDAY_HASH = requests.utils.dict_from_cookiejar(self.session.cookies)['pass'] self.hash = requests.utils.dict_from_cookiejar(self.session.cookies)['pass']
self.cookies = {'uid': sickbeard.TORRENTDAY_UID, self.cookies = {'uid': self.uid,
'pass': sickbeard.TORRENTDAY_HASH 'pass': self.hash
} }
return True return True
@ -164,7 +170,7 @@ class TorrentDayProvider(generic.TorrentProvider):
results = [] results = []
items = {'Season': [], 'Episode': [], 'RSS': []} items = {'Season': [], 'Episode': [], 'RSS': []}
freeleech = '&free=on' if sickbeard.TORRENTDAY_FREELEECH else '' freeleech = '&free=on' if self.freeleech else ''
if not self._doLogin(): if not self._doLogin():
return [] return []
@ -179,7 +185,7 @@ class TorrentDayProvider(generic.TorrentProvider):
post_data = dict({'/browse.php?': None, 'cata': 'yes', 'jxt': 8, 'jxw': 'b', 'search': search_string}, post_data = dict({'/browse.php?': None, 'cata': 'yes', 'jxt': 8, 'jxw': 'b', 'search': search_string},
**self.categories[mode]) **self.categories[mode])
if sickbeard.TORRENTDAY_FREELEECH: if self.freeleech:
post_data.update({'free': 'on'}) post_data.update({'free': 'on'})
data = self.session.post(self.urls['search'], data=post_data).json() data = self.session.post(self.urls['search'], data=post_data).json()
@ -268,7 +274,7 @@ class TorrentDayProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.TORRENTDAY_RATIO return self.ratio
class TorrentDayCache(tvcache.TVCache): class TorrentDayCache(tvcache.TVCache):

View File

@ -54,6 +54,11 @@ class TorrentLeechProvider(generic.TorrentProvider):
self.supportsBacklog = True self.supportsBacklog = True
self.enabled = False
self.username = None
self.password = None
self.ratio = None
self.cache = TorrentLeechCache(self) self.cache = TorrentLeechCache(self)
self.url = self.urls['base_url'] self.url = self.urls['base_url']
@ -61,7 +66,7 @@ class TorrentLeechProvider(generic.TorrentProvider):
self.categories = "2,26,27,32" self.categories = "2,26,27,32"
def isEnabled(self): def isEnabled(self):
return sickbeard.TORRENTLEECH return self.enabled
def imageName(self): def imageName(self):
return 'torrentleech.png' return 'torrentleech.png'
@ -73,8 +78,8 @@ class TorrentLeechProvider(generic.TorrentProvider):
def _doLogin(self): def _doLogin(self):
login_params = {'username': sickbeard.TORRENTLEECH_USERNAME, login_params = {'username': self.username,
'password': sickbeard.TORRENTLEECH_PASSWORD, 'password': self.password,
'remember_me': 'on', 'remember_me': 'on',
'login': 'submit', 'login': 'submit',
} }
@ -267,7 +272,7 @@ class TorrentLeechProvider(generic.TorrentProvider):
return results return results
def seedRatio(self): def seedRatio(self):
return sickbeard.TORRENTLEECH_RATIO return self.ratio
class TorrentLeechCache(tvcache.TVCache): class TorrentLeechCache(tvcache.TVCache):

View File

@ -37,19 +37,25 @@ class TvTorrentsProvider(generic.TorrentProvider):
self.supportsBacklog = False self.supportsBacklog = False
self.enabled = False
self.hash = None
self.digest = None
self.ratio = None
self.options = None
self.cache = TvTorrentsCache(self) self.cache = TvTorrentsCache(self)
self.url = 'http://www.tvtorrents.com/' self.url = 'http://www.tvtorrents.com/'
def isEnabled(self): def isEnabled(self):
return sickbeard.TVTORRENTS return self.enabled
def imageName(self): def imageName(self):
return 'tvtorrents.png' return 'tvtorrents.png'
def _checkAuth(self): def _checkAuth(self):
if not sickbeard.TVTORRENTS_DIGEST or not sickbeard.TVTORRENTS_HASH: if not self.digest or not self.hash:
raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.") raise AuthException("Your authentication credentials for " + self.name + " are missing, check your config.")
return True return True
@ -70,7 +76,7 @@ class TvTorrentsProvider(generic.TorrentProvider):
return True return True
def seedRatio(self): def seedRatio(self):
return sickbeard.TVTORRENTS_RATIO return self.ratio
class TvTorrentsCache(tvcache.TVCache): class TvTorrentsCache(tvcache.TVCache):
@ -84,7 +90,7 @@ class TvTorrentsCache(tvcache.TVCache):
# These will be ignored on the serverside. # These will be ignored on the serverside.
ignore_regex = "all.month|month.of|season[\s\d]*complete" ignore_regex = "all.month|month.of|season[\s\d]*complete"
rss_url = self.provider.url + 'RssServlet?digest=' + sickbeard.TVTORRENTS_DIGEST + '&hash=' + sickbeard.TVTORRENTS_HASH + '&fname=true&exclude=(' + ignore_regex + ')' rss_url = self.provider.url + 'RssServlet?digest=' + provider.digest + '&hash=' + provider.hash + '&fname=true&exclude=(' + ignore_regex + ')'
logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG) logger.log(self.provider.name + u" cache update URL: " + rss_url, logger.DEBUG)
return self.getRSSFeed(rss_url) return self.getRSSFeed(rss_url)

View File

@ -316,13 +316,14 @@ def filterSearchResults(show, results):
return foundResults return foundResults
def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manualSearch=False): def searchProviders(queueItem, show, season, episodes, manualSearch=False):
threadName = threading.currentThread().name threadName = threading.currentThread().name
if seasonSearch: # check if we want to search for season packs instead of just season/episode
logger.log(u"Searching for " + show.name + " Season " + str(season) + " pack") seasonSearch = False
else: seasonEps = show.getAllEpisodes(season)
logger.log(u"Searching for episodes we need from " + show.name + " Season " + str(season)) if len(seasonEps) == len(episodes):
seasonSearch = True
providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()] providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]
@ -331,14 +332,26 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
logger.ERROR) logger.ERROR)
return queueItem return queueItem
def doSearch():
foundResults = {} foundResults = {}
for providerNum, provider in enumerate(providers): for providerNum, provider in enumerate(providers):
foundResults.setdefault(provider.name, {})
threading.currentThread().name = threadName + ":[" + provider.name + "]" threading.currentThread().name = threadName + ":[" + provider.name + "]"
foundResults.setdefault(provider.name, {})
searchCount = 0
search_mode = 'eponly'
if seasonSearch and provider.search_mode == 'sponly':
search_mode = provider.search_mode
while(True):
searchCount += 1
if search_mode == 'sponly':
logger.log(u"Searching for " + show.name + " Season " + str(season) + " pack")
else:
logger.log(u"Searching for episodes we need from " + show.name + " Season " + str(season))
try: try:
curResults = provider.findSearchResults(show, season, episodes, seasonSearch, manualSearch) searchResults = provider.findSearchResults(show, season, episodes, search_mode, manualSearch)
except exceptions.AuthException, e: except exceptions.AuthException, e:
logger.log(u"Authentication error: " + ex(e), logger.ERROR) logger.log(u"Authentication error: " + ex(e), logger.ERROR)
continue continue
@ -347,10 +360,18 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
logger.log(traceback.format_exc(), logger.DEBUG) logger.log(traceback.format_exc(), logger.DEBUG)
continue continue
if not len(curResults): if len(searchResults) and not provider.search_fallback or searchCount == 2:
continue foundResults[provider.name] = filterSearchResults(show, searchResults)
break
foundResults[provider.name] = filterSearchResults(show, curResults) if search_mode == 'sponly':
logger.log(u"FALLBACK EPISODE SEARCH INITIATED ...")
search_mode = 'eponly'
else:
logger.log(u"FALLBACK SEASON PACK SEARCH INITIATED ...")
search_mode = 'eponly'
# skip to next provider if we have no results to process
if not len(foundResults[provider.name]): if not len(foundResults[provider.name]):
continue continue
@ -561,6 +582,3 @@ def searchProviders(queueItem, show, season, episodes, seasonSearch=False, manua
continue continue
return queueItem return queueItem
results = doSearch()
return results

View File

@ -98,7 +98,7 @@ class ManualSearchQueueItem(generic_queue.QueueItem):
try: try:
logger.log("Beginning manual search for [" + self.segment.prettyName() + "]") logger.log("Beginning manual search for [" + self.segment.prettyName() + "]")
searchResult = search.searchProviders(self, self.show, self.segment.season, [self.segment],False,True) searchResult = search.searchProviders(self, self.show, self.segment.season, [self.segment], True)
if searchResult: if searchResult:
SearchQueue().snatch_item(searchResult) SearchQueue().snatch_item(searchResult)
@ -131,15 +131,9 @@ class BacklogQueueItem(generic_queue.QueueItem):
wantedEps = self.segment[season] wantedEps = self.segment[season]
# check if we want to search for season packs instead of just season/episode
seasonSearch = False
seasonEps = self.show.getAllEpisodes(season)
if len(seasonEps) == len(wantedEps) and not sickbeard.PREFER_EPISODE_RELEASES:
seasonSearch = True
try: try:
logger.log("Beginning backlog search for [" + self.show.name + "]") logger.log("Beginning backlog search for [" + self.show.name + "]")
searchResult = search.searchProviders(self, self.show, season, wantedEps, seasonSearch, False) searchResult = search.searchProviders(self, self.show, season, wantedEps, False)
if searchResult: if searchResult:
SearchQueue().snatch_item(searchResult) SearchQueue().snatch_item(searchResult)
@ -182,7 +176,7 @@ class FailedQueueItem(generic_queue.QueueItem):
if len(failed_episodes): if len(failed_episodes):
try: try:
searchResult = search.searchProviders(self, self.show, failed_episodes[0].season, failed_episodes, False, True) searchResult = search.searchProviders(self, self.show, failed_episodes[0].season, failed_episodes, True)
if searchResult: if searchResult:
SearchQueue().snatch_item(searchResult) SearchQueue().snatch_item(searchResult)

View File

@ -1449,24 +1449,7 @@ class ConfigProviders:
return '1' return '1'
@cherrypy.expose @cherrypy.expose
def saveProviders(self, newznab_string='', torrentrss_string='', def saveProviders(self, newznab_string='', torrentrss_string='', provider_order=None, **kwargs):
omgwtfnzbs_username=None, omgwtfnzbs_apikey=None,
ezrss_ratio=None,
tvtorrents_digest=None, tvtorrents_hash=None, tvtorrents_ratio=None,
btn_api_key=None, btn_ratio=None,
thepiratebay_ratio=None, thepiratebay_trusted=None, thepiratebay_proxy=None, thepiratebay_proxy_url=None,
torrentleech_username=None, torrentleech_password=None, torrentleech_ratio=None,
iptorrents_username=None, iptorrents_password=None, iptorrents_ratio=None, iptorrents_freeleech=None,
kat_trusted=None, kat_ratio=None, kat_verified=None,
publichd_ratio=None,
scc_username=None, scc_password=None, scc_ratio=None,
hdtorrents_username=None, hdtorrents_password=None, hdtorrents_ratio=None,
torrentday_username=None, torrentday_password=None, torrentday_ratio=None, torrentday_freeleech=None,
hdbits_username=None, hdbits_passkey=None, hdbits_ratio=None,
nextgen_username=None, nextgen_password=None, nextgen_ratio=None,
newzbin_username=None, newzbin_password=None,
speedcd_username=None, speedcd_password=None, speedcd_ratio=None, speedcd_freeleech=None,
provider_order=None):
results = [] results = []
@ -1487,9 +1470,7 @@ class ConfigProviders:
cur_name, cur_url, cur_key = curNewznabProviderStr.split('|') cur_name, cur_url, cur_key = curNewznabProviderStr.split('|')
cur_url = config.clean_url(cur_url) cur_url = config.clean_url(cur_url)
newProvider = newznab.NewznabProvider(cur_name, cur_url, key=cur_key) newProvider = newznab.NewznabProvider(cur_name, cur_url, key=cur_key)
cur_id = newProvider.getID() cur_id = newProvider.getID()
# if it already exists then update it # if it already exists then update it
@ -1503,7 +1484,28 @@ class ConfigProviders:
else: else:
newznabProviderDict[cur_id].needs_auth = True newznabProviderDict[cur_id].needs_auth = True
try:
newznabProviderDict[cur_id].search_mode = kwargs[cur_id + '_search_mode'].strip()
except:
newznabProviderDict[cur_id].search_mode = 'eponly'
try:
newznabProviderDict[cur_id].search_fallback = config.checkbox_to_value(
kwargs[cur_id + '_search_fallback'])
except:
newznabProviderDict[cur_id].search_fallback = 0
else: else:
try:
newProvider.search_mode = kwargs[cur_id + '_search_mode'].strip()
except:
newProvider.search_mode = 'eponly'
try:
newProvider.search_fallback = config.checkbox_to_value(
kwargs[cur_id + '_search_fallback'])
except:
newProvider.search_fallback = 0
sickbeard.newznabProviderList.append(newProvider) sickbeard.newznabProviderList.append(newProvider)
finishedNames.append(cur_id) finishedNames.append(cur_id)
@ -1557,120 +1559,91 @@ class ConfigProviders:
provider_list.append(curProvider) provider_list.append(curProvider)
if curProvider == 'nzbs_org_old': # dynamically set providers enabled/disabled
sickbeard.NZBS = curEnabled for provider in sickbeard.providers.sortedProviderList():
elif curProvider == 'newzbin': if provider.getID() != curProvider or not hasattr(provider, 'enabled'):
sickbeard.NEWZBIN = curEnabled continue
elif curProvider == 'bin_req':
sickbeard.BINREQ = curEnabled
elif curProvider == 'womble_s_index':
sickbeard.WOMBLE = curEnabled
elif curProvider == 'omgwtfnzbs':
sickbeard.OMGWTFNZBS = curEnabled
elif curProvider == 'ezrss':
sickbeard.EZRSS = curEnabled
elif curProvider == 'tvtorrents':
sickbeard.TVTORRENTS = curEnabled
elif curProvider == 'torrentleech':
sickbeard.TORRENTLEECH = curEnabled
elif curProvider == 'btn':
sickbeard.BTN = curEnabled
elif curProvider == 'thepiratebay':
sickbeard.THEPIRATEBAY = curEnabled
elif curProvider == 'torrentleech':
sickbeard.TORRENTLEECH = curEnabled
elif curProvider == 'iptorrents':
sickbeard.IPTORRENTS = curEnabled
elif curProvider == 'omgwtfnzbs':
sickbeard.OMGWTFNZBS = curEnabled
elif curProvider == 'kickasstorrents':
sickbeard.KAT = curEnabled
elif curProvider == 'publichd':
sickbeard.PUBLICHD = curEnabled
elif curProvider == 'sceneaccess':
sickbeard.SCC = curEnabled
elif curProvider == 'hdtorrents':
sickbeard.HDTORRENTS = curEnabled
elif curProvider == 'torrentday':
sickbeard.TORRENTDAY = curEnabled
elif curProvider == 'hdbits':
sickbeard.HDBITS = curEnabled
elif curProvider == 'nextgen':
sickbeard.NEXTGEN = curEnabled
elif curProvider == 'speedcd':
sickbeard.SPEEDCD = curEnabled
elif curProvider in newznabProviderDict:
newznabProviderDict[curProvider].enabled = bool(curEnabled)
elif curProvider in torrentRssProviderDict:
torrentRssProviderDict[curProvider].enabled = bool(curEnabled)
else:
logger.log(u"don't know what " + curProvider + " is, skipping")
sickbeard.EZRSS_RATIO = ezrss_ratio provider.enabled = curEnabled
sickbeard.TVTORRENTS_DIGEST = tvtorrents_digest.strip() # dynamically load provider settings
sickbeard.TVTORRENTS_HASH = tvtorrents_hash.strip() for curTorrentProvider in [curProvider for curProvider in sickbeard.providers.sortedProviderList() if
sickbeard.TVTORRENTS_RATIO = config.to_int(tvtorrents_ratio) curProvider.providerType == sickbeard.GenericProvider.TORRENT]:
sickbeard.BTN_API_KEY = btn_api_key.strip() if hasattr(curTorrentProvider, 'ratio'):
sickbeard.BTN_RATIO = btn_ratio try:
curTorrentProvider.ratio = kwargs[curTorrentProvider.getID() + '_ratio'].strip()
except:
curTorrentProvider.ratio = None
sickbeard.THEPIRATEBAY_RATIO = thepiratebay_ratio if hasattr(curTorrentProvider, 'digest'):
sickbeard.THEPIRATEBAY_TRUSTED = config.checkbox_to_value(thepiratebay_trusted) try:
curTorrentProvider.digest = kwargs[curTorrentProvider.getID() + '_digest'].strip()
except:
curTorrentProvider.digest = None
thepiratebay_proxy = config.checkbox_to_value(thepiratebay_proxy) if hasattr(curTorrentProvider, 'hash'):
if thepiratebay_proxy: try:
sickbeard.THEPIRATEBAY_PROXY_URL = thepiratebay_proxy_url.strip() curTorrentProvider.hash = kwargs[curTorrentProvider.getID() + '_hash'].strip()
else: except:
sickbeard.THEPIRATEBAY_PROXY_URL = "" curTorrentProvider.hash = None
sickbeard.THEPIRATEBAY_PROXY = thepiratebay_proxy if hasattr(curTorrentProvider, 'api_key'):
try:
curTorrentProvider.api_key = kwargs[curTorrentProvider.getID() + '_api_key'].strip()
except:
curTorrentProvider.api_key = None
sickbeard.TORRENTLEECH_USERNAME = torrentleech_username if hasattr(curTorrentProvider, 'username'):
sickbeard.TORRENTLEECH_PASSWORD = torrentleech_password try:
sickbeard.TORRENTLEECH_RATIO = torrentleech_ratio curTorrentProvider.username = kwargs[curTorrentProvider.getID() + '_username'].strip()
except:
curTorrentProvider.username = None
sickbeard.IPTORRENTS_USERNAME = iptorrents_username.strip() if hasattr(curTorrentProvider, 'password'):
sickbeard.IPTORRENTS_PASSWORD = iptorrents_password.strip() try:
sickbeard.IPTORRENTS_RATIO = iptorrents_ratio curTorrentProvider.password = kwargs[curTorrentProvider.getID() + '_password'].strip()
except:
curTorrentProvider.password = None
sickbeard.IPTORRENTS_FREELEECH = config.checkbox_to_value(iptorrents_freeleech) if hasattr(curTorrentProvider, 'confirmed'):
try:
curTorrentProvider.confirmed = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_confirmed'])
except:
curTorrentProvider.confirmed = 0
sickbeard.KAT_TRUSTED = config.checkbox_to_value(kat_trusted) if hasattr(curTorrentProvider, 'proxy'):
sickbeard.KAT_RATIO = kat_ratio try:
sickbeard.KAT_VERIFIED = config.checkbox_to_value(kat_verified) curTorrentProvider.proxy = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_proxy'])
except:
curTorrentProvider.proxy = 0
sickbeard.PUBLICHD_RATIO = publichd_ratio if hasattr(curTorrentProvider, 'proxy_url'):
try:
curTorrentProvider.proxy_url = kwargs[curTorrentProvider.getID() + '_proxy_url'].strip()
except:
curTorrentProvider.proxy_url = None
sickbeard.TORRENTDAY_USERNAME = torrentday_username.strip() if hasattr(curTorrentProvider, 'freeleech'):
sickbeard.TORRENTDAY_PASSWORD = torrentday_password.strip() try:
sickbeard.TORRENTDAY_RATIO = torrentday_ratio curTorrentProvider.freeleech = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_freeleech'])
except:
curTorrentProvider.freeleech = 0
sickbeard.TORRENTDAY_FREELEECH = config.checkbox_to_value(torrentday_freeleech) if hasattr(curTorrentProvider, 'search_mode'):
try:
curTorrentProvider.search_mode = kwargs[curTorrentProvider.getID() + '_search_mode'].strip()
except:
curTorrentProvider.search_mode = 'eponly'
sickbeard.SCC_USERNAME = scc_username.strip() if hasattr(curTorrentProvider, 'search_fallback'):
sickbeard.SCC_PASSWORD = scc_password.strip() try:
sickbeard.SCC_RATIO = scc_ratio curTorrentProvider.search_fallback = config.checkbox_to_value(kwargs[curTorrentProvider.getID() + '_search_fallback'])
except:
curTorrentProvider.search_fallback = 0
sickbeard.HDTORRENTS_USERNAME = hdtorrents_username.strip() sickbeard.OMGWTFNZBS_USERNAME = kwargs['omgwtfnzbs_username'].strip()
sickbeard.HDTORRENTS_PASSWORD = hdtorrents_password.strip() sickbeard.OMGWTFNZBS_APIKEY = kwargs['omgwtfnzbs_apikey'].strip()
sickbeard.HDTORRENTS_RATIO = hdtorrents_ratio
sickbeard.HDBITS_USERNAME = hdbits_username.strip()
sickbeard.HDBITS_PASSKEY = hdbits_passkey.strip()
sickbeard.HDBITS_RATIO = hdbits_ratio
sickbeard.OMGWTFNZBS_USERNAME = omgwtfnzbs_username.strip()
sickbeard.OMGWTFNZBS_APIKEY = omgwtfnzbs_apikey.strip()
sickbeard.NEXTGEN_USERNAME = nextgen_username.strip()
sickbeard.NEXTGEN_PASSWORD = nextgen_password.strip()
sickbeard.NEXTGEN_RATIO = nextgen_ratio
sickbeard.SPEEDCD_USERNAME = speedcd_username.strip()
sickbeard.SPEEDCD_PASSWORD = speedcd_password.strip()
sickbeard.SPEEDCD_RATIO = speedcd_ratio
sickbeard.SPEEDCD_FREELEECH = config.checkbox_to_value(speedcd_freeleech)
sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList]) sickbeard.NEWZNAB_DATA = '!!!'.join([x.configStr() for x in sickbeard.newznabProviderList])
sickbeard.PROVIDER_ORDER = provider_list sickbeard.PROVIDER_ORDER = provider_list