Removed all commented out db.close
This commit is contained in:
@@ -79,7 +79,6 @@ class CoreNotifier(Notification):
|
||||
q.update({Notif.read: True})
|
||||
|
||||
db.commit()
|
||||
#db.close()
|
||||
|
||||
return jsonified({
|
||||
'success': True
|
||||
@@ -107,7 +106,6 @@ class CoreNotifier(Notification):
|
||||
ndict['type'] = 'notification'
|
||||
notifications.append(ndict)
|
||||
|
||||
#db.close()
|
||||
return jsonified({
|
||||
'success': True,
|
||||
'empty': len(notifications) == 0,
|
||||
@@ -133,7 +131,6 @@ class CoreNotifier(Notification):
|
||||
|
||||
self.frontend(type = listener, data = data)
|
||||
|
||||
#db.close()
|
||||
return True
|
||||
|
||||
def frontend(self, type = 'notification', data = {}, message = None):
|
||||
|
||||
@@ -109,7 +109,6 @@ class FileManager(Plugin):
|
||||
db.commit()
|
||||
|
||||
type_dict = ft.to_dict()
|
||||
#db.close()
|
||||
return type_dict
|
||||
|
||||
def getTypes(self):
|
||||
@@ -122,5 +121,4 @@ class FileManager(Plugin):
|
||||
for type_object in results:
|
||||
types.append(type_object.to_dict())
|
||||
|
||||
#db.close()
|
||||
return types
|
||||
|
||||
@@ -53,7 +53,6 @@ class LibraryPlugin(Plugin):
|
||||
|
||||
library_dict = l.to_dict(self.default_dict)
|
||||
|
||||
#db.close()
|
||||
return library_dict
|
||||
|
||||
def update(self, identifier, default_title = '', force = False):
|
||||
|
||||
@@ -47,7 +47,6 @@ class ProfilePlugin(Plugin):
|
||||
for profile in profiles:
|
||||
temp.append(profile.to_dict(self.to_dict))
|
||||
|
||||
#db.close()
|
||||
return temp
|
||||
|
||||
def save(self):
|
||||
@@ -84,7 +83,6 @@ class ProfilePlugin(Plugin):
|
||||
|
||||
profile_dict = p.to_dict(self.to_dict)
|
||||
|
||||
#db.close()
|
||||
return jsonified({
|
||||
'success': True,
|
||||
'profile': profile_dict
|
||||
@@ -95,7 +93,6 @@ class ProfilePlugin(Plugin):
|
||||
db = get_session()
|
||||
default = db.query(Profile).first()
|
||||
default_dict = default.to_dict(self.to_dict)
|
||||
#db.close()
|
||||
|
||||
return default_dict
|
||||
|
||||
@@ -113,7 +110,6 @@ class ProfilePlugin(Plugin):
|
||||
order += 1
|
||||
|
||||
db.commit()
|
||||
#db.close()
|
||||
|
||||
return jsonified({
|
||||
'success': True
|
||||
@@ -137,8 +133,6 @@ class ProfilePlugin(Plugin):
|
||||
except Exception, e:
|
||||
message = log.error('Failed deleting Profile: %s', e)
|
||||
|
||||
#db.close()
|
||||
|
||||
return jsonified({
|
||||
'success': success,
|
||||
'message': message
|
||||
|
||||
@@ -69,7 +69,6 @@ class QualityPlugin(Plugin):
|
||||
q = mergeDicts(self.getQuality(quality.identifier), quality.to_dict())
|
||||
temp.append(q)
|
||||
|
||||
#db.close()
|
||||
return temp
|
||||
|
||||
def single(self, identifier = ''):
|
||||
@@ -81,7 +80,6 @@ class QualityPlugin(Plugin):
|
||||
if quality:
|
||||
quality_dict = dict(self.getQuality(quality.identifier), **quality.to_dict())
|
||||
|
||||
#db.close()
|
||||
return quality_dict
|
||||
|
||||
def getQuality(self, identifier):
|
||||
@@ -101,7 +99,6 @@ class QualityPlugin(Plugin):
|
||||
setattr(quality, params.get('value_type'), params.get('value'))
|
||||
db.commit()
|
||||
|
||||
#db.close()
|
||||
return jsonified({
|
||||
'success': True
|
||||
})
|
||||
|
||||
@@ -88,8 +88,6 @@ class Release(Plugin):
|
||||
|
||||
fireEvent('movie.restatus', movie.id)
|
||||
|
||||
#db.close()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -108,7 +106,6 @@ class Release(Plugin):
|
||||
|
||||
release_id = getParam('id')
|
||||
|
||||
#db.close()
|
||||
return jsonified({
|
||||
'success': self.delete(release_id)
|
||||
})
|
||||
@@ -152,7 +149,6 @@ class Release(Plugin):
|
||||
rel.status_id = available_status.get('id') if rel.status_id is ignored_status.get('id') else ignored_status.get('id')
|
||||
db.commit()
|
||||
|
||||
#db.close()
|
||||
return jsonified({
|
||||
'success': True
|
||||
})
|
||||
@@ -186,14 +182,12 @@ class Release(Plugin):
|
||||
rel.status_id = status_snatched.get('id')
|
||||
db.commit()
|
||||
|
||||
#db.close()
|
||||
return jsonified({
|
||||
'success': success
|
||||
})
|
||||
else:
|
||||
log.error('Couldn\'t find release with id: %s', id)
|
||||
|
||||
#db.close()
|
||||
return jsonified({
|
||||
'success': False
|
||||
})
|
||||
|
||||
@@ -388,7 +388,6 @@ class Renamer(Plugin):
|
||||
if self.shuttingDown():
|
||||
break
|
||||
|
||||
#db.close()
|
||||
self.renaming_started = False
|
||||
|
||||
def getRenameExtras(self, extra_type = '', replacements = {}, folder_name = '', file_name = '', destination = '', group = {}, current_file = ''):
|
||||
|
||||
@@ -542,7 +542,6 @@ class Scanner(Plugin):
|
||||
break
|
||||
except:
|
||||
pass
|
||||
#db.close()
|
||||
|
||||
# Search based on OpenSubtitleHash
|
||||
if not imdb_id and not group['is_dvd']:
|
||||
|
||||
@@ -110,7 +110,6 @@ class Searcher(Plugin):
|
||||
if self.shuttingDown():
|
||||
break
|
||||
|
||||
#db.close()
|
||||
self.in_progress = False
|
||||
|
||||
def single(self, movie):
|
||||
@@ -229,7 +228,6 @@ class Searcher(Plugin):
|
||||
|
||||
fireEvent('notify.frontend', type = 'searcher.ended.%s' % movie['id'], data = True)
|
||||
|
||||
#db.close()
|
||||
return ret
|
||||
|
||||
def download(self, data, movie, manual = False):
|
||||
@@ -280,7 +278,6 @@ class Searcher(Plugin):
|
||||
except Exception, e:
|
||||
log.error('Failed marking movie finished: %s %s', (e, traceback.format_exc()))
|
||||
|
||||
#db.close()
|
||||
return True
|
||||
|
||||
log.info('Tried to download, but none of the downloaders are enabled')
|
||||
|
||||
@@ -40,8 +40,6 @@ class Subtitle(Plugin):
|
||||
# get subtitles for those files
|
||||
subliminal.list_subtitles(files, cache_dir = Env.get('cache_dir'), multi = True, languages = self.getLanguages(), services = self.services)
|
||||
|
||||
#db.close()
|
||||
|
||||
def searchSingle(self, group):
|
||||
|
||||
if self.isDisabled(): return
|
||||
|
||||
@@ -70,7 +70,6 @@ class MovieResultModifier(Plugin):
|
||||
except:
|
||||
log.error('Tried getting more info on searched movies: %s', traceback.format_exc())
|
||||
|
||||
#db.close()
|
||||
return temp
|
||||
|
||||
def checkLibrary(self, result):
|
||||
|
||||
@@ -94,7 +94,6 @@ class CouchPotatoApi(MovieProvider):
|
||||
db = get_session()
|
||||
active_movies = db.query(Movie).filter(Movie.status.has(identifier = 'active')).all()
|
||||
movies = [x.library.identifier for x in active_movies]
|
||||
#db.close()
|
||||
|
||||
suggestions = self.suggest(movies, ignore)
|
||||
|
||||
|
||||
@@ -204,7 +204,6 @@ class Settings(object):
|
||||
except:
|
||||
pass
|
||||
|
||||
#db.close()
|
||||
return prop
|
||||
|
||||
def setProperty(self, identifier, value = ''):
|
||||
@@ -221,4 +220,3 @@ class Settings(object):
|
||||
p.value = toUnicode(value)
|
||||
|
||||
db.commit()
|
||||
#db.close()
|
||||
|
||||
Reference in New Issue
Block a user