def get_last_update(self): now = datetime.utcnow().replace(tzinfo=pytz.utc) last_update = Dankswank.get_last_update() if last_update == "never": return "unknown" else: return int((now - last_update).total_seconds() / 3600)
def get_movies(sc): BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) logfile = os.path.join(BASE_DIR, 'debug.log') # Empty the log file with open(logfile, 'w') as f: f.write('') logger.info('---------------------------') logger.info(' Getting movie information ') logger.info('---------------------------') mcc = MovieCollectorCommand() mcc.populate_movie_database(True) mpc = MoviePrunerCommand() mpc.prune_movie_database() Dankswank.set_last_update() sc.enter(28800, 1, get_movies, (sc,))