I wonder if my hive crew have been missing my incessantly nonsensical comments or if they're enjoying the serenity.
<p dir="auto">As I mentioned at the end of the last progblog I wrote two weeks ago (x_x), I finally managed to pick up a cute laptop (I'm so used to getting the highest spec'd things that getting something practically off the shelf and only upgrading storage feels so weird and wrong) and get back into the overpriced (I'm now broke for the next 6 years) and very...um..."special" Apple ecosystem that I have this love/hate relationship with (love it because it's the one that gives me the least problems and I find their devices fun to use, and hate it because it is so very overpriced and some things make me -_-). <p dir="auto"><center><span><img src="https://images.hive.blog/768x0/https://technonaturalist.net/sites/default/files/styles/watermark/public/blog/shiny-new-mba.jpg?itok=TWcDIPlv" srcset="https://images.hive.blog/768x0/https://technonaturalist.net/sites/default/files/styles/watermark/public/blog/shiny-new-mba.jpg?itok=TWcDIPlv 1x, https://images.hive.blog/1536x0/https://technonaturalist.net/sites/default/files/styles/watermark/public/blog/shiny-new-mba.jpg?itok=TWcDIPlv 2x" /> <p dir="auto">I've since done the major setup stuff (including using my wallpaper folder so I have less generic backgrounds which are more for the lockscreen than anything else as I rarely see the desktop) and it's just little tweaks and at some stage setting up my tablet. <p dir="auto">The reasons for getting the small rig extended past my usual needing something mobile for the time periods where I'm going to be away from the big rig. The small rig is now also going to be housing the photo library partly as it's easier to drag around to show photos to relatives, and mostly because I've been having a lot of problems with importing photos on the big rig. Initially I thought that the photos weren't importing and that I'd lost a batch of them, which resulted in me not deleting anything off my phone just in case. Eventually I worked out that some of them were going into the wrong date folders but couldn't work out what I was doing wrong even after fiddling with settings. As both shotwell and digikam were doing the same things I decided there was probably something interesting going on with gphoto which both use as a backend and continued hoarding images on my phone as I had no idea where the missing photos were ending up. <p dir="auto">My initial thoughts were to just import everything into Photos and sync the originals folder, which once upon a time used to just be date based like everything else. <p dir="auto">No longer. Now it looks like <p dir="auto"><center><span><img src="https://images.hive.blog/768x0/https://technonaturalist.net/sites/default/files/styles/watermark/public/blog/image.png?itok=hwUY5aHQ" srcset="https://images.hive.blog/768x0/https://technonaturalist.net/sites/default/files/styles/watermark/public/blog/image.png?itok=hwUY5aHQ 1x, https://images.hive.blog/1536x0/https://technonaturalist.net/sites/default/files/styles/watermark/public/blog/image.png?itok=hwUY5aHQ 2x" /> <p dir="auto">and has probably been like that for quite a while but I haven't used a Mac since my 2011 iMac. I could have synced that but I would have never been able to find anything. <p dir="auto">So I grabbed a selection of files and started running some tests trying to work out how the hell I was going to make what I thought would be a relatively straightforward job work. <p dir="auto"><sub>Pro-tip: nothing is ever straightforward when you mix operating systems. Different versions of the same operating systems also count as different operating systems. <p dir="auto">After much stuffing around, I eventually decided that the easiest thing to do would be to import everything into Photos, set up a smart album to collect the latest imports (because currently the Imports view seems to show everything that was ever imported separated by the dates they were imported which requires me being more careful about clicking than I want to be) and export everything in that album to a sorting folder (not to be confused with a sorting hat) which will then trigger an Automator folder action and sort them nicely into my cloud sync folder in the date based structure I wanted and have been using for years (since 13th of August 2004 to be precise). <p dir="auto">A few hours playing with Automator later and I realised I was going to need a shell script. <p dir="auto">Do you think I could find a shell script that did what I wanted? <p dir="auto">I spent a week scouring the internet and learning just enough zsh scripting to <del>be a total and complete hazard to myself and everyone around me get the test folder sorting nicely. <p dir="auto">I also needed <a href="https://exiftool.org/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">exiftool to get the file creation dates I wanted. <p dir="auto">To make the Automator thing: <ol> <li>make the sorting folder where you like (mine is just in my home directory on the same level as the Nextcloud sync folder for no other reason than convenience) <li>make a new Folder Action in Automator <li>in <strong>Folder Action receives files and folders added to dropdown, locate your sorting folder <li>put in a <strong>Get Specified Finder Items node. If you haven't used Automator before you'll probably get a warning dialogue at some point saying that you need it to test the folder action in Automator and should remove or disable it when using the actual folder to trigger the folder action. However I found that for whatever reason removing or disabling the node stopped the folder action from working at all <li>select or drag and drop your sort folder into the box <li>put in a <strong>Get folder contents node <li>put in a <strong>Run shell script node <li>change <strong>Pass input to <em>as arguments <p dir="auto">Copy this into the script box. If you run it in Automator it should spit out a bunch of comments to tell you what's going on while you're testing, or it will just do its thing if you just use the folder action. <p dir="auto">ALWAYS TEST ON A TEST FOLDER WITH TEST FILES FIRST. <pre><code>for f in "$@" do # use exiftool to get the creation dates we want # sometimes all exif data is missing in which case we have to fall back # to a file system create date # # the multiple -s gets rid of some labels that exiftool helpfully # supplies for if you're using it on command line device=$(/usr/local/bin/exiftool -s -s -s "-Keys:CreationDate" "$f") device2=$(/usr/local/bin/exiftool -s -s -s -datetimeoriginal "$f") exif=$(/usr/local/bin/exiftool -s -s -s -createdate "$f") fs=$(stat -f "%SB" $f) # now we're going to break down the dates into year/month/day variables # and populate starting from the least desirable file system create date # and hopefully override with the more desirable dates further down if [[ -z $fs ]] # -z means "empty" and if this first one is empty there's problems XD then echo wtf how does $f:t have no fs create date else y=$(stat -f "%SB" -t "%Y" "$f") m=$(stat -f "%SB" -t "%m" "$f") d=$(stat -f "%SB" -t "%d" "$f") echo $f:t has filesystem create date $y $m $d fi # some of the files I was working with had zeroed exif dates for some reason # the next few ifs check for empty variables or if they start with four zeroes # in which case it counts as empty if [[ -z $exif || ${exif:0:4} == "0000" ]] then echo $f:t has no exif date else y=$(/usr/local/bin/exiftool -s -s -s -createdate -d "%Y" "$f") m=$(/usr/local/bin/exiftool -s -s -s -createdate -d "%m" "$f") d=$(/usr/local/bin/exiftool -s -s -s -createdate -d "%d" "$f") echo $f:t has exif date $y $m $d fi if [[ -z $device2 || ${device2:0:4} = "0000" ]] then echo "$f:t has no device2 date" else y=$(/usr/local/bin/exiftool -s -s -s -datetimeoriginal -d "%Y" "$f") m=$(/usr/local/bin/exiftool -s -s -s -datetimeoriginal -d "%m" "$f") d=$(/usr/local/bin/exiftool -s -s -s -datetimeoriginal -d "%d" "$f") echo $f:t has device2 date $y $m $d fi if [[ -z $device || ${device:0:4} == "0000" ]] then echo "$f:t has no device date" else y=$(/usr/local/bin/exiftool -s -s -s "-Keys:CreationDate" -d "%Y" "$f") m=$(/usr/local/bin/exiftool -s -s -s "-Keys:CreationDate" -d "%m" "$f") d=$(/usr/local/bin/exiftool -s -s -s "-Keys:CreationDate" -d "%d" "$f") echo $f:t has device date $y $m $d fi # change this to the path you want the files to be sorted into # (which is obviously going to be different from your sort folder just in case # that wasn't clear from the outset) target=/path/you/want/things/sorted/to/$y/$m/$d # if the target directory doesn't exist if [[ ! -d $target ]] then echo $target created, moving $f:t mkdir -p $target # make all the folders mv $f $target # and move the file to the target folder # if the target directory does exist else echo $target exists # check to see if there's a file with the same name in there if [[ ! -e $target/$f:t ]] then # if there isn't, move the file mv $f $target echo moved $f:t to $target else # if there is, we're going to add a number to the file name echo file called $f:t already exists in $target n=1 # first we check to see if there is already a filename-nn.ext # if not, we rename the file and then move it if [[ ! -e $target/$f:t:r-$n.$f:t:e ]] then echo n is $n mv $f $target/$f:t:r-$n.$f:t:e echo renamed to $f:t:r-$n.$f:t:e and moved to $target # if there is a filename-nn already in the folder, we add 1 and try again # until we get a unique filename and then rename and move the file else while [[ -e $target/$f:t:r-$n.$f:t:e ]] do echo file called $f:t:r-$n.$f:t:e already exists in $target (( n++ )) mv $f $target/$f:t:r-$n.$f:t:e echo renamed to $f:t:r-$n.$f:t:e and moved to $target done fi fi fi done <p dir="auto">There's more information on <a href="https://zaiste.net/posts/zsh-get-filename-extension-path/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">getting bits out of the path (the <code>$f:t etc bits) and the <a href="https://dev.to/puritanic/shellscripting-conditional-execution-3kgm" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">test operators (the <code>-z, <code>-e etc bits) that I found in my travels that helped immensely. <p dir="auto">The above can be modified to a photos cleanup script by ticking the <em>Repeat for each subfolder checkbox in the <strong>Get folder contents node and adding in a <strong>Filter Finder Items node straight after it and before the script node. The filter you then need is <em>Kind is not folder. <p dir="auto">I did try this out but it turned out a lot of my older photos have incorrect date information so it didn't work out that well in my case and I'll have to find and fix problems manually on the Nextcloud server when I can be bothered. <p dir="auto">There are probably much better ways to write this (including theoretically adding ! to the conditionals and removing all the echos if you just wanted it to do its thing and don't care about feedback) but I suck at coding, it took me way too long to come up with this and even longer to try and fail to get the cleanup version working. <p dir="auto">I have tested it out with a manual export (because after importing everything into Photos the export smart album of course contained a lot of things because a lot of things had been imported "in the last day") and everything seems to be working as it should. The only minor panic I had was that it exported heic files (probably because I ticked the box to export unmodified originals), but digikam is able to read them. <p dir="auto">Can't say the same about the Nextcloud webapp as browsers haven't caught up yet but that's fine XD <p dir="auto">Now I can get back to art and everything else I've been neglecting while getting this sorted x_x <p dir="auto"><center><span><img src="https://images.hive.blog/250x250/https://images.hive.blog/DQmUKL6XzyPEHPxgt6qsSLQgtNqa3PWXUP58AZQ8v9AbkHZ/team-australia-hive-badge-ryivhnn.png" /> <p dir="auto">This post also appears on <a href="https://technonaturalist.net/blog/2020/11/automator-partial-notes-convoluted-photo-management" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">my blog. <p dir="auto"><sub>sleep is one of the many things I've been neglecting x_x <p dir="auto">Want a crowd character? If you interact frequently with me here (either on my posts or your posts or better yet both!) or on one of the linked Discord channels, all you have to do is let me know and tell me what you'd like :) <a href="https://technonaturalist.net/how-get-aer-cameo-character" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Everything you need to know is (probably) here and if it isn't just ask (sorry the link goes offsite to my blog where the layout is how I want rather than the one here which is only here because the original one was). <p dir="auto">Thanks for looking! ^_^ <p dir="auto">Come hang out on Discord with us! <p dir="auto"><a href="https://discord.gg/rVrSZ8w" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">PAL | <a href="https://discord.gg/qnrMgjC" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">ANZ | <a href="https://discord.gg/8uNEEEH" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Be Awesome | <a href="https://discord.gg/CvUP9X3" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">artbees<span><a href="/trending/teamaustralia">#teamaustralia on <p dir="auto"><center><span><img src="https://images.hive.blog/768x0/https://technonaturalist.net/sites/default/files/styles/sensible_display/public/art/2017/11/goatsig-t.png?itok=Ml3FDq7c" srcset="https://images.hive.blog/768x0/https://technonaturalist.net/sites/default/files/styles/sensible_display/public/art/2017/11/goatsig-t.png?itok=Ml3FDq7c 1x, https://images.hive.blog/1536x0/https://technonaturalist.net/sites/default/files/styles/sensible_display/public/art/2017/11/goatsig-t.png?itok=Ml3FDq7c 2x" /> <p dir="auto"><center><sub>-={ <a href="https://technonaturalist.net/commissions" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">commission info | <a href="https://ko-fi.com/K3K3K1FA" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">ko-fi }=- <p dir="auto"><center><sub>Ask me nicely if you want an upgoat/cute critter footer.
I for one missed your comments.
I am also trying to sort my photos after a hard disk crash caused by little fingers turning off my computer while it was just starting up. Luckily I have them all backed up online but it does mean I have to download them all again to have a local copy.
I still need to work on my naming and folder conventions, For dealing with images I usually rely on ACDSEE but I recently found an open-source one called Faststone image viewer, it has batch conversion tools also. Maybe check it out.
I love the fact that you can do coding as well.
^_^
Oh no little fingers they're lucky they're so cute DX phew yay for backups, this is why I have so many redundancies XD (I have two copies of my project on the big rig, one in the working folder and one on the nextcloud sync folder which are kept in sync with FreeFileSync, two copies of the photos on the small rig, one in the internal Photos thing and the one in the nextcloud sync folder with exports from Photos going straight into the nextcloud sync folder, and also have backups from the big rig which does both a project backup and an entire homedir backup including the nextcloud sync folder to an external drive, which gets swapped over weekly or so with another one that's at my aunty's place XD)
As shown in the script I just use /y/m/d so for example my latest photo imported from my phone on the 20th of November is in 2020/11/20/IMG_0301.HEIC. Makes it slightly easier for me to find things using file browsers or digikam on the big rig as I usually have some idea of at least what year the photo was taken in XD
One of the things I do like about Photos is even if it's pretty useless for most other things, it's great at automatically sorting and doing this pretty mosaic display thing (pretty is just as important as functional for me) so it's one less thing for me to think about.
Had a quick look at Faststone, looks like Windows only? I have Manjaro and MacOS and basically avoid Windows like the plague because that's the one I can break by being in the same area too long XD
Never sure if my cheap hacks can count as coding ;D
oh ps you get to be today's experiment to see if I can do this yet:
!ENGAGE 10
ENGAGE
tokens.Awesome!
I must admit that I scanned this post, as it felt like dev talk ( 0s and 1s ) and yeah, I have been missing your comments ( not just yours ), as you are one of the most faithful commenters on my feed and the feed of many.
Glad to find out that this was the reason for your 'absence'. It reminded me somewhat of editing on a MAC ( in 2008 and earlier in that decade ) and realizing how much different these machines are than the Windows PCs that I grew up with. It's like your entire brain needs to be rewired.
Big hug,
Vincent
On a pure technicality I'm wondering if you meant skimmed as that means you read over it really quickly whereas if you're scanning you're still reading quickly but looking for specific things XD
crawls back into hole
Most of it was techy nonsense but it was stuff that needed to be done for my photo collection shenanigans to work :)
Unfortunately some other crap has come up that we could have really done without so I won't have much prog to blog again >_<
but I can at least comment when my brain cooperates
!ENGAGE 10
ENGAGE
tokens.Congratulations @ryivhnn! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :
<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@ryivhnn/replies.png?202011270347" /><td>You got more than 15000 replies. Your next target is to reach 15500 replies. <p dir="auto"><sub><em>You can view your badges on <a href="https://hivebuzz.me/@ryivhnn" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">your board and compare yourself to others in the <a href="https://hivebuzz.me/ranking" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Ranking<br /> <sub><em>If you no longer want to receive notifications, reply to this comment with the word <code>STOPCongratulations @ryivhnn! You received a personal badge!
Wait until the end of Power Up Day to find out the size of your Power-Bee.
May the Hive Power be with you!
You can view your badges on your board and compare yourself to others in the Ranking
Congratulations @ryivhnn! You received a personal badge!
Participate in the next Power Up Day and try to power-up more HIVE to get a bigger Power-Bee.
May the Hive Power be with you!
You can view your badges on your board and compare yourself to others in the Ranking