http://rg3.github.io/youtube-dl/download.html
and
Quote:
youtube-player
Opens YouTube videos with MPlayer (uses mplayer and youtube-dl).
Code:
//~/.config/dwb/userscripts/youtube-mplayer.js
//!javascript
// opens YouTube videos with mplayer.
var regex = new RegExp("http(.*)://www.youtube.com/watch\\?(.*&)*v=.*");
Signal.connect("navigation", function (wv, frame, request) {
if (wv.mainFrame == frame && regex.test(request.uri))
system.spawn("sh -c 'mplayer \"$(youtube-dl -g " + request.uri + ")\"'");
return false;
});
|
in dwb
https://wiki.archlinux.org/index.php/Dwb
dwb runs nicely with:
Code:
#!/bin/sh
###########################################################################
#
# Twobob redefined starter for a kindle touch application.
#
###########################################################################
#setup helpful variables...
APP=dwb
EXTENSION=/mnt/us/extensions
export LD_LIBRARY_PATH=${EXTENSION}/dwb/lib:/usr/lib:/lib
#( same command for PW + Touch so ditch the detection )
# PLATFORM="$(cat /sys/devices/platform/mxc_epdc_fb/graphics/fb0/modes)"
SSSTATE=`lipc-get-prop com.lab126.powerd preventScreenSaver`
cd /mnt/us/extensions/$APP
# be certin we only have one instance
killall -9 $APP &> /dev/null
usleep 500
# prevent SS from bothering us mid app.
lipc-set-prop com.lab126.powerd preventScreenSaver 1
# Run it ( same command for PW + Touch so ditch the detection )
GTK_IM_MODULE=kindle \
GDK_PIXBUF_MODULE_FILE=/mnt/us/extensions/$APP/bin/pixbuf/gdk-pixbuf.loaders \
${EXTENSION}/$APP/bin/$APP -e 0 http://google.com
lipc-set-prop com.lab126.powerd preventScreenSaver "$SSSTATE"
and in sftp://root@192.168.1.<kindleIP>/var/tmp/root/.config/awesome
I have
lab126LayerLogic.lua
and I replaced the code in it like:
Code:
function parseWindowName(str)
local str = str
local charSeparator = '_'
-- validate
--if str == nil or not stringStartsWith(str, "L:") then
-- return nil
--end
Code:
if str == nil then
return nil
end
if not stringStartsWith(str, "L:") then
-- Debug llog.info("WindowManager", "bad-client-name", "winName=" .. tostring(str), "report-untidy")
-- exact matches only, Ditch the system stuff, this prevents thing like "Gtkboard" matching "kb"
-- I think replacing this with some \bword\b boundary matching might work better
if (str == "kb") or (str == "webreader") or (str == "pillowd") then
return nil
else
-- we made it this far - let tidy up likely corner cases
-- tidy up spaces and other potentially magic characters
str = string.gsub(str, "%s+", "-")
str = string.gsub(str, "%%+", "-")
str = string.gsub(str, "%^+", "-")
str = string.gsub(str, "%$+", "-")
str = string.gsub(str, "%(+", "-")
str = string.gsub(str, "%)+", "-")
str = string.gsub(str, "%[+", "-")
str = string.gsub(str, "%]+", "-")
str = string.gsub(str, "%*+", "-")
str = string.gsub(str, "%?+", "-")
str = string.gsub(str, "%++", "-")
str = string.gsub(str, "%_+", "-")
str = string.gsub(str, "%/+", "-")
str = string.gsub(str, "%:+", "-")
-- Debug llog.info("WindowManager", "good-client-name", "winName=" .. tostring(str), "post-tidy")
str = "L:A_N:application_ID:" .. tostring(str) .. "_O:R_PC:N"
-- Debug llog.info("WindowManager", "title", tostring(str) , " ✔")
end
end
Code:
local entries = {}
for splitStr in stringSplit(str, '_') do
log("splitStr is " .. splitStr)
The greyed bits show where I edited from and to.
and rc.lua is:
Code:
package.path = "/var/tmp/root/.config/awesome/?.lua;" .. package.path
dofile("/etc/xdg/awesome/rc.lua")
local lipcH, errNum, errMsg = lipc.init("com.lab126.winmgr.extra")
if not lipcH then
log ("!!!!!!!!!!!failed to init lipc " .. tostring(errNum) .. ", " .. errMsg)
else
lipcH:register_string_property("restart", "w").listener = awesome.restart
awesome.add_signal("exit", lipcH:close)
end
but the lipc restart command
Quote:
lipc-set-prop com.lab126.winmgr.extra restart now
|
isnt working for me. could just be my kindle.
however
killall awesome works fine.
after that starting the ./dwb.sh seems to work with no error or titling fuss.
not sure how to get this working really with the keyboards as it is very keyboard heavy. happy to leave that to someone else.
I trimmed about 8mb of system included libs...
but its a vaguely interesting idea I thought and was easy to build for the touch. and PW too therefore.
but as I said "keyboard heavy interfaces" not great,
however the mplayer youtube hookup being extracted out into say a wget and an ncurses interface ditching dwb could be workable,
would be intersting to see mplayer handle that. it did elegantly handle dithering one time before albeit not perfectly reliable. worth a pop.
sticking point in python but i believe we have that. Anyone think this is not insane?
dunnno. might be cool. various aspects of it might be.
some not so much.
still needs 58mb! of supporting libs built like this... not ideal.
And The keyboard would need a double finger popup-popdown code wrapper or something I suppose.
I didnt bother wrapping it as an extension as its not finished. and its too big to run easily. or repack on here.
however those libs included once to justify a few builds might be worth it. dunno.
could probably be built smarter.
all that said; the general "Application Fronting" principle seems to work nicely now I revisit it. which is worth noting.
Im sure baf posting a much simpler LUA solution but I couldnt find it yet.