summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rwxr-xr-xmail.rb7
-rwxr-xr-xmedia.nu25
-rwxr-xr-xmedia.sh12
-rwxr-xr-xpictures.nu26
-rwxr-xr-xupdate-pictures.nu33
6 files changed, 42 insertions, 71 deletions
diff --git a/Makefile b/Makefile
index 718f799..fadd139 100644
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,8 @@ MP3 := $(subst flac,mp3,$(FLAC))
IMG_DIR := $(MEDIA_DIR)/pictures
WWW_DIR := $(IMG_DIR)/www
-IMG := $(wildcard $(SRC_DIR)/*.jpeg)
-IMG_WWW := $(subst $(SRC_DIR), $(WWW_DIR), $(subst jpeg,webp, $(IMG)))
+IMG := $(wildcard $(IMG_DIR)/*.jpeg)
+IMG_WWW := $(subst $(IMG_DIR), $(WWW_DIR), $(subst jpeg,webp, $(IMG)))
VIDEO_DIR := /srv/media/videos
VIDEO_WEBM := $(wildcard $(VIDEO_DIR)/*/*.webm)
@@ -34,6 +34,8 @@ all: test
test: $(TEST_HTML) $(TEST_OTHER)
+www-pictures: $(IMG_WWW)
+
$(TEST_DIR)/rss.xml: $(TEST_HTML)
./rss.rb
@@ -71,10 +73,10 @@ $(TEST_DIR)/%.txt: ./html/%.txt
ffmpeg -i $< -y -vsync 0 -ab 256k -map_metadata 0 -id3v2_version 3 $@
%.webp: %.webm
- ffmpeg -i $< -HIDE_BANNER -loglevel error -vf thumbnail -frames:v 1 -c:v png -f image2pipe - | convert - $@
+ ffmpeg -i $< -loglevel error -vf thumbnail -frames:v 1 -c:v png -f image2pipe - | magick - $@
$(WWW_DIR)/%.webp: $(IMG_DIR)/%.jpeg
- convert $< -resize 1536x1024 -quality 85 $@
+ magick $< -resize 1536x1024 -quality 85 $@
%.mp4: %.webm
ffmpeg -i $< -vf scale=1280:-2 -c:v h264 -c:a aac -b:a 128k -strict -2 -movflags faststart $@
diff --git a/mail.rb b/mail.rb
index 1aac68c..e937710 100755
--- a/mail.rb
+++ b/mail.rb
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-
mailfile = if ARGV[1] and ARGV[1] == 'publish'
File.join(__dir__, 'mail', 'emails')
else
@@ -18,11 +17,11 @@ type = if nr_tracks == 1
end
content = ["From: info@pdp8.info
Subject: [pdp8] #{title.gsub('_', ' ')} #{type}
-Content-Type: text/plain
+Content-Type: text/plain; charset='utf-8'
List-Unsubscribe: <mailto: info@pdp8.info?subject=unsubscribe>"]
content << ''
-content << "the new pdp8 #{type} \"#{title.gsub('_', ' ')}\" is online:"
-# content << File.read('README').chomp
+# content << "the new pdp8 #{type} \"#{title.gsub('_', ' ')}\" is online:"
+content << File.read('README').chomp
content << ''
content << "web: https://pdp8.info/music.html\##{date}"
content << "internet archive: https://archive.org/details/pdp8_#{title}"
diff --git a/media.nu b/media.nu
deleted file mode 100755
index 203d8df..0000000
--- a/media.nu
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env nu
-
-IMG_DIR = /home/ch/mnt/home/ch/img
-PUB_DIR = /srv/media/pictures/src
-
-$env.BORG_PASSCOMMAND = "pass devices/u242757-sub2@u242757.your-storagebox.de.borg.key"
-borg_path = "ssh://u242757-sub2@u242757.your-storagebox.de:23/./borg/"
-archive = (borg list --last 1 --format '{archive}' $borg_path)
-#borg mount $borg_path::$archive ~/mnt /srv/media
-borg mount $borg_path::$archive ~/mnt /home/ch/img
-cd $PUB_DIR
-published = (ls | select name)
-cd $IMG_DIR
-all = (open meta.json | where rating == 3)
-new = ($all | filter {|id| not ($id in $published) })
-cd original
-new | each {|img|
- public = $'($PUB_DIR)/($img)'
- #cp $img $public
- #chmod u+w $public
- #exiv2 rm $public
- #exiv2 -M'set Xmp.dc.creator #{mail}' -M'set Xmp.dc.rights © #{mail}' -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 #{mail}' $public
-}
-cd ~
-umount ~/mnt
diff --git a/media.sh b/media.sh
deleted file mode 100755
index 0c335df..0000000
--- a/media.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-cd /srv/media
-export BORG_PASSCOMMAND="pass devices/u242757-sub2@u242757.your-storagebox.de.borg.key"
-borg_path="ssh://u242757-sub2@u242757.your-storagebox.de:23/./borg/"
-archive=$(borg list --last 1 --format '{archive}' $borg_path)
-#borg mount $borg_path::$archive ~/mnt /srv/media
-borg mount $borg_path::$archive ~/mnt /home/ch/img
-cd /home/ch/mnt/home/ch/img/
-nu -c "open meta.json | where rating == 3"
-cd ~
-umount ~/mnt
diff --git a/pictures.nu b/pictures.nu
deleted file mode 100755
index c28974d..0000000
--- a/pictures.nu
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/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
diff --git a/update-pictures.nu b/update-pictures.nu
new file mode 100755
index 0000000..8d888f8
--- /dev/null
+++ b/update-pictures.nu
@@ -0,0 +1,33 @@
+#!/usr/bin/env nu
+
+$env.BORG_PASSPHRASE = (cat ~/.borg-sub2)
+/etc/profiles/per-user/ch/bin/borg mount --last 1 ssh://u242757-sub2@u242757.your-storagebox.de:23/./borg ~/borg /home/ch/img
+
+do -i { # ensure that borg is unmounted to enable backups
+ let img_dir = ls ~/borg/*/home/ch/img | first | get name
+ let pub_dir = '/srv/media/pictures'
+
+ cd $pub_dir
+ let published = (ls | get name)
+ cd $img_dir
+ # TODO overwrite modified images
+ # TODO add description
+ let all = (open motivs.json | where rating == 3 | get stack | each {|s| $s.0})
+ let new = ($all | filter {|id| not ($id in $published) })
+ print $new
+ cd backup
+ $new | each {|img|
+ let public = $'($pub_dir)/($img)'
+ echo $public
+ cp -uv $img $public
+ chmod u+w $public
+ # TODO add description
+ /etc/profiles/per-user/ch/bin/exiv2 rm $public
+ /etc/profiles/per-user/ch/bin/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 /home/ch/src/publish/
+ /home/ch/.nix-profile/bin/make www-pictures
+}
+
+/run/wrappers/bin/umount ~/borg