(peoplelist)
| 238 | |
| 239 | |
| 240 | def fill_pinterest(peoplelist): |
| 241 | PinterestfinderObject = pinterestfinder.Pinterestfinder(showbrowser) |
| 242 | PinterestfinderObject.doLogin(pinterest_username, pinterest_password) |
| 243 | if args.waitafterlogin: |
| 244 | input("Press Enter to continue after verifying you are logged in...") |
| 245 | |
| 246 | count = 1 |
| 247 | ammount = len(peoplelist) |
| 248 | for person in peoplelist: |
| 249 | if args.vv == True or args.debug == True: |
| 250 | print("Pinterest Check %i/%i : %s" % (count, ammount, person.full_name)) |
| 251 | else: |
| 252 | sys.stdout.write( |
| 253 | "\rPinterest Check %i/%i : %s " % (count, ammount, person.full_name)) |
| 254 | sys.stdout.flush() |
| 255 | count = count + 1 |
| 256 | if person.person_image: |
| 257 | try: |
| 258 | target_image = face_recognition.load_image_file(person.person_image) |
| 259 | target_encoding = face_recognition.face_encodings(target_image)[0] |
| 260 | profilelist = PinterestfinderObject.getPinterestProfiles(person.first_name, person.last_name) |
| 261 | if args.debug == True: |
| 262 | print(profilelist) |
| 263 | except: |
| 264 | continue |
| 265 | else: |
| 266 | continue |
| 267 | |
| 268 | early_break = False |
| 269 | updatedlist = [] |
| 270 | for profilelink, profilepic, distance in profilelist: |
| 271 | try: |
| 272 | os.remove("potential_target_image.jpg") |
| 273 | except: |
| 274 | pass |
| 275 | if early_break: |
| 276 | break |
| 277 | image_link = profilepic |
| 278 | if image_link: |
| 279 | try: |
| 280 | urllib.request.urlretrieve(image_link, "potential_target_image.jpg") |
| 281 | potential_target_image = face_recognition.load_image_file("potential_target_image.jpg") |
| 282 | try: # try block for when an image has no faces |
| 283 | potential_target_encoding = face_recognition.face_encodings(potential_target_image)[0] |
| 284 | except: |
| 285 | continue |
| 286 | results = face_recognition.face_distance([target_encoding], potential_target_encoding) |
| 287 | for result in results: |
| 288 | if args.mode == "fast": |
| 289 | if result < threshold: |
| 290 | person.pinterest = encoding.smart_str(profilelink, encoding='ascii', errors='ignore') |
| 291 | person.pinterestimage = encoding.smart_str(image_link, encoding='ascii', |
| 292 | errors='ignore') |
| 293 | if args.vv == True: |
| 294 | print("\tMatch found: " + person.full_name) |
| 295 | print("\tPinterest: " + person.pinterest) |
| 296 | early_break = True |
| 297 | break |
no test coverage detected