summaryrefslogtreecommitdiff
path: root/pictures.nu
blob: c28974d836ee1e56922e67feaf564b8a20bf2aad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env nu

let img_dir = '/home/ch/mnt/home/ch/img'
let pub_dir = '/srv/media/pictures/src'

$env.BORG_PASSCOMMAND = 'pass devices/u242757-sub2@u242757.your-storagebox.de.borg.key'
let borg_path = 'ssh://u242757-sub2@u242757.your-storagebox.de:23/./borg/'
let archive = (borg list --last 1 --format '{archive}' $borg_path)
borg mount $'($borg_path)::($archive)' ~/mnt /home/ch/img
cd $pub_dir
let published = (ls | get name)
cd $img_dir
let all = (open meta.json | where rating == 3 | get id)
let new = ($all | filter {|id| not ($id in $published) })
#let remove = ($published | filter {|id| not ($id in $all)})
cd original
$new | each {|img| 
  let public = $'($pub_dir)/($img)'
  echo $public
  cp -uv $img $public
  chmod u+w $public
  exiv2 rm $public
  exiv2 -M"set Xmp.dc.creator pdp8@pdp8.info" -M"set Xmp.dc.rights © pdp8@pdp8.info" -M"set Xmp.dc.license http://creativecommons.org/licenses/by-sa/4.0/" -M"set Xmp.xmpRights.UsageTerms Creative Commons Attribution-ShareAlike 4.0 International License" -M"set Xmp.xmpRights.Marked True" -M"set Xmp.dc.description Original artwork available from pdp8@pdp8.info" $public
}
cd ~
umount ~/mnt