| 1 | # QNapi [](https://travis-ci.org/QNapi/qnapi) [](https://ci.appveyor.com/project/krzemin/qnapi/branch/master) [](https://github.com/QNapi/qnapi/releases) [](https://qnapi.github.io/#download) |
| 2 | |
| 3 | QNapi is free software for automatic fetching subtitles for given movie file. |
| 4 | It uses online databases such as NapiProjekt, OpenSubtitles and Napisy24. |
| 5 | It is based on Qt5 library, so it can be launched on any supported operating |
| 6 | system, including Windows, OSX and Linux. |
| 7 | |
| 8 | ## Binary packages |
| 9 | |
| 10 | Latest binary packages are available at http://qnapi.github.io/#download |
| 11 | |
| 12 | ## Building from source |
| 13 | |
| 14 | #### Prerequisites |
| 15 | |
| 16 | * C++ compiler with c++11 support installed (`clang++`, `g++` or *MinGW* for Windows), present in `PATH` |
| 17 | * Qt 5.2+ (most recent 5.x recommended) installed with `qmake` present in `PATH` (you can find one at http://www.qt.io/download-open-source/) |
| 18 | |
| 19 | #### Binary prerequisites |
| 20 | |
| 21 | QNapi requires these binary dependencies: |
| 22 | |
| 23 | * p7zip (7z, 7za) - to unpack subtitles, which are commonly compressed with 7zip |
| 24 | * libmediainfo - to retrieve movie info such as dimensions, duration and frame rate |
| 25 | |
| 26 | Linux/UNIX users can find these dependencies in separate packages. |
| 27 | |
| 28 | Statically compiled **p7zip** binaries are provided in this repository for Windows/OSX |
| 29 | users at `win32/content/7za.exe` and `macx/content/7za`, respectively. Similarly, |
| 30 | compiled **libmediainfo** libraries are provided for Windows/OSX in |
| 31 | `deps/libmediainfo/`. |
| 32 | |
| 33 | > **WARNING!** Precompiled binaries are stripped from the source archive! |
| 34 | |
| 35 | #### Cloning the source code |
| 36 | |
| 37 | First, you have to clone project source code using git client: |
| 38 | |
| 39 | `$ git clone --recursive https://github.com/QNapi/qnapi.git` |
| 40 | |
| 41 | #### Compiling |
| 42 | |
| 43 | To compile the application, you have to execute two following commands in `qnapi` root directory: |
| 44 | |
| 45 | `$ qmake` |
| 46 | |
| 47 | This will produce `Makefile`. |
| 48 | |
| 49 | `$ make` (or `mingw32-make` on Windows) |
| 50 | |
| 51 | This will compile the sources and build executable binary (or app bundle on OSX). |
| 52 | |
| 53 | > **Important!** Windows users have to execute one more command: |
| 54 | > |
| 55 | > `$ make install` (or `mingw32-make install`) |
| 56 | > |
| 57 | > This one will copy all binaries, libraries and other dependencies to `win32/out` directory. |
| 58 | |
| 59 | #### Running |
| 60 | |
| 61 | By default, output binaries are placed by `make` in different locations, depending on your operating system: |
| 62 | |
| 63 | * Linux - `qnapi` in root project directory |
| 64 | * OSX - `macx/QNapi.app` bundle |
| 65 | * Windows - `win32/out/qnapi.exe` executable |
| 66 | |
| 67 | After you locate your binaries, you can run the application. |
| 68 | |
| 69 | > ##### 7zip note ##### |
| 70 | > For proper subtitle extraction after download, *7zip* executable is required to be passed in application's settings. |
| 71 | > Linux users have to install 7zip binary package from distribution repositories or compile on its own. |
| 72 | > For Windows and OSX there are pre-built binaries included in this repository, in `win32` and `macx` directories appropriately and should be automatically detected by the application. |
| 73 | |
| 74 | ## Making redistributable package |
| 75 | |
| 76 | ### OSX |
| 77 | |
| 78 | #### Prerequisites |
| 79 | |
| 80 | You need `appdmg` script installed. You can found it at https://github.com/LinusU/node-appdmg |
| 81 | |
| 82 | #### Building .dmg image |
| 83 | |
| 84 | To build .dmg image for OSX with nice, drag&drop installer, you have to execute: |
| 85 | |
| 86 | `$ make appdmg` |
| 87 | |
| 88 | `QNapi-x.y.z.dmg` will appear in `macx` directory when command is completed. |
| 89 | |
| 90 | ### Windows |
| 91 | |
| 92 | #### Prerequisites |
| 93 | |
| 94 | You need to have **NSIS** 2.x installed. You can found it at http://nsis.sourceforge.net |
| 95 | |
| 96 | Also, you will need to manually install NSIS plugin **nsProcess**. It can be found at |
| 97 | http://nsis.sourceforge.net/NsProcess_plugin |
| 98 | |
| 99 | #### Building Windows installer |
| 100 | |
| 101 | Installer script is placed at `win32/QNapi-setup.nsi`. You can build binary exe package using NSIS user interface (by `right mouse button -> compile NSIS script`) or from command line: |
| 102 | |
| 103 | `$ C:\Path\To\makensis.exe QNapi-setup.nsi` |
| 104 | |
| 105 | After a while, `QNapi-x.y.z-setup.exe` file will appear in `win32` directory. |