2018-12-19 Podcasting

I’ve been listening to Judd Karlman’s podcast, Daydreaming about Dragons, and I liked the idea so much! Just pick up your phone and start talking. It seems that the Anchor app makes this really easy.

Check it out: Halberds and Helmets Podcast.

As for me, I just recorded a voice memo and mailed it to myself, wrote the XML by hand and made myself a little script to tag everything correctly.

Makefile

I use ffmpeg to convert m4a to mp3. Quality is set to 7, which is pretty bad, but not too bad, and reduces the filesize from 24MB down to 5MB.

%.mp3: %.m4a
	ffmpeg -i "$<" -codec:v copy -codec:a libmp3lame -q:a 7 "$@"
	./tag "$@"

upload:
	rsync --rsh="ssh -p 882" *.mp3 *.xml \
	--archive --itemize-changes \
	alexschroeder.ch:alexschroeder.ch/podcast/

Tags

I tried to put this into the Makefile but all the escaping of the variables ended up not working. It’s simpler to just write a little perl script. It takes the track number from the filename and finds the appropriate title field in the XML file. That was the important part. This uses id3v2 to do the tagging.

#!/usr/bin/env perl
use Modern::Perl;
use XML::LibXML;
my $file = shift;
die "What file?\n" unless $file;
if ($file =~ /(\d+)/) {
  my $artist = "Alex Schroeder";
  my $album = "Halberds & Helmets";
  my $track = $1;
  my $genre = 101; # speech
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
      localtime(time);
  $year += 1900;
  open my $fh, '<', 'hh.xml';
  binmode $fh;
  my $dom = XML::LibXML->load_xml(IO => $fh);
  my $song = $dom->findvalue("//item[position()=$track]/title");
  qx(id3v2 --artist '$artist' --album '$album' --track '$track' --genre $genre --year $year --song '$song' $file);
  print(qx(id3v2 --list $file));
}

Tags:

Comments


Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.