~tenacity/tenacity

cabd66d8e74b3803fc0b0443666f8ceeabbb9df3 — Emily Mabrey a month ago 04609bb
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
5 files changed, 27 insertions(+), 31 deletions(-)

D images/ControlButtons/degimpify
M images/EditButtons/Effects.xpm
D images/EditButtons/degimpify
D images/TranscriptionImages/degimpify
A images/degimpify.sh
D images/ControlButtons/degimpify => images/ControlButtons/degimpify +0 -10
@@ 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

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

D images/EditButtons/degimpify => images/EditButtons/degimpify +0 -10
@@ 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

D images/TranscriptionImages/degimpify => images/TranscriptionImages/degimpify +0 -10
@@ 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

A images/degimpify.sh => images/degimpify.sh +26 -0
@@ 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