1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 15:19:44 +02:00

Move and update degimpify script(s)

* Move and rename `degimpify.sh` script to make it easier to find and use the `degimpify` script.
* Make `degimpify.sh` script use `sed` in place.
* Make `degimpify.sh` script use default directories if none are provided.
* Make `degimpify.sh` script support processing all XPM (Pixmap) files in multiple directories.

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
Reference-to: https://github.com/tenacityteam/tenacity/pull/407
This commit is contained in:
Emily Mabrey 2021-07-31 00:13:24 -04:00 committed by GitHub
parent 04609bba01
commit cabd66d8e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 31 deletions

View File

@ -1,10 +0,0 @@
#!/bin/bash
# Run this script to take an xpm generated by the gimp and format it for
# use Audacity
for arg in $@
do
filename=$(tempfile)
cat $arg| sed -e 's/\_xpm\[\]/\[\]/' -e 's/^static char \*/static const char \*/' > $filename
mv $filename $arg
done

View File

@ -1,5 +1,5 @@
/* XPM */
static const char * const Effects_xpm[] = {
static const char * const Effects[] = {
"26 24 78 1",
" c None",
". c #FFFFFF",

View File

@ -1,10 +0,0 @@
#!/bin/bash
# Run this script to take an xpm generated by the gimp and format it for
# use Audacity
for arg in $@
do
filename=$(tempfile)
cat $arg| sed -e 's/\_xpm\[\]/\[\]/' -e 's/^static char \*/static const char \*/' > $filename
mv $filename $arg
done

View File

@ -1,10 +0,0 @@
#!/bin/bash
# Run this script to take an xpm generated by the gimp and format it for
# use Audacity
for arg in $@
do
filename=$(tempfile)
cat $arg| sed -e 's/\_xpm\[\]/\[\]/' -e 's/^static char \*/static const char \*/' > $filename
mv $filename $arg
done

26
images/degimpify.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Run this script on a directory to "degimpify" all XPM files
# within that directory (meaning any file ending with .XPM)
#
# If you run this script with no arguments, it uses the default
# directories, which are the original three directories that were
# being "degimpified" pre-fork.
shopt -s nullglob
input_dirs="$*"
if [ $# -eq 0 ]; then
input_dirs[0]="./EditButtons"
input_dirs[1]="./TranscriptionImages"
input_dirs[2]="./ControlButtons"
fi
for dir in "${input_dirs[@]}"
do
for xpm_file in "${dir}"/*.xpm; do
echo "Degimpify: ${xpm_file}"
sed -e 's/\_xpm\[\]/\[\]/' -e 's/^static char \*/static const char \*/' -i "$xpm_file"
done
done