From d689fcab58379b629e64bec19c7e6b6e9921da1b Mon Sep 17 00:00:00 2001 From: chickenflyshigh Date: Tue, 22 Oct 2024 16:00:40 +1100 Subject: [PATCH] Updated README --- README.md | 14 +++++++++++- meta-exif-media | 61 ------------------------------------------------- 2 files changed, 13 insertions(+), 62 deletions(-) delete mode 100755 meta-exif-media diff --git a/README.md b/README.md index 18ad536..ad3794b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ # meta-exif -Organise media and add simple EXIF data to downloads from Facebook or Instagram. +Organises media into audio, photo and video categories from the account data downloaded from Facebook and Instagram, and automatically adds relevant EXIF data retrieved from the JSON files into the media. Useful for timelines in photo backup apps and etc. + +Main tools required: unzip, ffmpeg, jq, sed, parallel, exiftool. + +For Facebook: +1. Download JSON information facebook from [Facebook Accounts Center](https://accountscenter.facebook.com/info_and_permissions). +2. Unzip the files into a directory. E.g. `mkdir facebook && find <downloads directory> -maxdepth 1 -name "facebook-*.zip" -exec unzip '{}' -d facebook`. +3. Create output directory `mkdir facebook_media` +4. Run `./main.sh -d facebook -O facebook_media`. + +For Instagram: +1. Download the JSON Instagram information from [Facebook Accounts Center](https://accountscenter.facebook.com/info_and_permissions). +2. Repeat the remaining steps above, replacing the words facebook with instagram. diff --git a/meta-exif-media b/meta-exif-media deleted file mode 100755 index b7c3676..0000000 --- a/meta-exif-media +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -set -e - -usage() { echo "Usage: $0 [-d ] [-O ]" 1>&2; exit 1; } - -while getopts ":O:d:" o; do - case "${o}" in - O) - O="${OPTARG}" - ( [ -d "${O}" ] && echo "No output directory specified, outputting in the directory specified by -d flag.") || (echo "Not a directory ${d}" && usage ) - ;; - d) d="${OPTARG}" - [ -d "${d}" ] || (echo "Not a directory ${d}" && usage) - ;; - *) usage - ;; - esac -done - -if [ -z "$d" ]; then - echo "Missing -d." >&2 - usage && exit 1 -fi - -if [ -z "$O" ]; then - O="$d" -fi - -# cleaning pathnames -O="${O%/}" -d="${d%/}" -! [ -f "$d/metadata.txt" ] || (echo "metadata.txt already exists in the input directory, exiting for now." && exit 1) - - -if [ -d "${d}/your_instagram_activity" ] || [ -d "${d}/your_facebook_activity" ]; then - m="$(find "${d}" -maxdepth 1 -name "your_*_activity" -exec basename '{}' ';' | cut -d '_' -f 2)" -else - echo "Please ensure the input directory specified by -d contains the \"your_{platform}_activity\" folder." && usage -fi - -echo "Wrapping aac files in mp4 containers. Placing it in the same directory as the original file." - -fd '' -e 'aac' "$d" | parallel -n 1 -P $(nproc) 'filename={} && ffmpeg -i ${filename: -4}.aac -c:a copy ${filename: -4}.mp4' - -echo "aac to mp4 conversion complete. Proceeding to create folders under $d/exif_media." -mkdir -p "$O/exif_media/"{audio,photo,video} -echo "Folders successfully created." -echo "Extracting information and metadata from all media and outputting into \"${d}/metadata.txt\" file." -for folder in inbox e2ee_cutover archived_threads filtered_threads; - do - if [ -d "${d}/your_${m}_activity/messages/$folder" ]; then - echo "$(dirname "$0")/smmdo" "$m" "$folder" "${d}/metadata.txt" - "$(dirname "$0")/smmdo" "$d" "$m" "$folder" "${d}/metadata.txt" - fi -done - -echo "Adding metadata to media files and outputting the editted files in \"$O/exif_media\"." -"$(dirname "$0")/edit_exif_move_media" -f "${d}/metadata.txt" -a "$O/exif_media/audio" -v "$O/exif_media/video" -p "$O/exif_media/photo" - -echo "EXIF data successfully added and outputted in \"$O/exif_media\"."