a Ae%@spdZddlZddlZddlZddlmZddlmZmZm Z e Z ddZ dddd Z ed krle e dS) z+ Runs Exif tag extraction in command line. N) FIELD_TYPES) process_fileexif_log __version__cCstjddd}|jddtddd|jd d d d ttjd fdd|jdddddd|jddtddd|jdddddd|jd d!dd"d#d|jd$d%dd&d'd|}|S)(NzEXIF.pyz2Extract EXIF information from digital image files.)prog descriptionfilesFILE+zfiles to process)metavartypenargshelpz-vz --versionversionzEXIF.py Version %s on Python%srz$Display version information and exit)actionrrz-qz--quick store_falsedetailedzDo not process MakerNotes)rdestrz-tz--tagstop_tagz+Stop processing when this tag is retrieved.)r rrz-sz--strict store_truestrictz$Run in strict mode (stop on errors).z-dz--debugdebugz'Run in debug mode (display extra info).z-cz--colorcolorz1Output in color (only works with debug on POSIX).)argparseArgumentParser add_argumentstrrsys version_info parse_args)parserargsr";/usr/local/lib/python3.9/dist-packages/../../../bin/EXIF.pyget_argssFr$)returnc Cst|j|j|jD]l}|td}}t }zt |d}Wn"t ylt d|YqYn0t d|t }t||j|j|j|jd}t }|st dtqd|vrt d|d=d |vrt d |d =t|}||D]R} z(t d | t|| jd || jWn"t d | t|| Yn0qt } t d||t d| |tqdS)z%Extract tags based on options (args).surrogateescaperbz'%s' is unreadablez Opening: %s)rdetailsrrzNo EXIF information foundZ JPEGThumbnailzFile has JPEG thumbnailZ TIFFThumbnailzFile has TIFF thumbnailz %s (%s): %sz%s : %szTags processed in %s secondszFile processed in %s secondsN)rZ setup_loggerrrrencodergetfilesystemencodingdecodetimeitZ default_timeropenIOErrorloggererrorinforrrrwarningprintlistkeyssortrZ field_type printabler) r!filenameZ escaped_fnZ file_startZimg_fileZ tag_startdataZtag_stopZtag_keysiZ file_stopr"r"r#mainBsL          ( r<__main__)__doc__rrr-Z exifread.tagsrZexifreadrrrZ get_loggerr0r$r<__name__r"r"r"r#s &9