exiftool will handle any number of files at a time, so to process a bunch of files, and extract specific metadata fields, this goes about 8 times faster on my laptop: def meta_for_batch(fieldlist, filelist):īatchup = fieldlist filelist This still turns up in searches, but using stay open etc, is barely faster than just running up subprocess individually for each file. directory find and execute on every document found. tadata_lookup = self.get_metadata(FileLoc) Return json.loads(self.execute("-G", "-j", "-n", *FileLoc))įor dirname, dirnames, filenames in os.walk(locDir): > 30 (str.join("\n", args))ĪttributeError: 'ExifTool' object has no attribute 'process' return follow ERROR using Python 3.8.10 and IPYTHON Otherwise the program will hang because the while loop inside execute() won't stop The second is that you have to decode the byte series returned by os.read(): output = os.read(fd, 4096).decode('utf-8')ĮDIT for Windows: To get this working on Windows, the sentinel need to be changed into "\r\n" The first is an additional argument to subprocess.Popen: self.process = subprocess.Popen( To get this to work in python 3 two small changes are needed. This class is written as a context manager to ensure the process is exited if you are done. Return json.loads(self.execute("-G", "-j", "-n", *filenames)) Stdin=subprocess.PIPE, stdout=subprocess.PIPE)ĭef _exit_(self, exc_type, exc_value, traceback): I also included get_metadata() to read the metadata in JSON format: import subprocessĭef _init_(self, executable="/usr/bin/exiftool"): Here's a simple class that launches an exiftool process and features an execute() method to send commands to that process. ExifTool supports JSON output, which is probably the best option for reading the metadata. You can then send commands to the process via stdin, and read the output on stdout. Additionally it installs the extensions citext, pg_trgm and uuid-ossp to the database.To avoid launching a new process for each image, you should start exiftool using the -stay_open flag. This script creates the user pleroma with your password MySecretPassword you gave above and the database pleroma with the user pleroma as owner. You have a PostgreSQL file in config/setup_db.psql. pleroma]$ Create new PostgreSQL user and database from file ¶ All files successfully written! Refer to the installation instructions for your platform for next steps. Writing the postgres script to config/setup_db.psql. The Corndog Emporium) A Uberspace Pleroma Instance What is your admin email address? What email address do you want to use for sending email notifications? Do you want search engines to index your site? (y/n) y Do you want to store the configuration in the database (allows controlling it from admin-fe)? (y/n) n What is the hostname of your database? localhost What is the name of your database? pleroma What is the user used to connect to your database? pleroma What is the password used to connect to your database? MySuperSecretPassword Would you like to use RUM indices? n What port will the app listen to (leave it if you are using the default setup with nginx)? 4000 What ip will the app listen to (leave it if you are using the default setup with nginx)? 0.0.0.0 What directory should media uploads go in (when using the local uploader)? uploads What directory should custom public files be read from (custom emojis, frontend bundle overrides, robots.txt, etc.)? instance/static/ Do you want to strip location (GPS) data from uploaded images? (y/n) y Do you want to anonymize the filenames of uploads? (y/n) n Do you want to deduplicate uploaded files? (y/n) n Writing config to config/generated_config.exs. Could not find "rebar3", which is needed to build dependency :parse_trans I can install a local copy which is just used by Mix Shall I install rebar3? (if running non-interactively, use "mix local.rebar -force") Y Generated pleroma app What domain will your instance use? (e.g ) What is the name of your instance? (e.g. ~]$ cd pleroma]$ mix pleroma.instance gen.
0 Comments
Leave a Reply. |