[Bins] Editing album long descriptions and XML for everything

Chris Croome chris at croome.net
Fri Apr 11 12:54:51 BST 2003


Hi

I found that it was a real drag editing HTML album longdesc using
bins_edit, so what I have started doing is for each album I create a
longdesc.html file and put my long description in this file and then
I run the attached shell script to update album.xml with this data.

If anyone wants to reimplement this script in Perl that would
probably be better!

Another idea is to modify this script so that is uses HTML Tidy to
ensure that the HTML is valid:

  http://tidy.sf.net/ 

In the medium term I'd be interested in helping migrating the .xml
files to XML RDF, perhaps RSS 1.0, since this would enable the
metadata fields to be mapped to Dublin Core and also XHTML long
descriptions could use the content mod and wouldn't need encoding:

  http://purl.org/rss/1.0/modules/content/

I'll write more on this at some point, it's not something for
tomorrow since it would make most sense if it was done at the same
time as changing everything to XHTML rather than HTML -- then
everything would be XML.

Chris

--
http://chris.croome.net/photos/ 
-------------- next part --------------
#!/bin/bash

# This script is a total hack that could be implememted
# in a far more elegant way in Perl...

# This script is released under the GPL 
# (c) Chris Croome, chris at croome.net, 9 APril 2003

# The idea is that this script is run in a directory that 
# contains a file called longdesc.html that has the unedcoded 
# album long description as HTML that we want to pass to the 
# bins_edit script for it to add it to album.xml. 

# Declare some variables:

BINS_LONGDESC_FILE="longdesc.html"

BINS_ALBUM_FILE="album.xml"

BINS_EDIT="/usr/local/bin/bins_edit"

# You shouldn't need to edit below this.

# Test if the above variables are all valid.

# Test to see if the longdesc file exists 
if [ ! -r "$BINS_LONGDESC_FILE" ]
then
  echo "Please create a file called $BINS_LONGDESC_FILE in your album directory."
  exit 1
fi

# Test to see if the album xml file exists 
if [ ! -r "$BINS_ALBUM_FILE" ]
then
  echo "Please run this script in your album directory after a $BINS_ALBUM_FILE has been created by $BINS_EDIT."
  exit 1
fi

# Test to see if bins_edit is where we think it is 
if [ ! -r "$BINS_EDIT" ]
then
  echo "Can't find $BINS_EDIT, please find it and edit this script to suit."
  exit 1
fi

# See if any arguments have been passed to this script and if print some usage stuff
if [ $# -eq 1 ]
then
  echo "This script is for use with bins_edit."
  echo "This script doesn't take any arguments, please run it in a directory with a $BINS_LONGDESC_FILE and a $BINS_ALBUM_FILE in it."
  exit 1
fi 

# remove carrige returns 

LONGDESC=`cat $BINS_LONGDESC_FILE | tr -d '\n' | tr -d '\r'`

# Update the album file with the new longdesc using bins_edit

$BINS_EDIT -a -m --longdesc="$LONGDESC" . 


More information about the Bins mailing list