Scripts and ideas to manage tons and tons of images and movies
find_media-photolibrary.sh folder
This shell script searches for media files in directories with ".photoslibrary" in their name. It searches for media files within the "originals" subdirectory of each matching directory. The script defines a list of file extensions to search for, and uses this list to search for files with matching extensions. The script outputs the file paths of the matching files to a CSV file, along with their directory and file size. If a file does not match the desired extensions, its path is output to a separate exclusions file.
find_media.sh folder
This shell script searches for media files in a specified directory and its subdirectories. It extracts the folder name from the specified directory path, creates an output file, an exclusions file, and a JSON file with the folder name. It then defines a list of file extensions to search for, and uses this list to search for files with matching extensions in the specified directory and its subdirectories. The script outputs the file paths of the matching files to the output file, and any excluded files to the exclusions file.
Find potential media types missed:
cat exclusions.csv | awk -F '.' '{print $NF}' | sort | uniq
For an apple photolibrary:
getExifData.py folder foldername
For a regular folder with media:
getExifData.py photolib foldername
Sort the output file by size:
sort -t',' -k3 -n -r Movies-output.csv -o sorted_movies.csv
b2 authorize-account
b2 download-file-by-name b2-snapshots-xxxxxxxxx Aperture2016.zip ~/Downloads/Aperture2016.zip
Count files recursively excluding hidden files
find . -type f ! -path '*/.*' | wc -l
python src/rename-files.py <directory>
scripts/move_uuid_dest.sh <source> <destination
find . -name 'mapping.csv' > mappings.txt
./loadmap.sh mappings.txt
Run from the root of the new filenames dir: uuid
find . -type f ! -path '*/._*' > newfilenames.txt
Get list with filesize:
find . -type f ! -path '*/._*' -exec ls -l {} + | awk '{print $9, $5}' > <filename>.txt
python parse-newfiles.py newfilenames.txt filenames.csv
python ./src/parse_awk.py ./awkthumb.txt
sqlite-utils insert mediameta.db filenames ./filenames.csv --csv -d
√ database > ./getFoldersExif.sh ../uuid
./getFoldersExif.sh: line 3: Check: command not found
Searching ../uuid for media files...
The extracted folder name is: uuid
Exif file: uuid-exif.csv
Full Directory = ../uuid
exif_file = uuid-exif.csv
10452 image files read
10452 image files read
7487 image files read
Note the total number of files read is 28,391
sqlite-utils insert mediameta.db exif ./uuid-exif.csv --csv -d
cat ../src/date_to_iso.py| sqlite-utils convert mediameta.db exif CreateDate -
Photos in datasette:
pipenv install datasette-media pipenv install datasette-render-images
sqlite-utils insert-files media.db /Volumes/Eddie\ 4TB/MediaFiles/ThumbFiles/0/*.jpg
datasette -p 8002 --metadata metadata.json media.db
(photomanage) X1 database > datasette -p 8001 --setting sql_time_limit_ms 5500 --metadata metadata2.json mediameta.db
datasette -c datasette.yaml
datasette -p 8001 -c datasette.yaml mediameta.db
datasette -p 8001 --root --load-extension=spatialite -c datasette.yaml mediameta.db
datasette --memory --actor '{"id": "root"}' --get '/-/actor.json'
datasette install datasette-write-ui
datasette install datasette-enrichments
datasette install datasette-enrichments-opencage
datasette install datasette-cluster-map
datasette install datasette-checkbox
In the exif file, rename GPSLatitude & GPSLongitude as latitude & longitude to avoid calling open cage. Unless I change the plugin to use reverse gps to store address info
Or change the name of the columns in the datasette.yaml
plugins:
datasette-cluster-map:
latitude_column: xlat
longitude_column: xlng
plugins:
datasette-media:
photo:
sql: "select prefixed_path as filepath from exif where FileName=:key"
The exif table contains a column called prefixed_path which contains the full path to the image. The FileName column contains the filename.
Then call the image like this:
http://127.0.0.1:8001/-/media/photo/<FileName>
http://127.0.0.1:8001/-/media/photo/04aa8750-9903-427c-bba6-8fb53512b6f2.jpg
And the image will be displayed.