mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
PEP* Cleanups and added timeouts for threads when shutting down or restarting.
This commit is contained in:
parent
1908f76eaf
commit
cef53beee0
2 changed files with 13 additions and 18 deletions
|
@ -1177,63 +1177,63 @@ def halt():
|
|||
dailySearchScheduler.stop.set()
|
||||
logger.log(u"Waiting for the DAILYSEARCH thread to exit")
|
||||
try:
|
||||
dailySearchScheduler.join()
|
||||
dailySearchScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
backlogSearchScheduler.stop.set()
|
||||
logger.log(u"Waiting for the BACKLOG thread to exit")
|
||||
try:
|
||||
backlogSearchScheduler.join()
|
||||
backlogSearchScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
showUpdateScheduler.stop.set()
|
||||
logger.log(u"Waiting for the SHOWUPDATER thread to exit")
|
||||
try:
|
||||
showUpdateScheduler.join()
|
||||
showUpdateScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
versionCheckScheduler.stop.set()
|
||||
logger.log(u"Waiting for the VERSIONCHECKER thread to exit")
|
||||
try:
|
||||
versionCheckScheduler.join()
|
||||
versionCheckScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
showQueueScheduler.stop.set()
|
||||
logger.log(u"Waiting for the SHOWQUEUE thread to exit")
|
||||
try:
|
||||
showQueueScheduler.join()
|
||||
showQueueScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
searchQueueScheduler.stop.set()
|
||||
logger.log(u"Waiting for the SEARCHQUEUE thread to exit")
|
||||
try:
|
||||
searchQueueScheduler.join()
|
||||
searchQueueScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
autoPostProcesserScheduler.stop.set()
|
||||
logger.log(u"Waiting for the POSTPROCESSER thread to exit")
|
||||
try:
|
||||
autoPostProcesserScheduler.join()
|
||||
autoPostProcesserScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
traktCheckerScheduler.stop.set()
|
||||
logger.log(u"Waiting for the TRAKTCHECKER thread to exit")
|
||||
try:
|
||||
traktCheckerScheduler.join()
|
||||
traktCheckerScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
properFinderScheduler.stop.set()
|
||||
logger.log(u"Waiting for the PROPERFINDER thread to exit")
|
||||
try:
|
||||
properFinderScheduler.join()
|
||||
properFinderScheduler.join(10)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
||||
import time
|
||||
|
||||
import os
|
||||
import traceback
|
||||
|
||||
|
@ -24,8 +24,7 @@ from sickbeard import encodingKludge as ek
|
|||
from sickbeard import logger
|
||||
from sickbeard import helpers
|
||||
from sickbeard import search_queue
|
||||
from sickbeard import db
|
||||
from sickbeard.common import SNATCHED, SNATCHED_PROPER, DOWNLOADED, SKIPPED, UNAIRED, IGNORED, ARCHIVED, WANTED, UNKNOWN
|
||||
from sickbeard.common import SKIPPED, WANTED
|
||||
from lib.trakt import *
|
||||
|
||||
|
||||
|
@ -61,11 +60,7 @@ class TraktChecker():
|
|||
logger.log(u"Could not connect to trakt service, aborting library check", logger.ERROR)
|
||||
return
|
||||
|
||||
for show in library:
|
||||
if int(indexer) == 1 and int(show['tvdb_id']) == int(indexerid):
|
||||
return show
|
||||
elif int(indexer) == 2 and int(show['tvrage_id']) == int(indexerid):
|
||||
return show
|
||||
return filter(lambda x: int(indexerid) in [int(x.tvdb_id), int(x.tvrage_id)], library)
|
||||
|
||||
def syncLibrary(self):
|
||||
logger.log(u"Syncing library to trakt.tv show library", logger.DEBUG)
|
||||
|
@ -112,7 +107,7 @@ class TraktChecker():
|
|||
data['title'] = show_obj.name
|
||||
data['year'] = show_obj.startyear
|
||||
|
||||
if data is not None:
|
||||
if data:
|
||||
logger.log(u"Adding " + show_obj.name + " to trakt.tv library", logger.DEBUG)
|
||||
TraktCall("show/library/%API%", sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD,
|
||||
data)
|
||||
|
|
Loading…
Reference in a new issue