Browse Source

Close all

pull/3111/head
Ruud 11 years ago
parent
commit
aab10fb599
  1. 5
      couchpotato/core/media/_base/media/main.py
  2. 2
      couchpotato/core/media/movie/searcher/main.py
  3. 2
      couchpotato/core/media/movie/suggestion/main.py
  4. 4
      couchpotato/core/notifications/core/main.py
  5. 4
      couchpotato/core/plugins/category/main.py
  6. 1
      couchpotato/core/plugins/dashboard/main.py
  7. 1
      couchpotato/core/plugins/file/main.py
  8. 2
      couchpotato/core/plugins/profile/main.py
  9. 3
      couchpotato/core/plugins/quality/main.py
  10. 9
      couchpotato/core/plugins/release/main.py
  11. 310
      couchpotato/core/plugins/renamer/main.py
  12. 2
      couchpotato/core/plugins/scanner/main.py
  13. 3
      couchpotato/core/plugins/status/main.py
  14. 2
      couchpotato/core/plugins/subtitle/main.py
  15. 1
      couchpotato/core/providers/info/_modifier/main.py
  16. 1
      couchpotato/core/settings/__init__.py

5
couchpotato/core/media/_base/media/main.py

@ -101,6 +101,8 @@ class MediaPlugin(MediaBase):
def handler(): def handler():
fireEvent(event, identifier = identifier, default_title = default_title, on_complete = self.createOnComplete(id)) fireEvent(event, identifier = identifier, default_title = default_title, on_complete = self.createOnComplete(id))
db.close()
if handler: if handler:
return handler return handler
@ -124,6 +126,7 @@ class MediaPlugin(MediaBase):
if m: if m:
results = m.to_dict(self.default_dict) results = m.to_dict(self.default_dict)
db.close()
return results return results
def getView(self, id = None, **kwargs): def getView(self, id = None, **kwargs):
@ -259,6 +262,7 @@ class MediaPlugin(MediaBase):
'releases_count': releases_count.get(media_id), 'releases_count': releases_count.get(media_id),
})) }))
db.close()
return total_count, movies return total_count, movies
def listView(self, **kwargs): def listView(self, **kwargs):
@ -352,6 +356,7 @@ class MediaPlugin(MediaBase):
if len(chars) == 25: if len(chars) == 25:
break break
db.close()
return ''.join(sorted(chars)) return ''.join(sorted(chars))
def charView(self, **kwargs): def charView(self, **kwargs):

2
couchpotato/core/media/movie/searcher/main.py

@ -117,6 +117,7 @@ class MovieSearcher(SearcherBase, MovieTypeBase):
pass pass
self.in_progress = False self.in_progress = False
db.close()
def single(self, movie, search_protocols = None, manual = False): def single(self, movie, search_protocols = None, manual = False):
@ -207,6 +208,7 @@ class MovieSearcher(SearcherBase, MovieTypeBase):
fireEvent('notify.frontend', type = 'movie.searcher.ended', data = {'id': movie['id']}) fireEvent('notify.frontend', type = 'movie.searcher.ended', data = {'id': movie['id']})
db.close()
return ret return ret
def correctRelease(self, nzb = None, media = None, quality = None, **kwargs): def correctRelease(self, nzb = None, media = None, quality = None, **kwargs):

2
couchpotato/core/media/movie/suggestion/main.py

@ -33,6 +33,7 @@ class Suggestion(Plugin):
.options(joinedload_all('library')) \ .options(joinedload_all('library')) \
.filter(or_(*[Media.status.has(identifier = s) for s in ['active', 'done']])).all() .filter(or_(*[Media.status.has(identifier = s) for s in ['active', 'done']])).all()
movies = [x.library.identifier for x in active_movies] movies = [x.library.identifier for x in active_movies]
db.close()
if not ignored or len(ignored) == 0: if not ignored or len(ignored) == 0:
ignored = splitString(Env.prop('suggest_ignore', default = '')) ignored = splitString(Env.prop('suggest_ignore', default = ''))
@ -97,6 +98,7 @@ class Suggestion(Plugin):
.filter(Media.status_id.in_([active_status.get('id'), done_status.get('id')])).all() .filter(Media.status_id.in_([active_status.get('id'), done_status.get('id')])).all()
movies = [x[0] for x in active_movies] movies = [x[0] for x in active_movies]
movies.extend(seen) movies.extend(seen)
db.close()
ignored.extend([x.get('imdb') for x in cached_suggestion]) ignored.extend([x.get('imdb') for x in cached_suggestion])
suggestions = fireEvent('movie.suggest', movies = movies, ignore = removeDuplicate(ignored), single = True) suggestions = fireEvent('movie.suggest', movies = movies, ignore = removeDuplicate(ignored), single = True)

4
couchpotato/core/notifications/core/main.py

@ -126,6 +126,7 @@ class CoreNotifier(Notification):
ndict['type'] = 'notification' ndict['type'] = 'notification'
notifications.append(ndict) notifications.append(ndict)
db.close()
return { return {
'success': True, 'success': True,
'empty': len(notifications) == 0, 'empty': len(notifications) == 0,
@ -172,6 +173,7 @@ class CoreNotifier(Notification):
self.frontend(type = listener, data = data) self.frontend(type = listener, data = data)
db.close()
return True return True
except: except:
log.error('Failed notify: %s', traceback.format_exc()) log.error('Failed notify: %s', traceback.format_exc())
@ -287,6 +289,8 @@ class CoreNotifier(Notification):
ndict['type'] = 'notification' ndict['type'] = 'notification'
messages.append(ndict) messages.append(ndict)
db.close()
return { return {
'success': True, 'success': True,
'result': messages, 'result': messages,

4
couchpotato/core/plugins/category/main.py

@ -42,6 +42,7 @@ class CategoryPlugin(Plugin):
for category in categories: for category in categories:
temp.append(category.to_dict()) temp.append(category.to_dict())
db.close()
return temp return temp
def save(self, **kwargs): def save(self, **kwargs):
@ -65,6 +66,7 @@ class CategoryPlugin(Plugin):
category_dict = c.to_dict() category_dict = c.to_dict()
db.close()
return { return {
'success': True, 'success': True,
'category': category_dict 'category': category_dict
@ -94,6 +96,7 @@ class CategoryPlugin(Plugin):
db.commit() db.commit()
db.close()
return { return {
'success': True 'success': True
} }
@ -126,6 +129,7 @@ class CategoryPlugin(Plugin):
except Exception as e: except Exception as e:
message = log.error('Failed deleting category: %s', e) message = log.error('Failed deleting category: %s', e)
db.close()
return { return {
'success': success, 'success': success,
'message': message 'message': message

1
couchpotato/core/plugins/dashboard/main.py

@ -119,6 +119,7 @@ class Dashboard(Plugin):
'files': {}, 'files': {},
})) }))
db.close()
return { return {
'success': True, 'success': True,
'empty': len(movies) == 0, 'empty': len(movies) == 0,

1
couchpotato/core/plugins/file/main.py

@ -166,6 +166,7 @@ class FileManager(Plugin):
for type_object in results: for type_object in results:
types.append(type_object.to_dict()) types.append(type_object.to_dict())
db.close()
return types return types
def getTypesView(self, **kwargs): def getTypesView(self, **kwargs):

2
couchpotato/core/plugins/profile/main.py

@ -71,6 +71,7 @@ class ProfilePlugin(Plugin):
for profile in profiles: for profile in profiles:
temp.append(profile.to_dict(self.to_dict)) temp.append(profile.to_dict(self.to_dict))
db.close()
return temp return temp
def save(self, **kwargs): def save(self, **kwargs):
@ -127,6 +128,7 @@ class ProfilePlugin(Plugin):
.options(joinedload_all('types')) \ .options(joinedload_all('types')) \
.first() .first()
default_dict = default.to_dict(self.to_dict) default_dict = default.to_dict(self.to_dict)
db.close()
return default_dict return default_dict

3
couchpotato/core/plugins/quality/main.py

@ -78,6 +78,8 @@ class QualityPlugin(Plugin):
temp.append(q) temp.append(q)
self.cached_qualities = temp self.cached_qualities = temp
db.close()
return temp return temp
def single(self, identifier = ''): def single(self, identifier = ''):
@ -89,6 +91,7 @@ class QualityPlugin(Plugin):
if quality: if quality:
quality_dict = dict(self.getQuality(quality.identifier), **quality.to_dict()) quality_dict = dict(self.getQuality(quality.identifier), **quality.to_dict())
db.close()
return quality_dict return quality_dict
def getQuality(self, identifier): def getQuality(self, identifier):

9
couchpotato/core/plugins/release/main.py

@ -88,6 +88,8 @@ class Release(Plugin):
elif rel.status_id in [snatched_status.get('id'), downloaded_status.get('id')]: elif rel.status_id in [snatched_status.get('id'), downloaded_status.get('id')]:
self.updateStatus(id = rel.id, status = ignored_status) self.updateStatus(id = rel.id, status = ignored_status)
db.close()
def add(self, group): def add(self, group):
@ -176,7 +178,7 @@ class Release(Plugin):
rel = db.query(Relea).filter_by(id = id).first() rel = db.query(Relea).filter_by(id = id).first()
if rel: if rel:
rel.delete() db.delete(rel)
db.commit() db.commit()
return True return True
except: except:
@ -220,6 +222,7 @@ class Release(Plugin):
ignored_status, failed_status, available_status = fireEvent('status.get', ['ignored', 'failed', 'available'], single = True) ignored_status, failed_status, available_status = fireEvent('status.get', ['ignored', 'failed', 'available'], single = True)
self.updateStatus(id, available_status if rel.status_id in [ignored_status.get('id'), failed_status.get('id')] else ignored_status) self.updateStatus(id, available_status if rel.status_id in [ignored_status.get('id'), failed_status.get('id')] else ignored_status)
db.close()
return { return {
'success': True 'success': True
} }
@ -259,11 +262,10 @@ class Release(Plugin):
'files': {} 'files': {}
}), manual = True) }), manual = True)
db.expunge_all()
if success: if success:
fireEvent('notify.frontend', type = 'release.manual_download', data = True, message = 'Successfully snatched "%s"' % item['name']) fireEvent('notify.frontend', type = 'release.manual_download', data = True, message = 'Successfully snatched "%s"' % item['name'])
db.close()
return { return {
'success': success == True 'success': success == True
} }
@ -456,6 +458,7 @@ class Release(Plugin):
releases = [r.to_dict({'info': {}, 'files': {}}) for r in releases_raw] releases = [r.to_dict({'info': {}, 'files': {}}) for r in releases_raw]
releases = sorted(releases, key = lambda k: k['info'].get('score', 0), reverse = True) releases = sorted(releases, key = lambda k: k['info'].get('score', 0), reverse = True)
db.close()
return releases return releases
def forMovieView(self, id = None, **kwargs): def forMovieView(self, id = None, **kwargs):

310
couchpotato/core/plugins/renamer/main.py

@ -598,6 +598,7 @@ class Renamer(Plugin):
break break
self.renaming_started = False self.renaming_started = False
db.close()
def getRenameExtras(self, extra_type = '', replacements = None, folder_name = '', file_name = '', destination = '', group = None, current_file = '', remove_multiple = False): def getRenameExtras(self, extra_type = '', replacements = None, folder_name = '', file_name = '', destination = '', group = None, current_file = '', remove_multiple = False):
if not group: group = {} if not group: group = {}
@ -851,197 +852,200 @@ Remove it if you want it to be renamed (again, or at least let it try again)
snatched_status, ignored_status, failed_status, seeding_status, downloaded_status, missing_status = \ snatched_status, ignored_status, failed_status, seeding_status, downloaded_status, missing_status = \
fireEvent('status.get', ['snatched', 'ignored', 'failed', 'seeding', 'downloaded', 'missing'], single = True) fireEvent('status.get', ['snatched', 'ignored', 'failed', 'seeding', 'downloaded', 'missing'], single = True)
db = get_session() try:
rels = db.query(Release).filter( db = get_session()
Release.status_id.in_([snatched_status.get('id'), seeding_status.get('id'), missing_status.get('id')]) rels = db.query(Release).filter(
).all() Release.status_id.in_([snatched_status.get('id'), seeding_status.get('id'), missing_status.get('id')])
).all()
if not rels: if not rels:
#No releases found that need status checking #No releases found that need status checking
self.checking_snatched = False self.checking_snatched = False
return True return True
# Collect all download information with the download IDs from the releases # Collect all download information with the download IDs from the releases
download_ids = [] download_ids = []
no_status_support = [] no_status_support = []
try: try:
for rel in rels: for rel in rels:
rel_dict = rel.to_dict({'info': {}}) rel_dict = rel.to_dict({'info': {}})
if rel_dict['info'].get('download_id') and rel_dict['info'].get('download_downloader'): if rel_dict['info'].get('download_id') and rel_dict['info'].get('download_downloader'):
download_ids.append({'id': rel_dict['info']['download_id'], 'downloader': rel_dict['info']['download_downloader']}) download_ids.append({'id': rel_dict['info']['download_id'], 'downloader': rel_dict['info']['download_downloader']})
ds = rel_dict['info'].get('download_status_support') ds = rel_dict['info'].get('download_status_support')
if ds == False or ds == 'False': if ds == False or ds == 'False':
no_status_support.append(ss(rel_dict['info'].get('download_downloader'))) no_status_support.append(ss(rel_dict['info'].get('download_downloader')))
except: except:
log.error('Error getting download IDs from database') log.error('Error getting download IDs from database')
self.checking_snatched = False self.checking_snatched = False
return False return False
release_downloads = fireEvent('download.status', download_ids, merge = True) if download_ids else [] release_downloads = fireEvent('download.status', download_ids, merge = True) if download_ids else []
if len(no_status_support) > 0: if len(no_status_support) > 0:
log.debug('Download status functionality is not implemented for one of the active downloaders: %s', no_status_support) log.debug('Download status functionality is not implemented for one of the active downloaders: %s', no_status_support)
if not release_downloads: if not release_downloads:
if fire_scan: if fire_scan:
self.scan() self.scan()
self.checking_snatched = False self.checking_snatched = False
return True return True
scan_releases = [] scan_releases = []
scan_required = False scan_required = False
log.debug('Checking status snatched releases...') log.debug('Checking status snatched releases...')
try: try:
for rel in rels: for rel in rels:
rel_dict = rel.to_dict({'info': {}}) rel_dict = rel.to_dict({'info': {}})
movie_dict = fireEvent('media.get', media_id = rel.movie_id, single = True) movie_dict = fireEvent('media.get', media_id = rel.movie_id, single = True)
if not isinstance(rel_dict['info'], dict): if not isinstance(rel_dict['info'], dict):
log.error('Faulty release found without any info, ignoring.') log.error('Faulty release found without any info, ignoring.')
fireEvent('release.update_status', rel.id, status = ignored_status, single = True) fireEvent('release.update_status', rel.id, status = ignored_status, single = True)
continue continue
# Check if download ID is available # Check if download ID is available
if not rel_dict['info'].get('download_id') or not rel_dict['info'].get('download_downloader'): if not rel_dict['info'].get('download_id') or not rel_dict['info'].get('download_downloader'):
log.debug('Download status functionality is not implemented for downloader (%s) of release %s.', (rel_dict['info'].get('download_downloader', 'unknown'), rel_dict['info']['name'])) log.debug('Download status functionality is not implemented for downloader (%s) of release %s.', (rel_dict['info'].get('download_downloader', 'unknown'), rel_dict['info']['name']))
scan_required = True scan_required = True
# Continue with next release # Continue with next release
continue continue
# Find release in downloaders # Find release in downloaders
nzbname = self.createNzbName(rel_dict['info'], movie_dict) nzbname = self.createNzbName(rel_dict['info'], movie_dict)
found_release = False
for release_download in release_downloads:
found_release = False found_release = False
if rel_dict['info'].get('download_id'): for release_download in release_downloads:
if release_download['id'] == rel_dict['info']['download_id'] and release_download['downloader'] == rel_dict['info']['download_downloader']: found_release = False
log.debug('Found release by id: %s', release_download['id']) if rel_dict['info'].get('download_id'):
found_release = True if release_download['id'] == rel_dict['info']['download_id'] and release_download['downloader'] == rel_dict['info']['download_downloader']:
break log.debug('Found release by id: %s', release_download['id'])
else: found_release = True
if release_download['name'] == nzbname or rel_dict['info']['name'] in release_download['name'] or getImdb(release_download['name']) == movie_dict['library']['identifier']: break
log.debug('Found release by release name or imdb ID: %s', release_download['name']) else:
found_release = True if release_download['name'] == nzbname or rel_dict['info']['name'] in release_download['name'] or getImdb(release_download['name']) == movie_dict['library']['identifier']:
break log.debug('Found release by release name or imdb ID: %s', release_download['name'])
found_release = True
break
if not found_release: if not found_release:
log.info('%s not found in downloaders', nzbname) log.info('%s not found in downloaders', nzbname)
#Check status if already missing and for how long, if > 1 week, set to ignored else to missing #Check status if already missing and for how long, if > 1 week, set to ignored else to missing
if rel.status_id == missing_status.get('id'): if rel.status_id == missing_status.get('id'):
if rel.last_edit < int(time.time()) - 7 * 24 * 60 * 60: if rel.last_edit < int(time.time()) - 7 * 24 * 60 * 60:
fireEvent('release.update_status', rel.id, status = ignored_status, single = True) fireEvent('release.update_status', rel.id, status = ignored_status, single = True)
else: else:
# Set the release to missing # Set the release to missing
fireEvent('release.update_status', rel.id, status = missing_status, single = True) fireEvent('release.update_status', rel.id, status = missing_status, single = True)
# Continue with next release # Continue with next release
continue continue
# Log that we found the release
timeleft = 'N/A' if release_download['timeleft'] == -1 else release_download['timeleft']
log.debug('Found %s: %s, time to go: %s', (release_download['name'], release_download['status'].upper(), timeleft))
# Log that we found the release # Check status of release
timeleft = 'N/A' if release_download['timeleft'] == -1 else release_download['timeleft'] if release_download['status'] == 'busy':
log.debug('Found %s: %s, time to go: %s', (release_download['name'], release_download['status'].upper(), timeleft)) # Set the release to snatched if it was missing before
fireEvent('release.update_status', rel.id, status = snatched_status, single = True)
# Check status of release # Tag folder if it is in the 'from' folder and it will not be processed because it is still downloading
if release_download['status'] == 'busy': if self.movieInFromFolder(release_download['folder']):
# Set the release to snatched if it was missing before self.tagRelease(release_download = release_download, tag = 'downloading')
fireEvent('release.update_status', rel.id, status = snatched_status, single = True)
# Tag folder if it is in the 'from' folder and it will not be processed because it is still downloading elif release_download['status'] == 'seeding':
if self.movieInFromFolder(release_download['folder']): #If linking setting is enabled, process release
self.tagRelease(release_download = release_download, tag = 'downloading') if self.conf('file_action') != 'move' and not rel.status_id == seeding_status.get('id') and self.statusInfoComplete(release_download):
log.info('Download of %s completed! It is now being processed while leaving the original files alone for seeding. Current ratio: %s.', (release_download['name'], release_download['seed_ratio']))
elif release_download['status'] == 'seeding': # Remove the downloading tag
#If linking setting is enabled, process release self.untagRelease(release_download = release_download, tag = 'downloading')
if self.conf('file_action') != 'move' and not rel.status_id == seeding_status.get('id') and self.statusInfoComplete(release_download):
log.info('Download of %s completed! It is now being processed while leaving the original files alone for seeding. Current ratio: %s.', (release_download['name'], release_download['seed_ratio']))
# Remove the downloading tag # Scan and set the torrent to paused if required
self.untagRelease(release_download = release_download, tag = 'downloading') release_download.update({'pause': True, 'scan': True, 'process_complete': False})
scan_releases.append(release_download)
else:
#let it seed
log.debug('%s is seeding with ratio: %s', (release_download['name'], release_download['seed_ratio']))
# Scan and set the torrent to paused if required # Set the release to seeding
release_download.update({'pause': True, 'scan': True, 'process_complete': False}) fireEvent('release.update_status', rel.id, status = seeding_status, single = True)
scan_releases.append(release_download)
else:
#let it seed
log.debug('%s is seeding with ratio: %s', (release_download['name'], release_download['seed_ratio']))
# Set the release to seeding elif release_download['status'] == 'failed':
fireEvent('release.update_status', rel.id, status = seeding_status, single = True) # Set the release to failed
fireEvent('release.update_status', rel.id, status = failed_status, single = True)
elif release_download['status'] == 'failed': fireEvent('download.remove_failed', release_download, single = True)
# Set the release to failed
fireEvent('release.update_status', rel.id, status = failed_status, single = True)
fireEvent('download.remove_failed', release_download, single = True) if self.conf('next_on_failed'):
fireEvent('movie.searcher.try_next_release', media_id = rel.movie_id)
if self.conf('next_on_failed'): elif release_download['status'] == 'completed':
fireEvent('movie.searcher.try_next_release', media_id = rel.movie_id) log.info('Download of %s completed!', release_download['name'])
elif release_download['status'] == 'completed': #Make sure the downloader sent over a path to look in
log.info('Download of %s completed!', release_download['name']) if self.statusInfoComplete(release_download):
#Make sure the downloader sent over a path to look in # If the release has been seeding, process now the seeding is done
if self.statusInfoComplete(release_download): if rel.status_id == seeding_status.get('id'):
if self.conf('file_action') != 'move':
# Set the release to done as the movie has already been renamed
fireEvent('release.update_status', rel.id, status = downloaded_status, single = True)
# If the release has been seeding, process now the seeding is done # Allow the downloader to clean-up
if rel.status_id == seeding_status.get('id'): release_download.update({'pause': False, 'scan': False, 'process_complete': True})
if self.conf('file_action') != 'move': scan_releases.append(release_download)
# Set the release to done as the movie has already been renamed else:
fireEvent('release.update_status', rel.id, status = downloaded_status, single = True) # Scan and Allow the downloader to clean-up
release_download.update({'pause': False, 'scan': True, 'process_complete': True})
scan_releases.append(release_download)
# Allow the downloader to clean-up
release_download.update({'pause': False, 'scan': False, 'process_complete': True})
scan_releases.append(release_download)
else: else:
# Set the release to snatched if it was missing before
fireEvent('release.update_status', rel.id, status = snatched_status, single = True)
# Remove the downloading tag
self.untagRelease(release_download = release_download, tag = 'downloading')
# Scan and Allow the downloader to clean-up # Scan and Allow the downloader to clean-up
release_download.update({'pause': False, 'scan': True, 'process_complete': True}) release_download.update({'pause': False, 'scan': True, 'process_complete': True})
scan_releases.append(release_download) scan_releases.append(release_download)
else: else:
# Set the release to snatched if it was missing before scan_required = True
fireEvent('release.update_status', rel.id, status = snatched_status, single = True)
# Remove the downloading tag
self.untagRelease(release_download = release_download, tag = 'downloading')
# Scan and Allow the downloader to clean-up except:
release_download.update({'pause': False, 'scan': True, 'process_complete': True}) log.error('Failed checking for release in downloader: %s', traceback.format_exc())
scan_releases.append(release_download)
else: # The following can either be done here, or inside the scanner if we pass it scan_items in one go
scan_required = True for release_download in scan_releases:
# Ask the renamer to scan the item
if release_download['scan']:
if release_download['pause'] and self.conf('file_action') == 'link':
fireEvent('download.pause', release_download = release_download, pause = True, single = True)
self.scan(release_download = release_download)
if release_download['pause'] and self.conf('file_action') == 'link':
fireEvent('download.pause', release_download = release_download, pause = False, single = True)
if release_download['process_complete']:
#First make sure the files were succesfully processed
if not self.hastagRelease(release_download = release_download, tag = 'failed_rename'):
# Remove the seeding tag if it exists
self.untagRelease(release_download = release_download, tag = 'renamed_already')
# Ask the downloader to process the item
fireEvent('download.process_complete', release_download = release_download, single = True)
if fire_scan and (scan_required or len(no_status_support) > 0):
self.scan()
except: self.checking_snatched = False
log.error('Failed checking for release in downloader: %s', traceback.format_exc()) return True
finally:
# The following can either be done here, or inside the scanner if we pass it scan_items in one go db.close()
for release_download in scan_releases:
# Ask the renamer to scan the item
if release_download['scan']:
if release_download['pause'] and self.conf('file_action') == 'link':
fireEvent('download.pause', release_download = release_download, pause = True, single = True)
self.scan(release_download = release_download)
if release_download['pause'] and self.conf('file_action') == 'link':
fireEvent('download.pause', release_download = release_download, pause = False, single = True)
if release_download['process_complete']:
#First make sure the files were succesfully processed
if not self.hastagRelease(release_download = release_download, tag = 'failed_rename'):
# Remove the seeding tag if it exists
self.untagRelease(release_download = release_download, tag = 'renamed_already')
# Ask the downloader to process the item
fireEvent('download.process_complete', release_download = release_download, single = True)
if fire_scan and (scan_required or len(no_status_support) > 0):
self.scan()
self.checking_snatched = False
return True
def extendReleaseDownload(self, release_download): def extendReleaseDownload(self, release_download):
@ -1064,6 +1068,8 @@ Remove it if you want it to be renamed (again, or at least let it try again)
if not rls: if not rls:
log.error('Download ID %s from downloader %s not found in releases', (release_download.get('id'), release_download.get('downloader'))) log.error('Download ID %s from downloader %s not found in releases', (release_download.get('id'), release_download.get('downloader')))
db.close()
if rls: if rls:
rls_dict = rls.to_dict({'info':{}}) rls_dict = rls.to_dict({'info':{}})

2
couchpotato/core/plugins/scanner/main.py

@ -441,6 +441,7 @@ class Scanner(Plugin):
else: else:
log.debug('Found no movies in the folder %s', folder) log.debug('Found no movies in the folder %s', folder)
db.close()
return processed_movies return processed_movies
def getMetaData(self, group, folder = '', release_download = None): def getMetaData(self, group, folder = '', release_download = None):
@ -608,6 +609,7 @@ class Scanner(Plugin):
break break
except: except:
pass pass
db.close()
# Search based on identifiers # Search based on identifiers
if not imdb_id: if not imdb_id:

3
couchpotato/core/plugins/status/main.py

@ -55,7 +55,7 @@ class StatusPlugin(Plugin):
db = get_session() db = get_session()
status = db.query(Status).filter_by(id = id).first() status = db.query(Status).filter_by(id = id).first()
status_dict = status.to_dict() status_dict = status.to_dict()
#db.close() db.close()
return status_dict return status_dict
@ -73,6 +73,7 @@ class StatusPlugin(Plugin):
# Update cache # Update cache
self.status_cached[status.identifier] = s self.status_cached[status.identifier] = s
db.close()
return temp return temp
def get(self, identifiers): def get(self, identifiers):

2
couchpotato/core/plugins/subtitle/main.py

@ -41,6 +41,8 @@ class Subtitle(Plugin):
# get subtitles for those files # get subtitles for those files
subliminal.list_subtitles(files, cache_dir = Env.get('cache_dir'), multi = True, languages = self.getLanguages(), services = self.services) subliminal.list_subtitles(files, cache_dir = Env.get('cache_dir'), multi = True, languages = self.getLanguages(), services = self.services)
db.close()
def searchSingle(self, group): def searchSingle(self, group):
if self.isDisabled(): return if self.isDisabled(): return

1
couchpotato/core/providers/info/_modifier/main.py

@ -104,6 +104,7 @@ class MovieResultModifier(Plugin):
except: except:
log.error('Tried getting more info on searched movies: %s', traceback.format_exc()) log.error('Tried getting more info on searched movies: %s', traceback.format_exc())
db.close()
return temp return temp
def checkLibrary(self, result): def checkLibrary(self, result):

1
couchpotato/core/settings/__init__.py

@ -216,6 +216,7 @@ class Settings(object):
except: except:
pass pass
db.close()
return prop return prop
def setProperty(self, identifier, value = ''): def setProperty(self, identifier, value = ''):

Loading…
Cancel
Save