SHARE
TWEET

Kode Bash Koran Asli/Penemu di Kaskus

pustakakoran Jul 13th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. https://archive.kaskus.co.id/thread/4516728/129
  2.  
  3. ardi4nto - 08/09/2010 10:59 PM #2566:
  4.  
  5. Gan, ane cuma mau berbagi sedikit ilmu cupu di sini.
  6.  
  7. Cara Download Kompas di Ubuntu (ane masih pake Lynx bukan Maverick D)
  8.  
  9. Persiapan
  10. Senjata yang perlu disiapkan adalah wget dan imagemagick, kalau masih belum ada, bisa diinstall lewat terminal gan
  11. [CODE]sudo apt-get install wget imagemagick[/CODE]
  12. kalau ini udah ada langsung ke langkah berikutnya
  13.  
  14. Langkah-langkahnya
  15. trus ane buat folder di home user ane namanya ePaper, jadi foldernya /home/username/ePaper. Terus ane buat kompas.sh pake gedit di folder itu, caranya ketik aja
  16. [CODE]gedit kompas.sh[/CODE]
  17. di terminal, jangan lupa direktori yang aktifnya harus yang /home/username/ePaper
  18. nah terus ane bikin isi script-nya gan, isinya kaya gini: (agan-agan yang lain copas dari sini aja D )
  19. [CODE]
  20. #!/bin/bash
  21. #Kompas ePaper Downloader
  22. #by: Ardianto Satriawan
  23.  
  24. #get today's date
  25. TODAY=$(date +%d-%b-%Y)
  26.  
  27. #create todays directory
  28. mkdir $TODAY
  29.  
  30. #wget for jpg
  31. PAGE=1
  32. until [ $PAGE -gt 9 ]; do
  33. wget "http://images.cdn.realviewdigital.com/djvu/Kompas/Kompas/"$TODAY"/webimages/page000000"$PAGE"_large. jpg"
  34. let PAGE+=1
  35. done
  36. PAGE=10
  37. until [ $PAGE -gt 44 ]; do
  38. wget "http://images.cdn.realviewdigital.com/djvu/Kompas/Kompas/"$TODAY"/webimages/page00000"$PAGE"_large.j pg"
  39. let PAGE=PAGE+1
  40. done
  41.  
  42. #wget for png
  43. PAGE=1
  44. until [ $PAGE -gt 9 ]; do
  45. wget "http://images.cdn.realviewdigital.com/djvu/Kompas/Kompas/"$TODAY"/webimages/page000000"$PAGE"_large. png"
  46. let PAGE+=1
  47. done
  48. PAGE=10
  49. until [ $PAGE -gt 44 ]; do
  50. wget "http://images.cdn.realviewdigital.com/djvu/Kompas/Kompas/"$TODAY"/webimages/page00000"$PAGE"_large.p ng"
  51. let PAGE+=1
  52. done
  53.  
  54. #move to today's directory
  55. mv ./*.jpg ./$TODAY
  56. mv ./*.png ./$TODAY
  57.  
  58. #combine PNGs with JPEGs
  59. echo "combining raw files..."
  60. PAGE=1
  61. until [ $PAGE -gt 9 ]; do
  62. composite -gravity center "./"$TODAY"/page000000"$PAGE"_large.png" "./"$TODAY"/page000000"$PAGE"_large.jpg" "./"$TODAY"/page0"$PAGE".jpg"
  63. echo "page "$PAGE" done!"
  64. let PAGE+=1
  65. done
  66. PAGE=10
  67. until [ $PAGE -gt 44 ]; do
  68. composite -gravity center "./"$TODAY"/page00000"$PAGE"_large.png" "./"$TODAY"/page00000"$PAGE"_large.jpg" "./"$TODAY"/page"$PAGE".jpg"
  69. echo "page "$PAGE" done!"
  70. let PAGE+=1
  71. done
  72.  
  73. #removing raw files
  74. echo "removing raw files..."
  75. rm ./$TODAY/*large.jpg
  76. rm ./$TODAY/*large.png
  77. echo "done"
  78.  
  79. #converting into PDFs
  80. echo "converting into PDF"
  81. convert ./$TODAY/*.jpg ./$TODAY/Kompas-$TODAY.pdf
  82. echo "done"
  83.  
  84. #removing JPEGs
  85. echo "removing JPEGs"
  86. rm ./$TODAY/*.jpg
  87. [/CODE]
  88. terus simpen gan, lalu keluar dari gedit. Habis itu kita ubah permissionnya kompas.sh gan.
  89. [CODE]chmod +x kompas.sh[/CODE]
  90. Nah kalau udah tinggal jalanin
  91. [CODE]./kompas.sh[/CODE]
  92.  
  93. Nanti Script ini bakalan bikin folder baru bernama tanggal hari ini yang isinya 1 file PDF 44 halaman Kompas yang siapa dibaca dan dibagi gan D
  94.  
  95. Berikut-berikutnya kalau mau download lagi tinggal jalanin ini aja:
  96. [CODE]./kompas.sh[/CODE]
  97. *Bikin skrip kaya gitu susah juga ya, salut deh buat agan-agan terdahulu D
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