songy

telegram bot as a songbook
git clone git://git.relim.de/songy.git
Log | Files | Refs | README | LICENSE

prepare_for_search.sh (492B)


      1 #!/bin/sh
      2 # $1 is the folder of chordpro files
      3 
      4 shrink() {
      5 	# echo "$1" | tr '[:upper:]' '[:lower:]' | tr -d "\n,%!?:()'\"\`’‘ "
      6 	# 'tr' doesn't handle multi byte characters well
      7 	echo "$1" | awk '{ print tolower($0) }' | sed "s/[(\^$),%!?:()'\"\`’‘ ]//g" | tr -d "\n"
      8 }
      9 
     10 for file in $(find "$1" -name '*.cho')
     11 do
     12 	name=$(basename "$file")
     13 	name=${name%.*}
     14 	title=$(shrink "$(cho2txt -t "$file" | head -n1)")
     15 	content=$(shrink "$(cho2txt "$file")")
     16 	echo "$name:$title:$content"
     17 done