Exemplo n.º 1
0
 def __init__(self, option, keep_vars=False):
     format_variables2 = format_variables()
     self.site_name = option.get('site_name', format_variables2.site_name)
     self.post_id = option.get('post_id', format_variables2.post_id)
     self.media_id = option.get('media_id', format_variables2.media_id)
     self.username = option.get('username', format_variables2.username)
     self.api_type = option.get('api_type', format_variables2.api_type)
     self.media_type = option.get(
         'media_type', format_variables2.media_type)
     self.filename = option.get('filename', format_variables2.filename)
     self.ext = option.get('ext', format_variables2.ext)
     self.text = option.get('text', format_variables2.text)
     self.date = option.get('postedAt', format_variables2.date)
     self.price = option.get('price', 0)
     self.date_format = option.get('date_format')
     self.maximum_length = option.get('maximum_length')
     self.directory = option.get(
         'directory')
     if not keep_vars:
         for key, value in self:
             print
             if isinstance(value, str):
                 key = main_helper.find_between(value, "{", "}")
                 e = getattr(format_variables2, key, None)
                 if e:
                     setattr(self, key, "")
                     print
     print
Exemplo n.º 2
0
 def __init__(self, option, keep_vars=False):
     format_variables2 = format_variables()
     self.site_name = option.get("site_name", format_variables2.site_name)
     self.post_id = option.get("post_id", format_variables2.post_id)
     self.media_id = option.get("media_id", format_variables2.media_id)
     self.profile_username = option.get("profile_username",
                                        format_variables2.profile_username)
     self.model_username = option.get("model_username",
                                      format_variables2.model_username)
     self.api_type = option.get("api_type", format_variables2.api_type)
     self.media_type = option.get("media_type",
                                  format_variables2.media_type)
     self.filename = option.get("filename", format_variables2.filename)
     self.ext = option.get("ext", format_variables2.ext)
     self.text = option.get("text", format_variables2.text)
     self.date = option.get("postedAt", format_variables2.date)
     self.price = option.get("price", 0)
     self.archived = option.get("archived", False)
     self.date_format = option.get("date_format")
     self.maximum_length = 255
     self.text_length = option.get("text_length", self.maximum_length)
     self.directory = option.get("directory")
     self.preview = option.get("preview")
     if not keep_vars:
         for key, value in self:
             print
             if isinstance(value, str):
                 key = main_helper.find_between(value, "{", "}")
                 e = getattr(format_variables2, key, None)
                 if e:
                     setattr(self, key, "")
                     print
     print
Exemplo n.º 3
0
 def reformat(self, unformatted_list) -> list[str]:
     x = []
     format_variables2 = format_variables()
     for key, unformatted_item in unformatted_list.items():
         if "filename_format" == key:
             unformatted_item = os.path.join(x[1], unformatted_item)
             print
         string = main_helper.reformat(self, unformatted_item)
         final_path = []
         paths = string.split(os.sep)
         for path in paths:
             key = main_helper.find_between(path, "{", "}")
             e = getattr(format_variables2, key, None)
             if path == e:
                 break
             final_path.append(path)
         final_path = os.sep.join(final_path)
         print
         x.append(final_path)
     return x