Fixed TypeError: string indices must be integers error when mapping indexer id's

Added full delete feature to mass update, removes show from SR and deletes show folder from hard drive. Remove will just delete show from SR without deleting files from hard drive

Fixed XML errors for TVRage indexer api
This commit is contained in:
echel0n 2014-08-29 10:05:15 -07:00
parent 3cb1c573a3
commit 00a1ebfee3
5 changed files with 54 additions and 44 deletions

View file

@ -102,6 +102,7 @@
#end if
<!-- <th>Force Metadata Regen <input type="checkbox" class="bulkCheck" id="metadataCheck" /></th>//-->
<th width="1%">Delete<br/><input type="checkbox" class="bulkCheck" id="deleteCheck" /></th>
<th width="1%">Remove<br/><input type="checkbox" class="bulkCheck" id="removeCheck" /></th>
</tr>
</thead>
<tfoot>
@ -120,6 +121,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
#set $curRename_disabled = ""
#set $curSubtitle_disabled = ""
#set $curDelete_disabled = ""
#set $curRemove_disabled = ""
#if $sickbeard.showQueueScheduler.action.isBeingUpdated($curShow) or $sickbeard.showQueueScheduler.action.isInUpdateQueue($curShow):
#set $curUpdate_disabled = "disabled=\"disabled\" "
@ -141,6 +143,10 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
#set $curDelete = "disabled=\"disabled\" "
#end if
#set $curDelete = "<input type=\"checkbox\" class=\"deleteCheck\" id=\"delete-"+str($curShow.indexerid)+"\" "+$curDelete_disabled+"/>"
#if $sickbeard.showQueueScheduler.action.isBeingRenamed($curShow) or $sickbeard.showQueueScheduler.action.isInRenameQueue($curShow) or $sickbeard.showQueueScheduler.action.isInRefreshQueue($curShow):
#set $curRemove = "disabled=\"disabled\" "
#end if
#set $curRemove = "<input type=\"checkbox\" class=\"removeCheck\" id=\"remove-"+str($curShow.indexerid)+"\" "+$curRemove_disabled+"/>"
<tr>
<td align="center"><input type="checkbox" class="editCheck" id="edit-$curShow.indexerid" /></td>
@ -163,6 +169,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
<td align="center">$curSubtitle</td>
#end if
<td align="center">$curDelete</td>
<td align="center">$curRemove</td>
</tr>
#end for
</tbody>

View file

@ -24,6 +24,7 @@ $(document).ready(function(){
var renameArr = new Array()
var subtitleArr = new Array()
var deleteArr = new Array()
var removeArr = new Array()
var metadataArr = new Array()
$('.updateCheck').each(function() {
@ -56,6 +57,12 @@ $(document).ready(function(){
}
});
$('.removeCheck').each(function() {
if (this.checked == true) {
removeArr.push($(this).attr('id').split('-')[1])
}
});
/*
$('.metadataCheck').each(function() {
if (this.checked == true) {
@ -63,10 +70,10 @@ $(document).ready(function(){
}
});
*/
if (updateArr.length+refreshArr.length+renameArr.length+subtitleArr.length+deleteArr.length+metadataArr.length == 0)
if (updateArr.length+refreshArr.length+renameArr.length+subtitleArr.length+deleteArr.length+removeArr.length+metadataArr.length == 0)
return false
url = 'massUpdate?toUpdate='+updateArr.join('|')+'&toRefresh='+refreshArr.join('|')+'&toRename='+renameArr.join('|')+'&toSubtitle='+subtitleArr.join('|')+'&toDelete='+deleteArr.join('|')+'&toMetadata='+metadataArr.join('|')
url = 'massUpdate?toUpdate='+updateArr.join('|')+'&toRefresh='+refreshArr.join('|')+'&toRename='+renameArr.join('|')+'&toSubtitle='+subtitleArr.join('|')+'&toDelete='+deleteArr.join('|')+'&toRemove='+removeArr.join('|')+'&toMetadata='+metadataArr.join('|')
window.location.href = url
@ -83,7 +90,7 @@ $(document).ready(function(){
});
});
['.editCheck', '.updateCheck', '.refreshCheck', '.renameCheck', '.deleteCheck'].forEach(function(name) {
['.editCheck', '.updateCheck', '.refreshCheck', '.renameCheck', '.deleteCheck', '.removeCheck'].forEach(function(name) {
var lastCheck = null;
$(name).click(function(event) {

View file

@ -628,21 +628,10 @@ class Tvdb:
"""Loads a URL using caching, returns an ElementTree of the source
"""
try:
src = self._loadUrl(url, params=params, language=language)
src = [src[item] for item in src][0] if src else []
except:
errormsg = "There was an error with the XML retrieved from thetvdb.com:"
if self.config['cache_enabled']:
errormsg += "\nFirst try emptying the cache folder at..\n%s" % (
self.config['cache_location']
)
errormsg += "\nIf this does not resolve the issue, please try again later. If the error persists, report a bug on"
errormsg += "\nhttp://dbr.lighthouseapp.com/projects/13342-tvdb_api/overview\n"
raise tvdb_error(errormsg)
src = self._loadUrl(url, params=params, language=language).values()[0]
return src
except:
return []
def _setItem(self, sid, seas, ep, attrib, value):
"""Creates a new episode, creating Show(), Season() and
@ -692,8 +681,12 @@ class Tvdb:
series = series.encode("utf-8")
log().debug("Searching for show %s" % series)
self.config['params_getSeries']['seriesname'] = series
seriesEt = self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries'])
return [seriesEt[item] for item in seriesEt][0] if seriesEt else []
try:
seriesFound = self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries']).values()[0]
return seriesFound
except:
return []
def _getSeries(self, series):
"""This searches TheTVDB.com for the series name,

View file

@ -393,7 +393,6 @@ class TVRage:
except ImportError:
return os.path.join(tempfile.gettempdir(), "tvrage_api")
return os.path.join(tempfile.gettempdir(), "tvrage_api-%s" % (uid))
#@retry(tvrage_error)
@ -489,20 +488,10 @@ class TVRage:
"""
try:
src = self._loadUrl(url, params)
src = [src[item] for item in src][0] if src else []
except:
errormsg = "There was an error with the XML retrieved from tvrage.com"
if self.config['cache_enabled']:
errormsg += "\nFirst try emptying the cache folder at..\n%s" % (
self.config['cache_location']
)
errormsg += "\nIf this does not resolve the issue, please try again later. If the error persists, report a bug on\n"
raise tvrage_error(errormsg)
src = self._loadUrl(url, params).values()[0]
return src
except:
return []
def _setItem(self, sid, seas, ep, attrib, value):
"""Creates a new episode, creating Show(), Season() and
@ -557,8 +546,12 @@ class TVRage:
series = series.encode("utf-8")
log().debug("Searching for show %s" % series)
self.config['params_getSeries']['show'] = series
seriesEt = self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries'])
return [seriesEt[item] for item in seriesEt][0] if seriesEt else []
try:
seriesFound = self._getetsrc(self.config['url_getSeries'], self.config['params_getSeries']).values()[0]
return seriesFound
except:
return []
def _getSeries(self, series):
"""This searches tvrage.com for the series name,

View file

@ -1134,7 +1134,7 @@ class Manage(MainHandler):
redirect("/manage/")
def massUpdate(self, toUpdate=None, toRefresh=None, toRename=None, toDelete=None, toMetadata=None, toSubtitle=None):
def massUpdate(self, toUpdate=None, toRefresh=None, toRename=None, toDelete=None, toRemove=None, toMetadata=None, toSubtitle=None):
if toUpdate is not None:
toUpdate = toUpdate.split('|')
@ -1161,6 +1161,11 @@ class Manage(MainHandler):
else:
toDelete = []
if toRemove is not None:
toRemove = toRemove.split('|')
else:
toRemove = []
if toMetadata is not None:
toMetadata = toMetadata.split('|')
else:
@ -1172,7 +1177,7 @@ class Manage(MainHandler):
renames = []
subtitles = []
for curShowID in set(toUpdate + toRefresh + toRename + toSubtitle + toDelete + toMetadata):
for curShowID in set(toUpdate + toRefresh + toRename + toSubtitle + toDelete + toRemove + toMetadata):
if curShowID == '':
continue
@ -1183,10 +1188,15 @@ class Manage(MainHandler):
continue
if curShowID in toDelete:
showObj.deleteShow()
showObj.deleteShow(True)
# don't do anything else if it's being deleted
continue
if curShowID in toRemove:
showObj.deleteShow()
# don't do anything else if it's being remove
continue
if curShowID in toUpdate:
try:
sickbeard.showQueueScheduler.action.updateShow(showObj, True) # @UndefinedVariable