{"id":19090160,"url":"https://github.com/destrangis/photodb","last_synced_at":"2026-05-10T07:32:22.642Z","repository":{"id":137496308,"uuid":"408143937","full_name":"destrangis/photodb","owner":"destrangis","description":"Index a collection of photographs into a PostgreSQL database","archived":false,"fork":false,"pushed_at":"2021-09-19T14:08:43.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T07:16:47.257Z","etag":null,"topics":["database","exif","geolocation","photos","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/destrangis.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-19T14:07:26.000Z","updated_at":"2021-09-19T17:56:47.000Z","dependencies_parsed_at":"2023-06-14T22:15:45.242Z","dependency_job_id":null,"html_url":"https://github.com/destrangis/photodb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/destrangis/photodb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/destrangis%2Fphotodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/destrangis%2Fphotodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/destrangis%2Fphotodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/destrangis%2Fphotodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/destrangis","download_url":"https://codeload.github.com/destrangis/photodb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/destrangis%2Fphotodb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283997630,"owners_count":26929852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-12T02:00:06.336Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","exif","geolocation","photos","postgresql"],"created_at":"2024-11-09T03:02:34.481Z","updated_at":"2025-11-12T07:32:02.005Z","avatar_url":"https://github.com/destrangis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=======\nPhotodb\n=======\n\nIndex a collection of photographs into a PostgreSQL database.\n\nIn order to scratch an itch of mine, I decided to index my digital photograph\ncollection by creating a database with the file pathname, the date the\npicture it was taken, and the place, obtained from the GPS coordinates.\nSome of my pictures were sent to me via social networks, which\nregrettably strip all the metadata from the files and, in this case,\nonly the date the picture was obtained (i.e. the file creation date) is\nstored. In the future who knows, tags and people's names may be added.\n\nDependencies\n------------\n\nThis program depends on the modules `psycopg2 \u003chttps://pypi.org/project/psycopg2/\u003e`_,\nto manage the PostgreSQL database, and `exif \u003chttps://pypi.org/project/exif/\u003e`_\nto extract metadata from digital photograph files.\n\nThe programs does reverse geolocation using a public API from\n`OpenCage \u003chttps://opencagedata.com\u003e`_. You will need to obtain an API\nkey from them in order to run this program.\n\nRunning\n-------\n\nThere is no automated install or setup.py program at this time, so the\nrecommended way to use this program for now is:\n\nCreate a database on a postgreSQL server to store the data into.\n\nCreate a virtual environment and install the dependencies in the\ndirectory on which you have git cloned this repo::\n\n    $ python3 -m venv photodb\n    $ cd photodb\n    $ . bin/activate\n    (photodb)$ python3 -m pip install -r \u003c requirements.txt\n\nCopy the file ``photodb.ini.sample`` into ``config.ini`` and edit it with\nthe details of your OpenCage API key and your database.\n\nInitialise the database::\n\n    (photodb)$ python3 photodb.py --config=config.ini --initdb\n\nAnd at this point you can index your picture collection into the database\nby running the program::\n\n    (photodb)$ python3 photodb.py --config=config.ini --scan-dir=/path/to/pics\n\nYou can get help on the different options the program can take by using\nthe --help command line option::\n\n    (photodb)$ python3 photodb.py --help\n    usage: photodb.py [-h] [--version] [--scan-dir DIR] [--save FILE]\n                      [--extract FILE] [--replay FILE] [--picture FILE]\n                      [--config CFG-FILE] [--initdb] [--loglevel LOGLEVEL]\n                      [--errorlog ERRORLOG]\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      --version, -v         print version and exit\n      --scan-dir DIR, -d DIR\n                            recursively scan a directory and add the pictures to\n                            the database\n      --save FILE, -s FILE  save inserted records to FILE instead of default\n                            ~/.photodb_records\n      --extract FILE, -x FILE\n                            extract all records from the database into a json FILE\n                            (opposite of --replay option)\n      --replay FILE, -r FILE\n                            insert in the database the json records in FILE,\n                            previously specified with the --save option\n      --picture FILE, -p FILE\n                            add a single picture file to the database\n      --config CFG-FILE, -c CFG-FILE\n                            read configuration from this file. Default:\n                            /usr/local/etc/photodb.ini\n      --initdb, -i          initialise the database (specified in the\n                            configuration) WARNING: This wipes out an existing\n                            database!\n      --loglevel LOGLEVEL, -l LOGLEVEL\n                            set logging level. Default INFO\n      --errorlog ERRORLOG, -e ERRORLOG\n                            error log file. Default ~/photodb_errors.log. Errors\n                            will always get logged into a file. If you don't want\n                            that (bad idea) set this to /dev/null\n\nThe program is a bit (too much?) paranoid about not repeating calls to\nthe OpenCage site, and saves a json copy of the records inserted as a\nbackup, which can eventually be really big. It can, at a later time,\nrebuild the database without re-scanning the files and without querying\nOpenCage. That would be the purpose of the ``--save``, ``--extract``,\nand ``--replay`` command line options.\n\nConfiguration\n-------------\n\nThe configuration is taken by default from the file ``/usr/local/photodb.ini``.\nIf you don't have the configuration file there, or you want to use a\ndifferent configuration file, you can always use the ``--config`` command\nline option.\n\nA sample configuration file is provided in ``config.ini.sample`` which\ncontains the following::\n\n    # these are the parameters for your postgresql database\n    [postgresdb]\n    dbname=testphotodb\n    user=testuser\n    password=hello\n    host=localhost\n    port=5432\n\n    # this stores your OpenCage API key for doing inverse geolocation\n    [opencage]\n    apikey = b1ab1ab1ab1ab1ab1ab1ab1ab1ab1ab1\n\nLicense\n-------\nThis program is released under the **MIT License**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdestrangis%2Fphotodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdestrangis%2Fphotodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdestrangis%2Fphotodb/lists"}