Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

xiple/media-tools

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

media-tools

Python scripts for pictures archival purposes.

Fork of Will Ho whatsapp-media-tools repository (manage WhatsApp media backups for archival purposes).

Prerequisites

Scripts are using python piexif module to manage exif metadata.

Best practice is to create a virtual environment to manage dependencies. Below commands example for bash shell :

# Create a virtual environment named 'myenv'
python3 -m venv myvenv

# Source virtual env variables
source myvenv/bin/activate

# Check paths
which python3
which pip3

# Install python module requirements in the virtual env
python3 -m pip install -r requirements.txt

# once finished with scripts, deactivate the virtual env
deactivate

Usage

Restoring exif dates on WhatsApp media files

usage: restore-exif.py [-h] [-r] [-m] path

Restore discarded Exif date information in WhatsApp media based on the filename. For videos, only the created and modified dates are set.

positional arguments:
  path             Path to WhatsApp media folder

options:
  -h, --help       show this help message and exit
  -r, --recursive  Recursively process media
  -m, --mod        Set file created/modified date on top of exif for images

Finding duplicate media files

usage: find-duplicates.py [-h] [-c CHUNK_SIZE] [-f] [-r] [--dry-run] path

Remove duplicated media, preserving the file with the shortest filename or earliest date encoded in the filename.

positional arguments:
  path                  Path to WhatsApp media folder

options:
  -h, --help            show this help message and exit
  -c CHUNK_SIZE, --chunk-size CHUNK_SIZE
                        Chunk size for heuristic, smaller values are generally faster but if many files have identical starting chunks, performance degrades as more full hashes are computed
  -f, --force           Delete duplicates without prompting
  -r, --recursive       Recursively process media
  --dry-run             Dry run deletion (no files deleted)

Stow pictures by year/month

usage: sort-by-year.py [-h] [-r] [-m] rootpath

Stow pictures in directories 'year' based on picture exif metadata or whatsapp filename date

positional arguments:
  rootpath         Path to pictures folder

options:
  -h, --help       show this help message and exit
  -r, --recursive  Recursively process media
  -m, --month      Create month directories along with year directories

Find files from source directory in target directory

usage: compare-dir.py [-h] src_dir tgt_dir

Find files from source directory in target directory (based on file's checksum)

positional arguments:
  src_dir     Path to source directory
  tgt_dir     Path to target directory

options:
  -h, --help  show this help message and exit

About

Python scripts for pictures archival purposes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.