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

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