mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
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:
parent
3cb1c573a3
commit
00a1ebfee3
@ -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>
|
||||
|
@ -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) {
|
||||
|
@ -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 []
|
||||
src = self._loadUrl(url, params=params, language=language).values()[0]
|
||||
return src
|
||||
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)
|
||||
|
||||
return src
|
||||
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,
|
||||
|
@ -1,5 +1,5 @@
|
||||
# !/usr/bin/env python2
|
||||
#encoding:utf-8
|
||||
# encoding:utf-8
|
||||
#author:echel0n
|
||||
#project:tvrage_api
|
||||
#repository:http://github.com/echel0n/tvrage_api
|
||||
@ -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)
|
||||
@ -455,7 +454,7 @@ class TVRage:
|
||||
if key == 'genre':
|
||||
value = value['genre']
|
||||
if not value:
|
||||
value=[]
|
||||
value = []
|
||||
if not isinstance(value, list):
|
||||
value = [value]
|
||||
value = filter(None, value)
|
||||
@ -470,9 +469,9 @@ class TVRage:
|
||||
value = parse(value, fuzzy=True).date()
|
||||
value = value.strftime("%Y-%m-%d")
|
||||
|
||||
#if key == 'airs_time':
|
||||
# value = parse(value).time()
|
||||
# value = value.strftime("%I:%M %p")
|
||||
#if key == 'airs_time':
|
||||
# value = parse(value).time()
|
||||
# value = value.strftime("%I:%M %p")
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -489,20 +488,10 @@ class TVRage:
|
||||
"""
|
||||
|
||||
try:
|
||||
src = self._loadUrl(url, params)
|
||||
src = [src[item] for item in src][0] if src else []
|
||||
src = self._loadUrl(url, params).values()[0]
|
||||
return src
|
||||
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)
|
||||
|
||||
return src
|
||||
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,
|
||||
@ -632,7 +625,7 @@ class TVRage:
|
||||
ep_no = int(episode['episodenumber'])
|
||||
self._setItem(sid, seas_no, ep_no, 'seasonnumber', seas_no)
|
||||
|
||||
for k,v in episode.items():
|
||||
for k, v in episode.items():
|
||||
try:
|
||||
k = k.lower()
|
||||
if v is not None:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user