You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

86 line
1.5 KiB

  1. #!/bin/bash
  2. DIRECTORY=$(cd `dirname $0` && pwd)
  3. IMAGES_DIRECTORY=$DIRECTORY'/../src/assets/images/'
  4. AUDIOS_DIRECTORY=$DIRECTORY'/../public/audio/'
  5. ICONO_HEADER='icono_1.png'
  6. ICONO_FOOTER='icono_2.png'
  7. display_usage(){
  8. echo ""
  9. echo " webbandd script"
  10. echo ""
  11. echo " usage : webbandd.sh <input_directory>"
  12. echo ""
  13. echo " <input_directory> must contains :"
  14. echo " - two image files : icono_1.png & icono_2.png"
  15. echo " - one folder per album with mp3 and/or wav audio files"
  16. echo ""
  17. }
  18. error(){
  19. echo ""
  20. echo " Weband ERROR :"
  21. echo ""
  22. echo " "$1
  23. echo ""
  24. }
  25. # 1 argument required
  26. if [ $# -ne 1 ]
  27. then
  28. display_usage
  29. exit 1
  30. fi
  31. # check_image(){
  32. # if [[ -e $1'.svg' || -e $1'.png' || -e $1'.jpg' ]]
  33. # then
  34. # return 0
  35. # else
  36. # error $1' image file is missing !'
  37. # exit -1
  38. # fi
  39. # }
  40. check_image(){
  41. if [ -e $1 ]
  42. then
  43. return 0
  44. else
  45. error $1' image file is missing !'
  46. exit -1
  47. fi
  48. }
  49. check_image $1'/'$ICONO_HEADER
  50. echo " => "$1'/'$ICONO_HEADER" image exists - OK "
  51. check_image $1'/'$ICONO_FOOTER
  52. echo " => "$1'/'$ICONO_FOOTER" image exists - OK "
  53. #copy images (cover and contact)
  54. cp $1'/'$ICONO_HEADER $IMAGES_DIRECTORY
  55. cp $1'/'$ICONO_FOOTER $IMAGES_DIRECTORY
  56. if [ -d $AUDIOS_DIRECTORY ]
  57. then
  58. rm -rf $AUDIOS_DIRECTORY
  59. fi
  60. mkdir $AUDIOS_DIRECTORY
  61. for d in `find $1/* -type d`
  62. do
  63. echo ' copying audio directory "'$d'"'
  64. cp -r $d $AUDIOS_DIRECTORY
  65. done
  66. echo " => audio files copy - OK "
  67. node $DIRECTORY'/weband-id3-to-json.js'