Online MAnga Downloader v1.0.1 release

It’s little late, but version 1.0.1 of OMAD (Online MAnga Downloader) is finally here. This is maintenance release that fixes bato.to parser and drops support for kissmanga.com that broke after 1.0 release and fixing it was just too painful. There were also many internal changes to code structure that should make OMAD more stable or at least crash with meaningful message.

I have never done 1.0 post, so here is short list of what can final version of OMAD do.

  • Can download selected range of chapters or whole series from online manga reading websites
  • Supports bato.to, mangafox.me, mangatraders.org
  • Compresses downloaded chapters into ZIP files
  • Can be run without GUI => has many commandline options

The next thing I would like to do in future, would probably be to allow you to login to websites before downloading any chapters. That’s because bato.to and maybe even mangatraders.org started to hide some chapters/series when you are not logged in.

You can download both newest release and source code from my GitHub. I broke my Windows VM so there wont be any official Windows build for a while, but you can still install it manually.

Advertisements

Installing PCSX2 on 64bit Linux

Since PCSX2 can only be compiled for 32bit processors, you either need to install 32bit versions of all needed libraries on your 64bit system (sometimes impossible) or run PCSX2 from 32bit chroot. This how-to will use chroot solution.

What you need

  • Ubuntu 14.04 Trusty (64bit)
  • PS2 BIOS files
  • Know how to save end exit from nano text editor
  • 2+ GB in your root partition (or where is /srv located)

This how-to is made for Ubuntu 14.04 (64bit), but it should be usable (with some modifications) for other Linux distributions.

1. Create 32bit chroot

Install chroot tools and create chroot configuration file

(host)$ sudo apt-get install debootstrap schroot
(host)$ sudo nano /etc/schroot/chroot.d/trusty_i386_conf
[trusty_i386]
description=Ubuntu 14.04 Trusty for i386
directory=/srv/chroot/trusty_i386
personality=linux32
root-users=USER
#run-setup-scripts=true
#run-exec-scripts=true
type=directory
users=USER

Create chroot directory

(host)$ sudo mkdir -p /srv/chroot/trusty_i386

Build chroot

(host)$ sudo debootstrap --variant=buildd --arch i386 trusty /srv/chroot/trusty_i386 http://archive.ubuntu.com/ubuntu

Enter chroot

(host)$ schroot -c trusty_i386 -u root

Install some tools needed to finish installation

(chroot)# apt-get install sudo nano software-properties-common

Fix software sources

(chroot)# cp /etc/apt/sources.list /etc/apt/sources.list.backup
(chroot)# nano /etc/apt/sources.list
###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse

###### Ubuntu Update Repos
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu trusty partner
deb-src http://archive.canonical.com/ubuntu trusty partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main

Add missing software source keys and upgrade chroot system

(chroot)# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5
(chroot)# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
(chroot)# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
(chroot)# apt-get update
(chroot)# apt-get upgrade
(chroot)# apt-get clean

Create some folders for root to fix GTK warnings

(chroot)# mkdir -p /root/.local/share/

2. Install GPU Drivers

Install mesa-utils so you can test if you installed drivers correctly with ‘glxgears’

(chroot)# apt-get install mesa-utils

Install GPU drivers the same way you would do that on host system. This step is different for every GPU!!! For example:

(chroot)# apt-get install nvidia-352

Test 3d rendering with glxgears (if not using software render then its OK)

(chroot)# glxgears

3. Install PCSX2 in chroot

Add PCSX2 software source and install it.

(chroot)# add-apt-repository ppa:gregory-hainaut/pcsx2.official.ppa
(chroot)# apt-get update
(chroot)# apt-get install pcsx2 
(chroot)# apt-get clean

Create PCSX2 start script

(chroot)# nano /usr/local/bin/pcsx2
#!/bin/bash
sh /usr/games/PCSX2-linux.sh

Make script executable

(chroot)# chmod +x /usr/local/bin/pcsx2

4. Link folders with PS2 bios, saves and games to chroot

You probably want to have your save files (memory card images) in your real HOME and not in chroot, so you will not lose them if you accidently delete chroot.

Create folders for memory card images and bios

(host)$ mkdir -p /home/$(whoami)/.config/PCSX2/memcards
(host)$ mkdir -p /home/$(whoami)/.config/PCSX2/bios

Extract your PS2 BIOS files to created folder ‘.config/PCSX2/bios’

Link created folders to chroot

(host)$ sudo mkdir -p /srv/chroot/trusty_i386/root/.config/PCSX2
(host)$ sudo ln -s /home/$(whoami)/.config/PCSX2/memcards /srv/chroot/trusty_i386/root/.config/PCSX2/memcards
(host)$ sudo ln -s /home/$(whoami)/.config/PCSX2/bios /srv/chroot/trusty_i386/root/.config/PCSX2/bios

Create folder where you will put PS2 game images

(host)$ mkdir -p /home/$(whoami)/bin/Consoles/PS2

Link that folder to chroot

(host)$ sudo ln -s /home/$(whoami)/bin/Consoles/PS2 /srv/chroot/trusty_i386/root/PCSX2_games

5. Create PCSX2 Launch script and desktop file

Create launch script

(host)$ mkdir -p ~/bin
(host)$ nano ~/bin/pcsx2
#!/bin/bash
xhost +LOCAL:
echo "export DISPLAY=:0.0; pcsx2" | schroot -c trusty_i386 -u root

Make script executable

(host)$ chmod +x ~/bin/pcsx2

Create desktop file

(host)$ nano /home/$(whoami)/.local/share/applications/pcsx2.desktop
[Desktop Entry]
Encoding=UTF-8
Name=PCSX2
Comment=PCSX2_32bit_chroot
Type=Application
Exec=pcsx2
Categories=Game;

PCSX2 Settings

Here are some PCSX2 settings that I needed to use to fix sound and have better graphics

BIOS: USA v02.20(10/02/2006)

Audio plugin (SPU2):
– Module: SDL Audio
– PortAudio API: ALSA
– SDL API: pulseaudio

Video plugin (GS):
– Fxaa shader: True
– Internal Resolution: 3x
– Anisotropic Filtering: 4x
– Blending Unit Accuracy: Medium

If PCSX2 does not recognize joystick

This fix is for when PCSX2 does not recognize connected joystick, but it’s still recognized by other applications running from chroot without problem (qjoypad)

Install joystick manager

(chroot)# apt-get install qjoypad

Configure joystick to send same keys that would be used if you played with keyboard (defined in OnePAD plugin in PCSX2)

(chroot)# qjoypad
Profile name: PCSX2
axis1: s-f, axis2: e-d
axis3: s-f, axis4: e-d
btn1: k, btn2: l, btn3: j, btn4: i
btn5: w, btn6: p, btn7: a, btn8: ;
btn9: v, btn10: n

Autostart qjoypad when starting PCSX2

(chroot)# nano /usr/local/bin/pcsx2
#!/bin/bash
qjoypad PCSX2 &
sh /usr/games/PCSX2-linux.sh

Connecting to Prestigio devices on Linux with adb

Description of problem

  • You have installed all required tools (android-tools-adb) on your Linux PC
  • USB debugging is enabled on your device
  • After connecting device to PC with usb cable, notification that usb debugging is enabled is shown on device, but adb still can’t see any connected devices
  • $ adb devices
    
    List of devices attached 
    
    
  • Running adb as root doesn’t change anything

Solution

You basically just need to tell adb that it can use devices made by Prestigio (vendor ID 29e4). You can also create usb rule that will make that device accessible without running adb as root.

This solution definitely works for “Prestigio MultiPad 4 Quantum 8.0 3G (PMT5487_3G, lsusb ID 29e4:0c02)“, but it should also work for other Prestigio devices or even devices with same problem from other vendors (as long as you use correct vendor ID).

The following commands use nano for editing configuration files, but you can replace it with any other text editor that can run as root.

  1. Add Prestigio vendor id to adb configuration
  2. $ nano ~/.android/adb_usb.ini
    
    0x29e4
    
  3. Create Linux udev rule (to use adb without root)
  4. First, add current user to plugdev group. (re-login after that)

    $ sudo useradd -G plugdev $(whoami)
    

    Create (or edit) file with udev rule for Prestigio devices.

    $ sudo nano /etc/udev/rules.d/51-android.rules
    
    # ADB - Prestigio vendor
    SUBSYSTEM=="usb", ATTR{idVendor}=="29e4", MODE="0666", GROUP="plugdev"
    

    Change permissions of created file, so it is accessible and readable.

    $ sudo chmod a+r /etc/udev/rules.d/51-android.rules
    

    Finally, reload udev rules and service and kill any adb processes that may be using old settings.

    $ sudo udevadm control --reload-rules
    $ sudo service udev restart
    $ sudo udevadm trigger
    $ sudo killall adb
    
  5. Test connection to Prestigio device
  6. Enable usb debugging on your device and connect it to PC with usb cable.

    $ adb devices
    
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    List of devices attached 
    PMP61542816283	offline
    

    Your device should now be asking you to allow connection from your PC (if this is you first time). Allow it.

    $ adb devices
    
    List of devices attached 
    PMP61542816283	device
    

    That’s all, you should now be able to use adb for whatever you originally wanted.

How to distibute Python applications (PyInstaller)

When I started developing bigger projects in Python, one of the fatal problems I encountered was, how to distribute finished application to end-users without requiring them to manually install Python interpreter and all needed dependencies.

I tried pretty big number of different ways to do that, but ultimately only PyInstaller fulfilled all my requirements.

Why PyInstaller?
The proper way to install Python packages should be to define dependencies in setup.py file and use pip for automatic installation of both application and dependencies. The problem in this approach is that not all dependencies can be installed with pip (PyQt) and using this approach requires pip and Python interpreter to be already installed on host OS.

Pyinstaller builds executable with statically linked libraries, meaning that it doesn’t matter what is actually installed on host OS, since all needed libraries are bundled together with application. Naturally the approach creates very big executables that needs to be build for every OS and architecture separately, but I think that in the end its worth it.

How to use PyInstaller?
Pyinstaller basically takes given python file and recursively follows all import statements to create list of all packages and libraries, that could be possibly needed in runtime.

Here is basic example command for building executable for application “omad”.

pyinstaller -D -n omad omad/__main__.py

-D” option tells PyInstaller to not put everything into one executable file, but to create folder with all files and libraries next to each other. (opposite is “-F” option)
-n NAME” option defines name of build executable
Last is path to your python script with main method.

While running, PyInstaller will create folders “build”, “dist” (with build executable) and file “*.spec” with created build configuration.

To build for different OS or architecture, you need to build on PC with that OS or architecture.

Things to be wary of:

  1. Make sure to remove “*.spec” file when you want to change build configuration, because it has priority over options defined on commandline.
  2. Building may need some additional libraries installed, examples:
    Linux: python-qt4-dev
    Windows: pywin32, MSVCR
  3. If you are using PyQt and have PyInstaller version <= 2.1, there is a bug that makes build executable crash with “import QtCore” error. To fix it install version >= 2.2 or if it’s still not released, use development version from GitHub.
  4. If you need to package resource files together with executable, the easiest way is to use folder mode and after build copy all needed files inside.
  5. Windows build may need “-w” option for hiding terminal window. (will break commandline interface)

Excerpt from my Makefile for building on Linux: (for inspiration)
PyInstaller_makefile

Online MAnga Downloader v0.2 release

Here it is, probably last release before final 1.0 version.

Progress can be summarized by added support for mangatraders.org, some fixed gui bugs and by finally having scripts for building static binaries for both Linux and Windows.

Since there are now static binaries it’s now possible to install without needing to manually download all dependencies and then installing package directly from source. (that is hell on Windows)

Also, I finally fixed Windows version (which probably never worked… sorry) and changed name from just “manga downloader” to unique name “OMAD (Online MAnga Downloader)”

Link to github project: https://github.com/kunesj/omad
Link to downloads: https://github.com/kunesj/omad/releases/tag/v0.2

Streamování živého vysílání programu ČT24

UPDATE: Zprovozněno na Kodi na Androidu, stačí vypnout hardwarovou akceleraci.

Tak jsem napsal malej prográmek, který požádá webové stránky české televize o aktuální adresu k streamu živého vysílání ČT24.

Rozhodl jsem se to napsat, jelikož teď aktuálně jediným způsobem, jak sledovat na počítači živě 24-ku je otevřít prohlížeč na stránce http://www.ceskatelevize.cz/ct24/zive-vysilani/ a použít jejich Flash přehrávač. Navíc adrese streamu po určitém času vyprší životnost, takže i když se pracně prohrabete skrz zdrojový kód několika stránek, tak budete moct získanou adresu streamu použít ve zvoleném multimediálním přehrávači pravděpodobně pouze jedenou.

Tady je adresa samotného skriptu. Je to napsané v Pythonu 2, přičemž musíte mít nainstalované knihovny Requests a BeautifulSoup:

https://github.com/kunesj/GetCTStream/blob/master/get_ct_stream.py

ct24_1

A to není vše, tenhle skript jsem ještě použil k vytvoření pluginu do přehrávače Kodi, který tak umožnuje jedním kliknutím zapnout streamování 24-ky:

https://github.com/kunesj/GetCTStream

ct24_2b

ct24_3
Bohužel se mi to nepovedlo zprovoznit v Kodi na Androidu, což ale doufám že nějak časem vyřeším.

Konjiki no Word Master – The Wanderer with the Unique Cheat (Arc 1) [PDF]

Here is pdf of first arc of Konjiki no Word Master webnovel, that I originally made just for myself. It includes chapters 1 to 68 and illustrations from light novel version.
Credits to translators are included at the end of the file.

Download:
http://www.mediafire.com/download/ahf2q3bjsughsm1/knw_arc1_ch001-068_v3.pdf

Download (version without pictures):
http://www.mediafire.com/download/emc9e6ku9ewg21m/knw_arc1_ch001-068_v3_no-pictures.pdf

Links to translated html versions:
https://netblazer.wordpress.com/
https://yoraikun.wordpress.com/knw-chapters/

Original Japanese webnovel:
http://ncode.syosetu.com/n7031bs/