linux

One Manga Downloader Now Supports Series Hosted on 1000manga.com

As you may have noticed recently, onemanga.com has removed some of their series from the site e.g. Vagabond and Zetman due to license issue. They did it by removing all links from the manga page.

However, today I just found that instead of just removing the links from the manga page, they now provides a link to their sister site (say 1000manga.com) which is still hosting the manga I mentioned above.

Luckily, the code on 1000manga.com is almost the same as onemanga.com so I tweaked the script to automatically download the file from 1000manga.com if it has to do so.

So here's the updated One Manga Downloader. Enjoy reading your favorite mangas!

P.S. Many thanks to the One Manga team for providing and maintaining all those high quality scans :)

Taking Screenshots of Websites Without Opening Browsers

พอดีได้รับมอบหมายงานจากหัวหน้า ว่าทำยังไงก็ได้ ให้มีรูปพยากรณ์อากาศจากเว็บกรมอุตุฯ มาโชว์บนจอ LCD โดยอัพเดตทุกๆ ชั่วโมง การเอามาโชว์นั้นไม่ยาก เพราะแค่อัพโหลดไฟล์ตามขนาดที่กำหนดเข้าเซิร์ฟเวอร์ หลังจากนั้นโปรแกรมมันจะจัดการให้เอง

รูปที่ต้องการนั้น 2 ใน 3 สามารถโหลดมาใช้งานได้เลย เพราะเป็นไฟล์ .jpg ธรรมดา ปัญหาคือรูปอุณหภูมิสูงสุด-ต่ำสุดประจำวัน ที่มันดันเป็น Flash ทางออกที่คิดว่าง่ายที่สุดคือ capture หน้าจอมันมาดื้อๆ นี่แหละ

คำถามคือทำยังไงให้มัน capture หน้าจอให้อัตโนมัติทุกๆ ชั่วโมง ทีแรกว่าจะใช้ AutoIt เปิดบราวเซอร์แล้วสั่ง printscreen แต่คิดว่าดูแล้วไม่ค่อยโปรเท่าไร ลอง google ไป google มา ก็พบว่าอันที่จริงมันมีเครื่องมือแสนสะดวกให้ใช้อยู่แล้ว

Read the rest of this entry »

One Manga Downloader (Shell Script) v1.0

Updated

อยากอ่านการ์ตูนย้อนหลังใน One Manga แต่ขี้เกียจคลิกทีละหน้า เลยเขียน shell scipt บน Cygwin ให้โหลดมาทีละ chapter แล้วเซฟเป็นไฟล์ .cbr จะได้เลือกอ่านได้ง่ายๆ

สคริปต์ที่ใช้ก็ประมาณนี้

#!/bin/bash
 
base_url="http://www.onemanga.com"
manga_name=$1
chapter=$2
last_chapter=$3
 
if [[ "${last_chapter}" == "" ]]; then
    last_chapter=${chapter}
fi
 
while [[ ${chapter} -le ${last_chapter} ]]
do
    next_page_chapter=$chapter
    page_location=`curl -s ${base_url}/${manga_name}/${chapter}/ | grep -i "begin reading" | awk -F\" '{print $2}'`
 
    while [[ $next_page_chapter -eq $chapter ]]
    do
        curl -s ${base_url}${page_location} > tmp_page
 
        image_location=`grep "class=\"manga-page\"" < tmp_page | awk -F\" '{print $4}'`
 
        if [[ "$image_location" != "" ]]; then
            wget $image_location
        fi
 
        page_location=`grep "value=\"next page\"" < tmp_page | awk -F\' '{print $2}'`
        next_page_chapter=`echo ${page_location} | cut -d\/ -f3`
    done
 
    /cygdrive/c/Program\ Files/WinRAR/Rar.exe a ${manga_name}_${chapter}.cbr *.jpg
    rm *.jpg
 
    chapter=$((chapter+1))
done
 
rm tmp_page

สร้าง directory ใหม่ซักอันนึง แล้วเซฟ shell script ข้างบนเป็นไฟล์ชื่ออะไรก็ได้ เช่น onemanga.sh แล้วสั่ง chmod +x onemanga.sh เพื่อให้สามารถ execute ได้

วิธีใช้ก็เรียกสคริปต์ ตามด้วยชื่อเรื่อง (หาจาก URL ใน One Manga), chapter เริ่มต้น และ chapter สุดท้าย เช่น

./onemanga.sh Hajime_no_Ippo 800 824

หรือถ้าต้องการแค่ chapter เดียว ก็ไม่ต้องใส่ chapter สุดท้าย

./onemanga.sh One_Piece 516

ปล. ถ้ารันบน Cygwin ต้องลง cURL กับ wget ด้วย (เลือกจากใน setup.exe) ถ้ารันบนลินุกซ์ หรือไม่ได้ใช้ WinRAR ก็ต้องแก้บรรทัดที่เรียก Rar.exe เป็นอย่างอื่นแทน :P

Hardy's Here!

วันนี้เพิ่งได้ CD Ubuntu 8.04 (Hardy Heron) ที่สั่งจาก ShipIt ครับ

หน้าตาซองเป็นแบบนี้ (ขอปิดที่อยู่หน่อยนึง เผื่อมีเจ้าหนี้ตามอ่านบล็อกอยู่ :P)

Front Envelope

Read the rest of this entry »

Synchronizing Firefox Bookmarks on Windows and Linux

ช่วงนี้เริ่มมึน บางทีเรื่องง่ายๆ ก็ใช้เวลาตั้งนานกว่าจะคิดออก =.=

อยาก sync bookmarks ของไฟร์ฟอกซ์บนวินโดวส์กับลินุกซ์ ก็แค่เข้าไปลบ bookmarks.html ใน ~/.mozilla/firefox/xxxxxxxx.default/ ทิ้งซะ แล้วสร้างลิงค์ไปยังไฟล์ bookmarks.html บนวินโดวส์แทน

ln -s /path/to/firefox/profile/on/windows/bookmarks.html ~/.mozilla/firefox/xxxxxxxx.default/

ขอบคุณ ntfs-3g -- เขียนไฟล์ลงบน NTFS ได้ ชีวิตสะดวกขึ้นเยอะ