#!/bin/sh

# This is a nautilus script that given a list of files/dirs it packs them into
# an optimized set of DVD volumes (~4480MB) and then it calls K3B to burn the
# created volumes.
#
# Set this script file as executable and put it in ~/.gnome2/nautilus-scripts/
# Then open nautilus, select the files/dirs to be packed, right-click the
# selection and finally run this script via the "Scripts" entry of the context
# menu.
#
# Requires: gaffitter, gaff-k3b (see gaffitter.sf.net), awk, sed and echo

ECHO='/bin/echo -e'
quoted=$($ECHO "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | \
   awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##)

# calls gaff-k3b
eval "gaff-k3b --dvd --split $quoted"
