예제 #1
0
    def storeLocal(self, match):
        if isinstance(match, Match):
            filename = 'matches'
        elif isinstance(match, Geomatch):
            filename = 'geomatches'
        else:
            print("type of match is unknown, storing local impossible")
            print("Crashing in 3.2.1... :)")
            assert False

        # store its images
        for url in match.image_urls:
            hashed_image = StorageHelper.storeImageAs(url=url, directory='data/{}/images'.format(filename))
            match.images_by_hashes.append(hashed_image)

        # store its userdata
        StorageHelper.storeMatch(match=match, directory='data/{}'.format(filename), filename=filename)
예제 #2
0
    def __init__(self, name, age, bio, distance, image_urls):
        self.name = name
        self.age = age
        self.bio = bio
        self.distance = distance
        self.image_urls = image_urls

        # create a unique chatid for this person
        self.id = "{}{}_{}".format(name, age,
                                   StorageHelper.id_generator(size=4))
        self.images_by_hashes = []
예제 #3
0
    def __init__(self, name, age, work, study, home, bio, distance, passions,
                 image_urls):
        self.name = name
        self.age = age
        self.work = work
        self.study = study
        self.home = home
        self.passions = passions
        self.bio = bio
        self.distance = distance
        self.image_urls = image_urls

        # create a unique id for this person
        self.id = "{}{}_{}".format(name, age,
                                   StorageHelper.id_generator(size=4))
        self.images_by_hashes = []