3 # Copyright (C) 2008 Jonathan Moore Liles #
5 # This program is free software; you can redistribute it and/or modify it #
6 # under the terms of the GNU General Public License as published by the #
7 # Free Software Foundation; either version 2 of the License, or (at your #
8 # option) any later version. #
10 # This program is distributed in the hope that it will be useful, but WITHOUT #
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
15 # You should have received a copy of the GNU General Public License along #
16 # with This program; see the file COPYING. If not,write to the Free Software #
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
19 ## import-external-sources
21 # June 2008, Jonathan Moore Liles
23 # Simple script to scan a compacted Non-DAW project and copy external
24 # sources into the project directory.
28 # $ import-external-sources ~/audio/'The Best Song Ever'
43 rm -f "${TEMP}/external-sources"
53 echo "Would import: ${FILE}"
55 echo "Importing source \"${FILE}\"..."
57 [ -f "${FILE}.peak" ] && cp "${FILE}.peak" sources
59 ( echo "%s':source \"${FILE}\"':source \"${FILE##*/}\"'"; echo -e "\nwq" ) |
65 [ $# -gt 0 ] || fatal
"Usage: $0 [--dry-run] path/to/project"
67 if [ "$1" = --dry-run ]
75 cd "$PROJECT" || fatal
"No such project"
77 [ -f history ] && [ -f info
] || fatal
"Not a Non-DAW project?"
79 [ -f .lock
] && fatal
"Project appears to be in use"
81 if [ $ONLY_COMPACTED = yes ]
83 grep -v '\(^\{\|\}$\)\|create' history && fatal
"Not a compacted project"
86 echo "Scanning \"${PROJECT}\"..."
88 sed -n 's/^\s*Audio_Region .* create :source "\([^"]\+\)".*$/\1/; /^\//p' history |
sort |
uniq > "${TEMP}/external-sources"
90 import_sources
< "${TEMP}/external-sources"