vp-21-ogg-cd-cover.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. # Packages
  3. # vorbis-tools
  4. # cdlabelgen
  5. # imagemagick
  6. # any package you use to view pdf
  7. VIEWER=xreader
  8. clear
  9. # test input parameter
  10. if [ "$1" != "" ]; then
  11. cd $1
  12. fi
  13. # switch
  14. y=0
  15. # generate song list
  16. for i in *.ogg
  17. do
  18. if [ $y -eq 0 ]
  19. then
  20. y=1
  21. title=`ogginfo "$i" | grep ALBUM= | cut -d \= -f 2`
  22. artist=`ogginfo "$i" | grep ALBUMARTIST= | cut -d \= -f 2`
  23. year=`ogginfo "$i" | grep DATE= | cut -b 7,8,9,10`
  24. echo '{#MB}'$title >> sl-utf-8.txt
  25. echo '{#M}'$artist >> sl-utf-8.txt
  26. echo '{#M}'$year >> sl-utf-8.txt
  27. echo ' ' >> sl-utf-8.txt
  28. fi
  29. song_name=`ogginfo "$i" | grep TITLE | cut -d \= -f 2`
  30. track_number=`ogginfo "$i" | grep TRACKNUMBER | cut -d \= -f 2`
  31. echo $track_number $song_name >> sl-utf-8.txt
  32. done
  33. # convert list from utf-8 to ascii
  34. iconv -f UTF-8 -t ASCII//TRANSLIT sl-utf-8.txt > sl-ascii.txt
  35. # convert cover image to eps
  36. convert cover.* cover.eps
  37. # generate cd cover
  38. cdlabelgen -D -m -w -f sl-ascii.txt -e cover.eps -S 0 -o cd_cover.ps
  39. # convert cd cover to pdf
  40. ps2pdf cd_cover.ps cd_cover.pdf
  41. # view it
  42. $VIEWER cd_cover.pdf
  43. # delete temporary files
  44. rm sl-ascii.txt
  45. rm sl-utf-8.txt
  46. rm cover.eps
  47. rm cd_cover.ps
  48. exit