Fixed issue with BTN provider.

Started to added in "archive on firstmatch" feature.
This commit is contained in:
echel0n 2014-03-18 06:50:13 -07:00
parent 5c0af16297
commit dbaf9955cb
8 changed files with 34 additions and 7 deletions

View file

@ -160,6 +160,10 @@
<tr><td class="showLegend">Flat Folders: </td><td><img src="$sbRoot/images/#if $show.flatten_folders == 1 or $sickbeard.NAMING_FORCE_FOLDERS then "yes16.png\" alt=\"Y" else "no16.png\" alt=\"N"#" width="16" height="16" /></td></tr>
<tr><td class="showLegend">Paused: </td><td><img src="$sbRoot/images/#if int($show.paused) == 1 then "yes16.png\" alt=\"Y" else "no16.png\" alt=\"N"#" width="16" height="16" /></td></tr>
<tr><td class="showLegend">Air-by-Date: </td><td><img src="$sbRoot/images/#if int($show.air_by_date) == 1 then "yes16.png\" alt=\"Y" else "no16.png\" alt=\"N"#" width="16" height="16" /></td></tr>
<tr><td class="showLegend">DVD Order: </td><td><img src="$sbRoot/images/#if int($show.dvdorder) == 1 then "yes16.png\" alt=\"Y" else "no16.png\" alt=\"N"#" width="16" height="16" /></td></tr>
#if $bestQualities
<tr><td class="showLegend">Archive First Match: </td><td><img src="$sbRoot/images/#if int($show.archive_firstmatch) == 1 then "yes16.png\" alt=\"Y" else "no16.png\" alt=\"N"#" width="16" height="16" /></td></tr>
#end if
#if $all_scene_exceptions:
<tr>
<td class="showLegend">Alternate Scene Names:</td>

View file

@ -44,4 +44,8 @@
</select>
</div>
</div>
<b>Archive on first match: </b>
<input type="checkbox" name="archive_firstmatch" #if $show.archive_firstmatch == 1 then "checked=\"checked\"" else ""# /><br />
(check this to have the show archived after first match and download from your archive quality choices)
<br />
</div>

View file

@ -27,7 +27,7 @@ from sickbeard import encodingKludge as ek
from sickbeard.name_parser.parser import NameParser, InvalidNameException
MIN_DB_VERSION = 9 # oldest db version we support migrating from
MAX_DB_VERSION = 25
MAX_DB_VERSION = 26
class MainSanityCheck(db.DBSanityCheck):
@ -560,3 +560,14 @@ class ConvertInfoToIndexerScheme(ConvertIMDBInfoToIndexerScheme):
self.connection.action("DROP TABLE tmp_info")
self.incDBVersion()
class AddArchiveFirstMatchOption(ConvertInfoToIndexerScheme):
def test(self):
return self.checkDBVersion() >= 26
def execute(self):
backupDatabase(26)
self.connection.action("ALTER TABLE tv_shows ADD archive_firstmatch NUMERIC")
self.incDBVersion()

View file

@ -306,8 +306,6 @@ def searchIndexersForShow(regShowName):
showNames = [re.sub('[. -]', ' ', regShowName),regShowName]
yearRegex = "([^()]+?)\s*(\()?(\d{4})(?(2)\))$"
for name in showNames:
for indexer in indexerStrings:
logger.log(u"Trying to find the " + name + " on " + indexer, logger.DEBUG)

View file

@ -741,6 +741,7 @@ class PostProcessor(object):
logger.log(self.file_name + u" looks like it has quality " + common.Quality.qualityStrings[ep_quality] + ", using that", logger.DEBUG)
return ep_quality
test = str(ep_quality)
return ep_quality
def _run_extra_scripts(self, ep_obj):
@ -845,6 +846,7 @@ class PostProcessor(object):
# get the quality of the episode we're processing
new_ep_quality = self._get_quality(ep_obj)
test = str(new_ep_quality)
logger.log(u"Quality of the episode we're processing: " + str(new_ep_quality), logger.DEBUG)
# see if this is a priority download (is it snatched, in history, or PROPER)

View file

@ -237,7 +237,7 @@ class BTNProvider(generic.TorrentProvider):
search_params = {'category': 'Episode'}
search_params['series'] = sanitizeSceneName(ep_obj.show_name)
search_params['series'] = sanitizeSceneName(ep_obj.show.name)
if ep_obj.show.air_by_date:
date_str = str(ep_obj.airdate)

View file

@ -78,6 +78,7 @@ class TVShow(object):
self.air_by_date = 0
self.subtitles = int(sickbeard.SUBTITLES_DEFAULT if sickbeard.SUBTITLES_DEFAULT else 0)
self.dvdorder = 0
self.archive_firstmatch = 0
self.lang = lang
self.last_update_indexer = 1
@ -662,6 +663,10 @@ class TVShow(object):
if not self.dvdorder:
self.dvdorder = 0
self.archive_firstmatch = sqlResults[0]["archive_firstmatch"]
if not self.archive_firstmatch:
self.archive_firstmatch = 0
self.quality = int(sqlResults[0]["quality"])
self.flatten_folders = int(sqlResults[0]["flatten_folders"])
self.paused = int(sqlResults[0]["paused"])
@ -924,6 +929,7 @@ class TVShow(object):
"air_by_date": self.air_by_date,
"subtitles": self.subtitles,
"dvdorder": self.dvdorder,
"archive_firstmatch": self.archive_firstmatch,
"startyear": self.startyear,
"lang": self.lang,
"imdb_id": self.imdbid,
@ -982,7 +988,7 @@ class TVShow(object):
# if we know we don't want it then just say no
if epStatus in (SKIPPED, IGNORED, ARCHIVED) and not manualSearch:
logger.log(u"Ep is skipped, not bothering", logger.DEBUG)
logger.log(u"Ep is skipped or marked as archived, not bothering", logger.DEBUG)
return False
# if it's one of these then we want it as long as it's in our allowed initial qualities

View file

@ -2805,7 +2805,7 @@ class Home:
return result['description'] if result else 'Episode not found.'
@cherrypy.expose
def editShow(self, show=None, location=None, anyQualities=[], bestQualities=[], exceptions_list=[], flatten_folders=None, paused=None, directCall=False, air_by_date=None, dvdorder=None, indexerLang=None, subtitles=None):
def editShow(self, show=None, location=None, anyQualities=[], bestQualities=[], exceptions_list=[], flatten_folders=None, paused=None, directCall=False, air_by_date=None, dvdorder=None, indexerLang=None, subtitles=None, archive_firstmatch=None):
if show == None:
errString = "Invalid show ID: " + str(show)
@ -2840,6 +2840,7 @@ class Home:
logger.log(u"flatten folders: " + str(flatten_folders))
dvdorder = config.checkbox_to_value(dvdorder)
archive_firstmatch = config.checkbox_to_value(archive_firstmatch)
paused = config.checkbox_to_value(paused)
air_by_date = config.checkbox_to_value(air_by_date)
subtitles = config.checkbox_to_value(subtitles)
@ -2888,6 +2889,7 @@ class Home:
showObj.subtitles = subtitles
showObj.lang = indexer_lang
showObj.dvdorder = dvdorder
showObj.archive_firstmatch = archive_firstmatch
# if we change location clear the db of episodes, change it, write to db, and rescan
if os.path.normpath(showObj._location) != os.path.normpath(location):