2014-03-10 05:18:05 +00:00
|
|
|
# Author: Nic Wolfe <nic@wolfeden.ca>
|
|
|
|
# URL: http://code.google.com/p/sickbeard/
|
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
# This file is part of SickGear.
|
2014-03-10 05:18:05 +00:00
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
# SickGear is free software: you can redistribute it and/or modify
|
2014-03-10 05:18:05 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
2014-11-12 16:43:14 +00:00
|
|
|
# SickGear is distributed in the hope that it will be useful,
|
2014-03-10 05:18:05 +00:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2014-11-12 16:43:14 +00:00
|
|
|
# along with SickGear. If not, see <http://www.gnu.org/licenses/>.
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
import os.path
|
|
|
|
|
|
|
|
import sickbeard
|
2015-02-28 16:17:04 +00:00
|
|
|
from sickbeard import logger, processTV
|
2014-03-10 05:18:05 +00:00
|
|
|
from sickbeard import encodingKludge as ek
|
|
|
|
|
|
|
|
|
2014-03-25 05:57:24 +00:00
|
|
|
class PostProcesser():
|
2015-03-12 23:15:44 +00:00
|
|
|
def __init__(self):
|
|
|
|
self.amActive = False
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
if not sickbeard.PROCESS_AUTOMATICALLY:
|
|
|
|
return
|
|
|
|
|
|
|
|
self.amActive = True
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
if not ek.ek(os.path.isdir, sickbeard.TV_DOWNLOAD_DIR):
|
2015-02-28 16:17:04 +00:00
|
|
|
logger.log(u"Automatic post-processing attempted but dir %s doesn't exist" % sickbeard.TV_DOWNLOAD_DIR,
|
2014-03-25 05:57:24 +00:00
|
|
|
logger.ERROR)
|
2014-03-10 05:18:05 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if not ek.ek(os.path.isabs, sickbeard.TV_DOWNLOAD_DIR):
|
2015-02-28 16:17:04 +00:00
|
|
|
logger.log(u'Automatic post-processing attempted but dir %s is relative '
|
|
|
|
'(and probably not what you really want to process)' % sickbeard.TV_DOWNLOAD_DIR, logger.ERROR)
|
2014-03-10 05:18:05 +00:00
|
|
|
return
|
|
|
|
|
2015-03-12 23:15:44 +00:00
|
|
|
processTV.processDir(sickbeard.TV_DOWNLOAD_DIR)
|
|
|
|
|
2015-09-18 00:06:34 +00:00
|
|
|
self.amActive = False
|