SHARE
TWEET

Convert Koran SWF 1600 PNG-JPG_fix

pustakakoran Feb 6th, 2019 (edited) 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #BPS eBook downloader
  3. #modified from Republika ePaper downloader written by Ardianto Satriawan
  4. #and modified by Susanto
  5.  
  6. #need gs, pdftk and swftools
  7.  
  8. export TZ=Asia/Jakarta
  9. TODAY=$(date --date='0 days' '+%Y%m%d')
  10. TAHUNBULAN=$(date --date='0 days' '+%Y%m')
  11.  
  12. #get each page
  13. PAGE=1
  14. until [ $PAGE -gt 44 ]; do
  15. wget "http://page.isu.pub/150531032644-8798967ba5a76be78fcd52ecd2cd6ac6/swf/page_"$PAGE".swf"
  16. let PAGE+=1
  17. done
  18.  
  19. echo "selesai ambil file koran..."
  20.  
  21. #convert COVER
  22. echo "konversi halaman 1 sampai 9..."
  23. PAGE=1
  24. until [ $PAGE -gt 1 ]; do
  25. swfrender -X 1600 -Y 2790 page_$PAGE.swf -o page_$PAGE.png
  26. convert -verbose -density 300 -trim page_$PAGE.png -flatten -sharpen 0x1.0 page_$PAGE.jpg
  27. mv page_$PAGE.jpg riaupos20150531.jpg
  28. rm -f page_$PAGE.jpg
  29. rm -f page_$PAGE.png
  30. let PAGE+=1
  31. done
  32.  
  33. cp riaupos20150531.jpg /home/koran/public_html/HASIL/
  34. rm -f riaupos20150531.jpg
  35.  
  36. #convert to pdf
  37. echo "konversi halaman 1 sampai 9..."
  38. PAGE=1
  39. until [ $PAGE -gt 9 ]; do
  40. swfrender -X 1600 -Y 2790 page_$PAGE.swf -o page_$PAGE.png
  41. convert -verbose -density 300 -trim page_$PAGE.png -flatten -sharpen 0x1.0 page_$PAGE.jpg
  42. convert page_$PAGE.jpg page_0$PAGE.pdf
  43. mv page_$PAGE.jpg riaupos20150531_0$PAGE.jpg
  44. rm -f page_$PAGE.swf
  45. rm -f page_$PAGE.png
  46. let PAGE+=1
  47. done
  48.  
  49. #convert to pdf
  50. echo "konversi halaman 10 sampai selesai..."
  51. PAGE=10
  52. until [ $PAGE -gt 44 ]; do
  53. swfrender -X 1600 -Y 2790 page_$PAGE.swf -o page_$PAGE.png
  54. convert -verbose -density 300 -trim page_$PAGE.png -flatten -sharpen 0x1.0 page_$PAGE.jpg
  55. convert page_$PAGE.jpg page_$PAGE.pdf
  56. mv page_$PAGE.jpg riaupos20150531_$PAGE.jpg
  57. rm -f page_$PAGE.swf
  58. rm -f page_$PAGE.png
  59. let PAGE+=1
  60. done
  61.  
  62. #merge the PDFs pakai pdftk - edited by aris
  63. echo "sedang menggabungkan file menjadi satu file PDF..."
  64. #pdftk *.pdf output riaupos-$TODAY.pdf
  65. gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=riaupos20150531.pdf -dBATCH *.pdf
  66.  
  67. #membuat folder
  68. mkdir riaupos20150531
  69.  
  70. #moving into todays directory
  71. mv ./*.jpg ./riaupos20150531
  72.  
  73. #remove GIFs
  74. echo "sedang menghapus file JPG..."
  75. rm -f *.jpg
  76.  
  77. #remove PDFs
  78. echo "sedang menghapus file PDF..."
  79. rm -f page_*.pdf
  80.  
  81. #PDF Metadata Koran
  82. exiftool -Title="riaupos20150531" -Author="pustakakoran.com" -Publisher="riaupos" -Subject="riaupos"$TAHUNBULAN"" riaupos20150531.pdf
  83. rm -f "riaupos20150531.pdf_original"
  84.  
  85. #Kompress Folder JPG
  86. zip -r riaupos20150531jpg.zip riaupos20150531
  87. rm -f -r riaupos20150531
  88.  
  89. #Copy ke BANKSOAL
  90. cp *20150531.pdf /home/koran/public_html/HASIL/
  91. cp *20150531jpg.zip /home/koran/public_html/HASIL/
  92.  
  93. #remove rest files
  94. rm -f *.swf
  95. rm -f *.png
  96. rm -f *.jpg
  97. rm -f *20150531.pdf
  98. rm -f *20150531jpg.zip
  99.  
  100. #Finished
  101. echo "Epaper dari riaupos20150531 sudah jadi silakan periksa..."
  102.  
  103. #bash issuu-riaupos.sh
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top