Exemplo n.º 1
0
    def __init__(self, config, main_async_loop):
        super().__init__(config, main_async_loop)
        self.subreddits = None
        self.counter = 0
        self.connect_attempts = 0
        self.social_config = {}
        self.credentials_ok = False

        # check presence of twitter instance
        if RedditService.is_setup_correctly(self.config):
            self.service = self.config[CONFIG_CATEGORY_SERVICES][
                CONFIG_REDDIT][CONFIG_SERVICE_INSTANCE]
            self.is_setup_correctly = True
        else:
            if RedditService.should_be_ready(config):
                self.logger.warning(self.REQUIRED_SERVICE_ERROR_MESSAGE)
            self.is_setup_correctly = False
Exemplo n.º 2
0
    def __init__(self, config):
        super().__init__(config)
        self.logger = logging.getLogger(self.__class__.__name__)
        self.subreddits = None
        self.counter = 0
        self.connect_attempts = 0
        self.social_config = {}
        self.credentials_ok = False

        # check presence of twitter instance
        if RedditService.is_setup_correctly(self.config):
            self.reddit_service = self.config[CONFIG_CATEGORY_SERVICES][CONFIG_REDDIT][CONFIG_SERVICE_INSTANCE]
            self.is_setup_correctly = True
        else:
            if RedditService.should_be_ready(config):
                self.logger.warning("Required services are not ready, dispatcher can't start")
            self.is_setup_correctly = False
Exemplo n.º 3
0
    def __init__(self, config):
        super().__init__(config)
        self.logger = logging.getLogger(self.__class__.__name__)
        self.subreddits = None
        self.counter = 0
        self.social_config = {}

        # check presence of twitter instance
        if RedditService.is_setup_correctly(self.config):
            self.reddit_service = self.config[CONFIG_CATEGORY_SERVICES][
                CONFIG_REDDIT][CONFIG_SERVICE_INSTANCE]
            self.is_setup_correctly = True
        else:
            self.logger.warning("Required services are not ready")
            self.is_setup_correctly = False
Exemplo n.º 4
0
        game = Util.convertToDict(line)
        #check if therei a game toda
        if (game["startDate"].date() == datetime.today().date()):
            #time to post pregream thread
            postTime = game["startDate"] + timedelta(hours=-pregameHoursBefore)

            #time to begin check for end of game
            postGameTimeCheck = game["startDate"] + timedelta(
                hours=+hoursAfterStartToCheck)

            #if the post time is before the current time and there is not already a pregame thread posted
            if (postTime < datetime.today() and game["startDate"].date()
                    not in already_done_pregame_thread):
                print("connecting.....")
                try:
                    RedditService.makePregamePost(game)
                    already_done_pregame_thread.append(
                        game["startDate"].date())
                except Exception as e:
                    print(e)
                    print("Connection error....will retry in 300 seconds")
                    time.sleep(600)
            #if a pre-game thread has already been posted but not a post grame thread
            elif (postGameTimeCheck < datetime.today()
                  and game["startDate"].date() in already_done_pregame_thread
                  and game["startDate"].date()
                  not in already_done_post_game_thread):
                print(
                    "attempting to make postgame postand speed up score check....."
                )