Code cleanup

This commit is contained in:
Ruud committed 2013-09-02 21:59:06 +02:00
1 parent 7d32a8750d
commit 7fd14e0283
59 files changed
+171 -170

No files matched your search

@@ -1,5 +1,4 @@
from .main import Searcher
import random
def start():
return Searcher()
+7 -13
View File
@@ -1,4 +1,3 @@
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
@@ -19,12 +18,10 @@ class SearcherBase(Plugin):
self.initCron()
""" Set the searcher cronjob
Make sure to reset cronjob after setting has changed
"""
def initCron(self):
""" Set the searcher cronjob
Make sure to reset cronjob after setting has changed
"""
_type = self.getType()
@@ -38,14 +35,11 @@ class SearcherBase(Plugin):
addEvent('setting.save.%s_searcher.cron_hour.after' % _type, setCrons)
addEvent('setting.save.%s_searcher.cron_minute.after' % _type, setCrons)
""" Return progress of current searcher
"""
def getProgress(self, **kwargs):
""" Return progress of current searcher"""
progress = {}
progress[self.getType()] = self.in_progress
progress = {
self.getType(): self.in_progress
}
return progress
@@ -173,10 +173,10 @@ class Searcher(SearcherBase):
year_name = fireEvent('scanner.name_year', name, single = True)
if len(found) == 0 and movie_year < datetime.datetime.now().year - 3 and not year_name.get('year', None):
if size > 3000: # Assume dvdr
log.info('Quality was missing in name, assuming it\'s a DVD-R based on the size: %s', (size))
log.info('Quality was missing in name, assuming it\'s a DVD-R based on the size: %s', size)
found['dvdr'] = True
else: # Assume dvdrip
log.info('Quality was missing in name, assuming it\'s a DVD-Rip based on the size: %s', (size))
log.info('Quality was missing in name, assuming it\'s a DVD-Rip based on the size: %s', size)
found['dvdrip'] = True
# Allow other qualities
@@ -191,6 +191,7 @@ class Searcher(SearcherBase):
if not isinstance(haystack, (list, tuple, set)):
haystack = [haystack]
year_name = {}
for string in haystack:
year_name = fireEvent('scanner.name_year', string, single = True)