freddyncalm

Buscadores japonés

Feb 7th, 2021 (edited)
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # navegador="opera"
  4. # navegador="firefox-trunk --new-tab"
  5. navegador="/usr/local/firefox/firefox --new-tab"
  6. # navegador="google-chrome"
  7. #navegador="google-chrome-beta"
  8. csearch=""
  9. fhist="$HOME/.jishosearch.txt"
  10. scriptcd="$HOME/scripts/"
  11. if [ -f $fhist ]; then
  12. csearch=$(cat $fhist)
  13. fi
  14.  
  15. export DISPLAY=:0
  16.  
  17. action=$(yad --title="Buscapalabras Web" --center --form --button=TagainiJisho:0 --button=Forvo:2 --button=Goo:4 --button=Jisho:8 --button=Twitter:6 --button=Cancelar:1--item-separator=, --separator="" --entry --text="Busqueda en jisho.org, goo.ne.jp, Tagaini Jisho o Twitter:" --entry-text "$csearch");
  18. ret=$?
  19.  
  20. if [[ $ret -eq 1 ]]; then
  21. echo "Acción cancelada!!"
  22. exit 0
  23. fi
  24.  
  25. # Para usar Google Chrome en lugar de Firefox:
  26. # algo=$(google-chrome "http://jisho.org/words/?dict=edict&jap=$action");
  27.  
  28. # Para buscar en el diccionario completo de Goo:
  29. # algo=$(firefox "http://dictionary.goo.ne.jp/freewordsearcher.html?mode=0&x=0&y=0&kind=all&MT=$action");
  30.  
  31. if [[ $ret -eq 0 ]]; then
  32. echo "$action" > "$fhist"
  33. cd "$scriptcd"
  34.  
  35. # El script de abajo carga el programa; y usa wmctrl y xdotool para detectar la ventana de la aplicación
  36. # e introducir el texto de búsqueda -tweet o DM a @freddyncalm para pedirlo.
  37. ~/scripts/tagainijisho.sh "$action"
  38. fi
  39.  
  40. if [[ $ret -eq 2 ]]; then
  41. echo "$action" > "$fhist"
  42. algo=$($navegador "https://es.forvo.com/word/$action");
  43. fi
  44.  
  45.  
  46. if [[ $ret -eq 4 ]]; then
  47. echo "$action" > "$fhist"
  48. algo=$($navegador "https://dictionary.goo.ne.jp/srch/thsrs/${action//+/ }/m0u/");
  49. fi
  50.  
  51. if [[ $ret -eq 8 ]]; then
  52. echo "$action" > "$fhist"
  53. algo=$($navegador "https://jisho.org/words/?dict=edict&jap=${action//+/ }");
  54. fi
  55.  
  56. if [[ $ret -eq 6 ]]; then
  57. echo "$action" > "$fhist"
  58. busco=${action//+/ }
  59. algo=$($navegador "https://twitter.com/search/?f=tweets&vertical=default&q=$busco");
  60. fi
  61.  
Add Comment
Please, Sign In to add comment