Open abel-brightman opened 3 years ago
The function runs the script located at data/scripts/com.github.babluboy.bookworm.dictionary.sh
.
Try to run it manually.
data/scripts/com.github.babluboy.bookworm.dictionary.sh
I'm experiencing the same problem on Archlinux on version 1.1.2
Here is the logs:
[INFO 04:30:45.457967] bookinfo.vala:198: [START] [FUNCTION:populateDictionaryResults]
[INFO 04:30:45.458519] bookworm.vala:596: [START] [FUNCTION:toggleUIState] bookworm current state:CONTENT_MODE
[INFO 04:30:45.458944] bookworm.vala:679: [END] [FUNCTION:toggleUIState] bookworm current state:CONTENT_MODE
(com.github.babluboy.bookworm:39340): dconf-DEBUG: 04:30:45.459: change_fast
(com.github.babluboy.bookworm:39340): dconf-DEBUG: 04:30:45.459: change_notify: /com/github/babluboy/bookworm/current-info-tab
[DEBUG 04:30:45.459556] utils.vala:99: Starting to execute sync command [/usr/share/com.github.babluboy.bookworm/scripts/tasks/com.github.babluboy.bookworm.dictionary.sh misogynist]...
[DEBUG 04:30:46.598522] utils.vala:113: Completed execution of sync command [/usr/share/com.github.babluboy.bookworm/scripts/tasks/com.github.babluboy.bookworm.dictionary.sh misogynist] with output:
[DEBUG 04:30:46.598546] bookinfo.vala:227: Dictionary Search Results:
[INFO 04:30:46.598576] bookinfo.vala:231: [END] [FUNCTION:populateDictionaryResults]
and here is the result of running shell script directly:
▶ /usr/share/com.github.babluboy.bookworm/scripts/tasks/com.github.babluboy.bookworm.dictionary.sh misogynist
usage: html2text [-h] [--default-image-alt DEFAULT_IMAGE_ALT] [--pad-tables]
[--no-wrap-links] [--wrap-list-items] [--ignore-emphasis]
[--reference-links] [--ignore-links] [--protect-links]
[--ignore-images] [--images-as-html] [--images-to-alt]
[--images-with-size] [-g] [-d] [-e] [-b BODY_WIDTH]
[-i LIST_INDENT] [-s] [--escape-all] [--bypass-tables]
[--ignore-tables] [--single-line-break] [--unicode-snob]
[--no-automatic-links] [--no-skip-internal-links]
[--links-after-para] [--mark-code]
[--decode-errors DECODE_ERRORS] [--open-quote OPEN_QUOTE]
[--close-quote CLOSE_QUOTE] [--version]
[filename] [encoding]
html2text: error: unrecognized arguments: -o
csplit: cannot open '/tmp/bookworm_word_search.txt' for reading: No such file or directory
cat: /tmp/search_result_01: No such file or directory
data/scripts/com.github.babluboy.bookworm.dictionary.sh
I'm experiencing the same problem on Archlinux on version 1.1.2
Here is the logs:
[INFO 04:30:45.457967] bookinfo.vala:198: [START] [FUNCTION:populateDictionaryResults] [INFO 04:30:45.458519] bookworm.vala:596: [START] [FUNCTION:toggleUIState] bookworm current state:CONTENT_MODE [INFO 04:30:45.458944] bookworm.vala:679: [END] [FUNCTION:toggleUIState] bookworm current state:CONTENT_MODE (com.github.babluboy.bookworm:39340): dconf-DEBUG: 04:30:45.459: change_fast (com.github.babluboy.bookworm:39340): dconf-DEBUG: 04:30:45.459: change_notify: /com/github/babluboy/bookworm/current-info-tab [DEBUG 04:30:45.459556] utils.vala:99: Starting to execute sync command [/usr/share/com.github.babluboy.bookworm/scripts/tasks/com.github.babluboy.bookworm.dictionary.sh misogynist]... [DEBUG 04:30:46.598522] utils.vala:113: Completed execution of sync command [/usr/share/com.github.babluboy.bookworm/scripts/tasks/com.github.babluboy.bookworm.dictionary.sh misogynist] with output: [DEBUG 04:30:46.598546] bookinfo.vala:227: Dictionary Search Results: [INFO 04:30:46.598576] bookinfo.vala:231: [END] [FUNCTION:populateDictionaryResults]
and here is the result of running shell script directly:
▶ /usr/share/com.github.babluboy.bookworm/scripts/tasks/com.github.babluboy.bookworm.dictionary.sh misogynist usage: html2text [-h] [--default-image-alt DEFAULT_IMAGE_ALT] [--pad-tables] [--no-wrap-links] [--wrap-list-items] [--ignore-emphasis] [--reference-links] [--ignore-links] [--protect-links] [--ignore-images] [--images-as-html] [--images-to-alt] [--images-with-size] [-g] [-d] [-e] [-b BODY_WIDTH] [-i LIST_INDENT] [-s] [--escape-all] [--bypass-tables] [--ignore-tables] [--single-line-break] [--unicode-snob] [--no-automatic-links] [--no-skip-internal-links] [--links-after-para] [--mark-code] [--decode-errors DECODE_ERRORS] [--open-quote OPEN_QUOTE] [--close-quote CLOSE_QUOTE] [--version] [filename] [encoding] html2text: error: unrecognized arguments: -o csplit: cannot open '/tmp/bookworm_word_search.txt' for reading: No such file or directory cat: /tmp/search_result_01: No such file or directory
I was able to patch the problem temporarily for now
This is my current com.github.babluboy.bookworm.dictionary.sh
:
search_word=$1
#check if the input still has spaces i.e. multiple words
case "$search_word" in
*\ * )
#space found in input - send output warning and quit
echo "Multiple words are not supported, please search for a single word"
exit
;;
*)
#do nothing - the input has no spaces
;;
esac
#
#
#The section below is for online dictionary. For offline dictionary, comment this section and uncomment the section below
curl -s http://wordnetweb.princeton.edu/perl/webwn?s="$search_word" --ignore-links > /tmp/bookworm_word_search_raw.txt
html2text /tmp/bookworm_word_search_raw.txt > /tmp/bookworm_word_search.txt
#split the output to remove unwanted header information i.e anything before **** Noun ****
csplit -s -f /tmp/search_result_ /tmp/bookworm_word_search.txt /"[****]*[****]"/ > /dev/null
cat /tmp/search_result_01
#remove the files created by this script
rm -f /tmp/search_result_00 /tmp/search_result_01 /tmp/bookworm_word_search.txt
#
#
#The section below is for offline dictionary.Ensure dictionary is installed by running the following command:
#sudo apt-get install dictd dict dict-gcide
#Run offline dictionary by enabling the line below:
#dict $search_word
I am unable to get the dictionary to function at all. Any help or suggestions would be greatly appreciated.