dwb: using contenthandler+transmission for magnet links
parent
474b5afe18
commit
b28bab8a4a
|
@ -80,3 +80,58 @@ extensions.load("autoquvi", {
|
||||||
});
|
});
|
||||||
autoquvi___DISABLED>*/
|
autoquvi___DISABLED>*/
|
||||||
//>autoquvi___SCRIPT
|
//>autoquvi___SCRIPT
|
||||||
|
//<downloadhandler___SCRIPT
|
||||||
|
extensions.load("downloadhandler", {
|
||||||
|
//<downloadhandler___CONFIG
|
||||||
|
handler : [
|
||||||
|
// Each handler must have 2 or 3 properties:
|
||||||
|
//
|
||||||
|
// command : command to execute, must contain %f which will be replaced with
|
||||||
|
// the filepath, this property is mandatory
|
||||||
|
//
|
||||||
|
// extension : a filename extension, optional
|
||||||
|
//
|
||||||
|
// mimeType : a mimetype, optional
|
||||||
|
//
|
||||||
|
|
||||||
|
// { command : "xpdf %f", mimeType : "application/pdf" }
|
||||||
|
// { command : "xdvi %f", extension : "dvi" }
|
||||||
|
|
||||||
|
]
|
||||||
|
//>downloadhandler___CONFIG
|
||||||
|
});
|
||||||
|
//>downloadhandler___SCRIPT
|
||||||
|
//<contenthandler___SCRIPT
|
||||||
|
extensions.load("contenthandler", {
|
||||||
|
//<contenthandler___CONFIG
|
||||||
|
// The handler can either be a string or a function, if it is a string
|
||||||
|
// %u will be replaced with the uri of the request, if the handler is a
|
||||||
|
// function the first parameter of the function will be the uri and the
|
||||||
|
// function must return the command to execute.
|
||||||
|
|
||||||
|
// Handle requests based on filename extension
|
||||||
|
extension : {
|
||||||
|
// "torrent" : "xterm -e 'aria2 %u'",
|
||||||
|
// "pdf" : "xterm -e 'wget %u --directory-prefix=~/mypdfs'"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Handle requests based on URI scheme
|
||||||
|
uriScheme : {
|
||||||
|
//ftp : function(uri) {
|
||||||
|
// if (uri[uri.length-1] == "/")
|
||||||
|
// return "xterm -e 'ncftp " + uri + "'";
|
||||||
|
// else
|
||||||
|
// return "xterm -e 'ncftpget " + uri + "'";
|
||||||
|
//}
|
||||||
|
|
||||||
|
magnet: "transmission-remote -a '%u'"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Handle requests based on MIME type
|
||||||
|
mimeType : {
|
||||||
|
// "application/pdf" : "xterm -e 'wget %u --directory-prefix=~/mypdfs'"
|
||||||
|
}
|
||||||
|
//>contenthandler___CONFIG
|
||||||
|
|
||||||
|
});
|
||||||
|
//>contenthandler___SCRIPT
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
## TODO: 'urxvt -e' does not seem to work with ftp clients.
|
|
||||||
TERMCMD=xterm
|
|
||||||
|
|
||||||
case ${DWB_SCHEME} in
|
|
||||||
mailto)
|
|
||||||
! command -v xclip >/dev/null 2>&1 && exit
|
|
||||||
echo "${DWB_URI}" | sed -e 's/mailto://' -e 's/?/ /' | xclip -i ;;
|
|
||||||
ftp)
|
|
||||||
! command -v $TERMCMD >/dev/null 2>&1 && exit
|
|
||||||
! command -v lftp >/dev/null 2>&1 && exit
|
|
||||||
$TERMCMD -e "lftp ${DWB_URI}";;
|
|
||||||
*)
|
|
||||||
! command -v xdg-open >/dev/null 2>&1 && exit
|
|
||||||
xdg-open "${DWB_URI}";;
|
|
||||||
esac
|
|
|
@ -76,6 +76,7 @@ if command -v dwb >/dev/null 2>&1 && [ ! -f "$XDG_DATA_HOME/dwb/extensions/adblo
|
||||||
echo "==> dwb"
|
echo "==> dwb"
|
||||||
dwbem -Ni adblock_subscriptions
|
dwbem -Ni adblock_subscriptions
|
||||||
dwbem -Ni navtools
|
dwbem -Ni navtools
|
||||||
|
dwbem -Ni contenthandler
|
||||||
# dwbem -Ni youtube_html5
|
# dwbem -Ni youtube_html5
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue