How to use the exifread.make_string function in ExifRead

To help you get started, we’ve selected a few ExifRead examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github richq / folders2flickr / f2flickr / uploadr.py View on Github external
datePosted = int((datetime(datePostedY, datePostedM, datePostedD, 23, 59, 59) - datetime(1970, 1, 1)).total_seconds())
                            #Use year from dateExif, then calculate end of year (note: Flickr does not accept future dates. You'll get current date maximum)
                            if configdict.get('date_posted_granularity', '0') == '6':
                                datePostedY = int(datetime.fromtimestamp(datePosted).strftime("%Y"))
                                datePosted = int((datetime(datePostedY, 12, 31, 23, 59, 59) - datetime(1970, 1, 1)).total_seconds())
                            #Convert timestamp to GMT zone
                            dateZone =  configdict.get('date_posted_utc', '0')
                            if dateZone != '0':
                                datePosted = datePosted - int(dateZone)*3600

                # look for additional tags in EXIF to tag picture with
                if XPKEYWORDS in exiftags:
                    printable = exiftags[XPKEYWORDS].printable
                    if len(printable) > 4:
                        try:
                            exifstring = exifread.make_string(eval(printable))
                            picTags += exifstring.replace(';', ' ')
                        except:
                            logging.exception("Skipping unexpected EXIF data in %s", image)

            picTags = picTags.strip()
            logging.info("Uploading image %s with tags %s", image, picTags)
            photo = ('photo', image, open(image,'rb').read())


            d = {
                api.token   : str(self.token),
                api.perms   : str(self.perms),
                "tags"      : str(picTags),
                "hidden"    : str( FLICKR["hidden"] ),
                "is_public" : str( FLICKR["is_public"] ),
                "is_friend" : str( FLICKR["is_friend"] ),