Last active
September 30, 2021 20:20
-
-
Save vernalkick/3f7aad667e961953f3e415d08dd1dfe4 to your computer and use it in GitHub Desktop.
Ember Exporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Input arguments | |
source_path = ARGV[0] | |
destinationPath = ARGV[1] || '~/Desktop/ember_backup' | |
# Creade destination directory if it doesn't exist | |
`mkdir -p #{destinationPath}` | |
# Find the embersnaps in the directory and count them | |
ember_snaps = Dir["#{source_path}/*.embersnap"] | |
ember_snaps_count = ember_snaps.count | |
number_of_files_successfully_copied = 0 | |
files_not_copied = [] | |
# Loop through the snaps, find the media file and copy it to the destination | |
ember_snaps.each_with_index do |file, index| | |
image_file = Dir["#{file}/*.{png,PNG,jpg,JPG,jpeg,psd,gif,mov,svg}"][0] | |
if image_file == nil | |
files_not_copied << file | |
next | |
end | |
print "Copying file #{index + 1}/#{ember_snaps_count}...\r" | |
`cp '#{image_file}' #{destinationPath}` | |
number_of_files_successfully_copied += 1 | |
end | |
# Let the user know it's done! | |
puts "Done! #{number_of_files_successfully_copied} of #{ember_snaps_count} files copied." | |
# If there's been any errors, let the user know | |
if number_of_files_successfully_copied > 0 | |
puts "\n#{files_not_copied.count} file#{'s' if files_not_copied.count > 1} could not be copied:" | |
files_not_copied.each do |file| | |
puts "- #{file}" | |
end | |
end |
Super helpful! Thanks.
Thanks to your script I could save a library that I had been saving for a decade! thank you!
Thanks for this
Thank you very much for this, finally restored a huge library which I thought was lost.
Hi Vernalkick, after a long odyssey of looking for an alternative to ember I've found Eagle which works very similar to Ember. Yet, transfering the library from Ember to Eagle is manually impossible. Do you think it's possible to write a script, that copies all metadata like tags, notes and URLs to IPTC tags which the could be imported to Eagle...?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I copied one of the .embersnap files, changed the format to .jpg, opened the folder and I can see the jpg.
Not sure what your script does. Is it the equivalent of doing what I just did, but as a batch processor?