Beispiel #1
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     # constants
     self.public_namespace.SEEN_TIMES = 'seen'
     self.public_namespace.TOTAL_TIMES = 'total'
     # init data path
     if not os.path.isdir(self.config[DATAPATH]):
         os.mkdir(self.config[DATAPATH])
     # load server uptimes
     self.public_namespace.uptime_file = dataloader.loadfile_safe(
         self.config[UPTIMES], load_as='json')
     if not isinstance(self.public_namespace.uptime_file.content, dict):
         self.public_namespace.uptime_file.content = dict()
     self.public_namespace.uptime = self.public_namespace.uptime_file.content
     # load status messages
     self.public_namespace.messages_file = dataloader.loadfile_safe(
         self.config[MESSAGES], load_as='json')
     if not isinstance(self.public_namespace.messages_file.content, dict):
         self.public_namespace.messages_file.content = dict()
     self.public_namespace.messages = self.public_namespace.messages_file.content
     # load official servers
     self.official_servers_data = dataloader.loadfile_safe(
         self.config[OFFICIAL_SERVERS])
     if not isinstance(self.official_servers_data.content, dict):
         self.official_servers_data.content = dict()
     self.official_servers = self.official_servers_data.content
Beispiel #2
0
 def __init__(self, **kwargs):
     super().__init__(should_spawn_thread=False, **kwargs)
     self.data = dataloader.loadfile_safe('potato.txt') #self.config["datafilepath"])
     self.author = self.get_author_from_url(self.config["url"])
     self.THRESHOLD = float(self.config[THRESHOLD])
     self.spawn_process()
     self.tweets = list()
Beispiel #3
0
def save_pipes(pipes):
    pipe_dump = list()
    for pipe in pipes:
        pipe_dump.append(pipe.dump())
    pipe_file = dataloader.loadfile_safe(PIPE_SAVE_LOC, load_as='json')
    pipe_file.content = pipe_dump
    pipe_file.save(save_as='json')
Beispiel #4
0
def load_pipes():
    pipes = dataloader.loadfile_safe(PIPE_SAVE_LOC, load_as='json').content
    if not isinstance(pipes, list):
        pipes = list()
        return pipes
    for i in range(len(pipes)):
        pipes[i] = Pipe(**pipes[i])
    return pipes
Beispiel #5
0
 def __init__(self, **kwargs):
     super().__init__(should_spawn_thread=False, **kwargs)
     self.CHANNEL = CHANNEL
     self.data = dataloader.loadfile_safe(self.config["datafilepath"]) # should be a json file
     if not isinstance(self.data.content, dict):
         self.data.content = dict()
     self.SEEN = SEEN
     self.CHANNELS = CHANNELS
     self.threaded_kwargs = {"newGCal":self.public_namespace.newGCal}
     self.spawn_process()
Beispiel #6
0
 def __init__(self, **kwargs):
     super().__init__(should_spawn_thread=False, **kwargs)
     self.CHANNEL = CHANNEL
     self.CHANNELS = CHANNELS
     self.MOST_RECENT = MOST_RECENT
     self.FIRST = FIRST
     self.data = dataloader.loadfile_safe(self.config["datafilepath"])
     if not isinstance(self.data.content, dict):
         self.data.content = dict()
     self.threaded_kwargs = {
         "newForum": self.public_namespace.newProBoardsForum
     }
     self.spawn_process()
Beispiel #7
0
 def __init__(self, **kwargs):
     super().__init__(should_spawn_thread=False, **kwargs)
     self.data = dataloader.loadfile_safe(self.config["datafilepath"])
     if not isinstance(self.data.content, dict):
         self.data.content = dict()
     # self.author = self.get_author_from_url(self.config["url"])
     # self.CHANNEL_ID = self.config[CHANNEL] # discord server channel ID for sending twitter updates to
     self.CHANNEL = CHANNEL
     self.CHANNELS = CHANNELS
     self.MOST_RECENT = MOST_RECENT
     self.MOST_RECENT2 = MOST_RECENT2
     self.FIRST = FIRST
     self.threaded_kwargs={'newTwit':self.public_namespace.newTwitterChannel}
     self.spawn_process()
Beispiel #8
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.commanders_swap = dataloader.loadfile_safe(self.config[DATA_FILE])
     # ensure proper data structure
     if not isinstance(self.commanders_swap.content, dict):
         self.commanders_swap.content = dict()
         self.commanders_swap.content[
             self.public_namespace.COMMANDS] = dict()
         self.commanders_swap.content[
             self.public_namespace.REACTIONS] = dict()
         self.commanders_swap.content[
             self.public_namespace.PLUGINS] = dict()
         self.commanders_swap.content[
             self.public_namespace.PACKAGES] = dict()
Beispiel #9
0
 def __init__(self, **kwargs):
     super().__init__(should_spawn_thread=False, **kwargs)
     self.data = dataloader.loadfile_safe(
         self.config["datafilepath"])  # should be a JSON file
     # make sure it is dict
     if not isinstance(self.data.content, dict):
         self.data.content = dict()
     self.CHANNEL_URL = self.config[CHANNEL_URL]
     self.UPLOADS_URL = self.config[UPLOADS_URL]
     self.UPLOADS_ITEM_URL = self.config[UPLOADS_ITEM_URL]
     self.VIDEO_URL_START = self.config[VIDEO_URL_START]
     self.CHANNEL_URL_START = self.config[CHANNEL_URL_START]
     self.CHANNELS = CHANNELS
     self.CHANNEL = CHANNEL
     self.threaded_kwargs = {
         "newChannel": self.public_namespace.newYTChannel
     }
     self.spawn_process()
Beispiel #10
0
 def load_last_times(self, filename):
     self.last_times_file = dataloader.loadfile_safe(
         filename)  # must be json
     if not isinstance(self.last_times_file.content, dict):
         self.last_times_file.content = dict()
     self.public_namespace.last_messages_time = self.last_times_file.content
Beispiel #11
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.public_namespace.game_file = dataloader.loadfile_safe(self.config['game'])
     if not isinstance(self.public_namespace.game_file.content, dict):
         self.public_namespace.game_file.content = {'name':None, 'type':None, 'url':None}