From 0555b2cd77986d916968f1443e375fad005c8d43 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Mon, 4 Mar 2024 23:13:40 +0100 Subject: html.rb separated, Makefile for website generation --- music2social.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 music2social.rb (limited to 'music2social.rb') diff --git a/music2social.rb b/music2social.rb new file mode 100755 index 0000000..97742bb --- /dev/null +++ b/music2social.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby +require 'uri' +require 'json' + +Dir.chdir ARGV[0] +content = ['public', '', ''] +date, title = File.basename(ARGV[0]).split('_', 2) +title.gsub!('_', ' ') +content << title + ' LP' +content << File.read('README') +# content << '' +content << "https://pdp8.info/music.html\##{date}" +# content << '' +bc = if File.exist?('bandcamp') + File.read('bandcamp').chomp + else + "https://pdp8.bandcamp.com/album/#{title.gsub(' ', '-')}" + end +content << "Bandcamp: #{bc}" +content << '' +content << '#creativecommons #electronic #music #techno' +content << '==' +content << File.join("https://media.pdp8.info/music/#{File.basename ARGV[0]}", + 'cover.jpeg') + "\t" + `exiv2 -K Xmp.dc.description -P v cover.jpeg`.chomp.sub( + /^lang=\S+ /, '' + ) + +# Dir['*mp3'].each do |mp3| +# content << File.join("https://media.pdp8.info/music/#{File.basename ARGV[0]}", "#{File.basename mp3}") +# end +File.open('/tmp/content.txt', 'w+') { |f| f.puts content.join("\n") } +system 'hx /tmp/content.txt' +puts `curl -sb cookies.txt --data-binary @/tmp/content.txt -X POST https://social.pdp8.info/create` -- cgit v1.2.3