Skip to content

o28o/dg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8,545 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dhamma.Gift - Liberation Search Engine

Dhamma.Gift is available as:

online version

Grep-based search in all Texts of Pali Suttanta and Vinaya in 4 languages: Pali, English, Russian, Thai and Sinhala. Little script that will or at least might change Buddhism to better. Search all matches for the word in Suttas and Vinaya. Web implementation of bash script that generates comfortables datatables.

https://dhamma.gift/

Perfect for those who are looking for Awakening and study Pali. You can get all occurrences of the definition, metaphor, practice etc. By default search is made in DN, MN, SN, AN. But user has option to add other books of KN.

dg.offline

Offline version of dg

This instruction is only for Android devices. Check possible options for IOS in the end of this instruction. if you'll find out how to run it on IOS please let me know.

Option #1 - installation with script

For Linux with apt

Copy+paste into terminal the contents of scripts/install-linux.sh (requires root)

For Windows 10+ (WSL)

  1. Activate Windows Subsystem for Linux
  2. Install Ubuntu of your choice from Windows store
  3. Finalize the setup: set username and password
  4. Copy+paste into terminal the contents of scripts/install-linux.sh (requires root)

For Android

  1. Install Termux from F-Droid or GitHub

  2. Run Termux

  3. Copy-paste following commands:

    pkg update
    pkg upgrade
    pkg install -y git
    mkdir -p $PREFIX/share/apache2/default-site/htdocs
    cd $PREFIX/share/apache2/default-site/htdocs
    git clone https://github.com/o28o/dg.git ./
    bash ./scripts/install-android.sh
  4. If you want to add offline audio files, clone this repo to ./assets/audio:

    mkdir -p $PREFIX/share/apache2/default-site/htdocs/assets/audio
    cd $PREFIX/share/apache2/default-site/htdocs/assets/audio
    git clone https://github.com/o28o/dg.audio ./

Option #2 - manual installation

For Android

  1. Install Termux from F-Droid or GitHub

  2. Open Termux and run:

    pkg install -y php-apache apache2 pv wget git iconv python w3m
  3. Fix PHP configuration based on this article

    nano /data/data/com.termux/files/usr/etc/apache2/httpd.conf

    Comment out and add the following lines:

    #LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so
    LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so
    
    LoadModule php_module /data/data/com.termux/files/usr/libexec/apache2/libphp.so
      <FilesMatch \.php$>
        SetHandler application/x-httpd-php
      </FilesMatch>
    
      <IfModule dir_module>
          DirectoryIndex index.php index.html index.htm
      </IfModule>
    
      LoadModule rewrite_module libexec/apache2/mod_rewrite.so
      ServerName localhost:8080
      ServerName 127.0.0.1:8080

    and, if needed:

    ServerName #yourip:8080

Now, download offline resources:

  1. Go to the Apache directory:

    cd /data/data/com.termux/files/usr/share/apache2/default-site/htdocs
  2. Clone this repo:

    git clone https://github.com/o28o/dg.git ./
  3. Clone the current https://suttacentral.net data:

    git clone https://github.com/suttacentral/sc-data.git ./suttacentral.net
  4. Download the https://accesstoinsight.org data:

    wget http://accesstoinsight.org/tech/download/ati.zip
    unzip ati.zip ./accesstoinsight.org
  5. Download legacy https://suttacentral.net data:
    (note: you dont need it if the https://suttacentral.net offline PWA is working fine on your phone)

    wget https://legacy.suttacentral.net/exports/sc-offline-2016-11-30_16:03:42.zip
    unzip sc-offline-2016-11-30_16:03:42.zip ./legacy.suttacentral.net

    or:

    wget https://legacy.suttacentral.net/exports/sc-offline-2016-11-30_16:03:42.7z
  6. Download https://theravada.ru:

    mkdir theravada.ru && cd theravada.ru
    wget -r --no-check-certificate  --no-parent -P ./ https://theravada.ru/Teaching/canon.htm

    Fix possible double dir... check later

    cd theravada.ru/Teaching/Canon/Suttanta
    for i in `find . -name  "*" -type f`; do
    echo $i;
    iconv -f windows-1251 $i > ../tmp
    mv ../tmp $i
    sed -i 's@windows-1251@utf-8@g' $i
    done
  7. Check and fix links if needed:

    cd /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/ru
    
    ln -s ../assets ./assets
    ln -s ../sc ./sc
    ln -s ../scripts ./scripts
    ln -s ../result ./result
  8. (Optional) - if you downloaded https://suttacentral.net data somewhere else, not in the Apache default directory:

    cd /data/data/com.termux/files/usr/share/apache2/default-site/htdocs/
    rm suttacentral suttacentral.net
    ln -s ../yourpath ./suttacentral.net
    ln -s ../yourpath ./theravada.ru
    ln -s ../yourpath ./legacy.suttacentral.net

    Or, if you want to keep offline resources in other places without symlinks, edit paths in ./config/script_config.sh and ./config/config.php

For testing your queries via the CLI, you may run:

bash ./scripts/finddhamma.sh yourqueryInPali
bash ./scripts/finddhamma.sh -ru yourqueryInRussian
bash ./scripts/finddhamma.sh -en yourqueryInEnglish
bash ./scripts/finddhamma.sh -th yourqueryInThai

Before using dg offline, don't forget to run:

apachctl start
termux-open-url http://localhost:8080/

This should open http://localhost:8080 in your web browser.

For Windows?

Not yet available

For iOS?

Might be possible to run on IOS devices with phpwin or similar and some terminal emulator e.g. from this article

never tried. please let me know if there is a way.

About

Find.dhamma.gift online & offline version

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors