def setup_content_item_image_cat(self): tags = ["kitty", "kitten", "cat", "cute", "pet", "cutie", "animals"] content = Content("telegram", "@image_cat", tags, application="cats") image = ContentImage("image", "random", self.mockinfo.mockdirwfiles, False, "json", self.mockinfo.historyfile) content.add_content_item(image) return content
def setup_content_item_text(self): content = Content("telegram", "@quotes_literature", "", application="quotes") format_rules = [{"\"%s":0},{"\"\n\n- %s":1}] text = ContentText("text", "random", "database", self.mockinfo.mockdb, format_rules, "") content.add_content_item(text) return content
def setup_content_item_image_travel(self): tags = "" format_rules = [{"Photo by: %s ": 0}, {" | <a href=\"%s\"\"> Instagram </a> |": 3}] content = Content("telegram", "@travel", tags, application="travel") image = ContentImage("image", "random", self.mockinfo.mockmultidir, True, "json", self.mockinfo.historyfilerecdir) text = ContentText("text", "description", "json", "infogeneral.json", format_rules, "") content.add_content_item(image) content.add_content_item(text) return content
def setup_content_item_image_scifi(self): tags = "" format_rules = [ {"Artist: %s":1}, {" | <a href=\"%s\"> Artstation </a> |":3}, {" | <a href=\"%s\"> Instagram </a> |":5}, {" | <a href=\"%s\"> Deviantart </a> |":4}, {" | <a href=\"%s\"> Website </a> |":2} ] content = Content("telegram", "@scifi", tags, application="scifi") image = ContentImage("image", "random", self.mockinfo.mockdirwfiles, False, "json", self.mockinfo.historyfile) text = ContentText("text", "description", "database", self.mockinfo.mockdb, format_rules, "") content.add_content_item(image) content.add_content_item(text) return content
def get_content_requirements(self, json_options): social_network = json_options["social_network"] blog_username = json_options["blog_username"] tags = json_options["tags"] application = json_options["application"] content = Content(social_network, blog_username, tags, application) parser = DataParser() #content_item_format = json_options["content_type"] for item_param in json_options["content"]: if item_param["content_type"] == "text": data_file = parser.substr(stra=item_param["data_file"], strb=getpass.getuser()) item_text = ContentText(item_param["content_type"], item_param["selection_alg"], item_param["data_format"], data_file, item_param["format_rules"], None) content.add_content_item(item_text) elif item_param["content_type"] == "image": directory = parser.substr(stra=item_param["directory"], strb=getpass.getuser()) br_history = parser.substr( stra=item_param['broadcast_history'], strb=getpass.getuser()) item_image = ContentImage( item_param["content_type"], item_param["selection_alg"], directory, item_param["recursive_folders"], history_ftype=item_param["broadcast_history_ftype"], history_loc=br_history) content.add_content_item(item_image) return content