mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-16 14:25:02 -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
|
#end if
|
||||||
<!-- <th>Force Metadata Regen <input type="checkbox" class="bulkCheck" id="metadataCheck" /></th>//-->
|
<!-- <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%">Delete<br/><input type="checkbox" class="bulkCheck" id="deleteCheck" /></th>
|
||||||
|
<th width="1%">Remove<br/><input type="checkbox" class="bulkCheck" id="removeCheck" /></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
@ -120,6 +121,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
|||||||
#set $curRename_disabled = ""
|
#set $curRename_disabled = ""
|
||||||
#set $curSubtitle_disabled = ""
|
#set $curSubtitle_disabled = ""
|
||||||
#set $curDelete_disabled = ""
|
#set $curDelete_disabled = ""
|
||||||
|
#set $curRemove_disabled = ""
|
||||||
|
|
||||||
#if $sickbeard.showQueueScheduler.action.isBeingUpdated($curShow) or $sickbeard.showQueueScheduler.action.isInUpdateQueue($curShow):
|
#if $sickbeard.showQueueScheduler.action.isBeingUpdated($curShow) or $sickbeard.showQueueScheduler.action.isInUpdateQueue($curShow):
|
||||||
#set $curUpdate_disabled = "disabled=\"disabled\" "
|
#set $curUpdate_disabled = "disabled=\"disabled\" "
|
||||||
@ -141,6 +143,10 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
|||||||
#set $curDelete = "disabled=\"disabled\" "
|
#set $curDelete = "disabled=\"disabled\" "
|
||||||
#end if
|
#end if
|
||||||
#set $curDelete = "<input type=\"checkbox\" class=\"deleteCheck\" id=\"delete-"+str($curShow.indexerid)+"\" "+$curDelete_disabled+"/>"
|
#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>
|
<tr>
|
||||||
<td align="center"><input type="checkbox" class="editCheck" id="edit-$curShow.indexerid" /></td>
|
<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>
|
<td align="center">$curSubtitle</td>
|
||||||
#end if
|
#end if
|
||||||
<td align="center">$curDelete</td>
|
<td align="center">$curDelete</td>
|
||||||
|
<td align="center">$curRemove</td>
|
||||||
</tr>
|
</tr>
|
||||||
#end for
|
#end for
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -24,6 +24,7 @@ $(document).ready(function(){
|
|||||||
var renameArr = new Array()
|
var renameArr = new Array()
|
||||||
var subtitleArr = new Array()
|
var subtitleArr = new Array()
|
||||||
var deleteArr = new Array()
|
var deleteArr = new Array()
|
||||||
|
var removeArr = new Array()
|
||||||
var metadataArr = new Array()
|
var metadataArr = new Array()
|
||||||
|
|
||||||
$('.updateCheck').each(function() {
|
$('.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() {
|
$('.metadataCheck').each(function() {
|
||||||
if (this.checked == true) {
|
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
|
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
|
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;
|
var lastCheck = null;
|
||||||
|
|
||||||
$(name).click(function(event) {
|
$(name).click(function(event) {
|
||||||
|
@ -628,21 +628,10 @@ class Tvdb:
|
|||||||
"""Loads a URL using caching, returns an ElementTree of the source
|
"""Loads a URL using caching, returns an ElementTree of the source
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
src = self._loadUrl(url, params=params, language=language)
|
src = self._loadUrl(url, params=params, language=language).values()[0]
|
||||||
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)
|
|
||||||
|
|
||||||
return src
|
return src
|
||||||
|
except:
|
||||||
|
return []
|
||||||
|
|
||||||
def _setItem(self, sid, seas, ep, attrib, value):
|
def _setItem(self, sid, seas, ep, attrib, value):
|
||||||
"""Creates a new episode, creating Show(), Season() and
|
"""Creates a new episode, creating Show(), Season() and
|
||||||
@ -692,8 +681,12 @@ class Tvdb:
|
|||||||
series = series.encode("utf-8")
|
series = series.encode("utf-8")
|
||||||
log().debug("Searching for show %s" % series)
|
log().debug("Searching for show %s" % series)
|
||||||
self.config['params_getSeries']['seriesname'] = 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):
|
def _getSeries(self, series):
|
||||||
"""This searches TheTVDB.com for the series name,
|
"""This searches TheTVDB.com for the series name,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# !/usr/bin/env python2
|
# !/usr/bin/env python2
|
||||||
#encoding:utf-8
|
# encoding:utf-8
|
||||||
#author:echel0n
|
#author:echel0n
|
||||||
#project:tvrage_api
|
#project:tvrage_api
|
||||||
#repository:http://github.com/echel0n/tvrage_api
|
#repository:http://github.com/echel0n/tvrage_api
|
||||||
@ -393,7 +393,6 @@ class TVRage:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
return os.path.join(tempfile.gettempdir(), "tvrage_api")
|
return os.path.join(tempfile.gettempdir(), "tvrage_api")
|
||||||
|
|
||||||
|
|
||||||
return os.path.join(tempfile.gettempdir(), "tvrage_api-%s" % (uid))
|
return os.path.join(tempfile.gettempdir(), "tvrage_api-%s" % (uid))
|
||||||
|
|
||||||
#@retry(tvrage_error)
|
#@retry(tvrage_error)
|
||||||
@ -455,7 +454,7 @@ class TVRage:
|
|||||||
if key == 'genre':
|
if key == 'genre':
|
||||||
value = value['genre']
|
value = value['genre']
|
||||||
if not value:
|
if not value:
|
||||||
value=[]
|
value = []
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
value = [value]
|
value = [value]
|
||||||
value = filter(None, value)
|
value = filter(None, value)
|
||||||
@ -489,20 +488,10 @@ class TVRage:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
src = self._loadUrl(url, params)
|
src = self._loadUrl(url, params).values()[0]
|
||||||
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)
|
|
||||||
|
|
||||||
return src
|
return src
|
||||||
|
except:
|
||||||
|
return []
|
||||||
|
|
||||||
def _setItem(self, sid, seas, ep, attrib, value):
|
def _setItem(self, sid, seas, ep, attrib, value):
|
||||||
"""Creates a new episode, creating Show(), Season() and
|
"""Creates a new episode, creating Show(), Season() and
|
||||||
@ -557,8 +546,12 @@ class TVRage:
|
|||||||
series = series.encode("utf-8")
|
series = series.encode("utf-8")
|
||||||
log().debug("Searching for show %s" % series)
|
log().debug("Searching for show %s" % series)
|
||||||
self.config['params_getSeries']['show'] = 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):
|
def _getSeries(self, series):
|
||||||
"""This searches tvrage.com for the series name,
|
"""This searches tvrage.com for the series name,
|
||||||
@ -632,7 +625,7 @@ class TVRage:
|
|||||||
ep_no = int(episode['episodenumber'])
|
ep_no = int(episode['episodenumber'])
|
||||||
self._setItem(sid, seas_no, ep_no, 'seasonnumber', seas_no)
|
self._setItem(sid, seas_no, ep_no, 'seasonnumber', seas_no)
|
||||||
|
|
||||||
for k,v in episode.items():
|
for k, v in episode.items():
|
||||||
try:
|
try:
|
||||||
k = k.lower()
|
k = k.lower()
|
||||||
if v is not None:
|
if v is not None:
|
||||||
|
@ -1134,7 +1134,7 @@ class Manage(MainHandler):
|
|||||||
redirect("/manage/")
|
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:
|
if toUpdate is not None:
|
||||||
toUpdate = toUpdate.split('|')
|
toUpdate = toUpdate.split('|')
|
||||||
@ -1161,6 +1161,11 @@ class Manage(MainHandler):
|
|||||||
else:
|
else:
|
||||||
toDelete = []
|
toDelete = []
|
||||||
|
|
||||||
|
if toRemove is not None:
|
||||||
|
toRemove = toRemove.split('|')
|
||||||
|
else:
|
||||||
|
toRemove = []
|
||||||
|
|
||||||
if toMetadata is not None:
|
if toMetadata is not None:
|
||||||
toMetadata = toMetadata.split('|')
|
toMetadata = toMetadata.split('|')
|
||||||
else:
|
else:
|
||||||
@ -1172,7 +1177,7 @@ class Manage(MainHandler):
|
|||||||
renames = []
|
renames = []
|
||||||
subtitles = []
|
subtitles = []
|
||||||
|
|
||||||
for curShowID in set(toUpdate + toRefresh + toRename + toSubtitle + toDelete + toMetadata):
|
for curShowID in set(toUpdate + toRefresh + toRename + toSubtitle + toDelete + toRemove + toMetadata):
|
||||||
|
|
||||||
if curShowID == '':
|
if curShowID == '':
|
||||||
continue
|
continue
|
||||||
@ -1183,10 +1188,15 @@ class Manage(MainHandler):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if curShowID in toDelete:
|
if curShowID in toDelete:
|
||||||
showObj.deleteShow()
|
showObj.deleteShow(True)
|
||||||
# don't do anything else if it's being deleted
|
# don't do anything else if it's being deleted
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if curShowID in toRemove:
|
||||||
|
showObj.deleteShow()
|
||||||
|
# don't do anything else if it's being remove
|
||||||
|
continue
|
||||||
|
|
||||||
if curShowID in toUpdate:
|
if curShowID in toUpdate:
|
||||||
try:
|
try:
|
||||||
sickbeard.showQueueScheduler.action.updateShow(showObj, True) # @UndefinedVariable
|
sickbeard.showQueueScheduler.action.updateShow(showObj, True) # @UndefinedVariable
|
||||||
|
Loading…
Reference in New Issue
Block a user