Skip to content

Commit 962ef92

Browse files
committed
Merge pull request #1 from pellcorp/linux-no-chrome-launcher
added linux support including lirc and remove need for chrome launcher
2 parents 0122714 + 08c6b45 commit 962ef92

File tree

4 files changed

+122
-11
lines changed

4 files changed

+122
-11
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.project
2+
.pydevproject
3+
.settings
4+

browser.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Managed to resolve the issues with, but will leave this here anyway, as its a good fallback
4+
CHROME_STARTED=`ps -ef | grep google-chrome | grep -v "grep" | wc -l`
5+
if [ $CHROME_STARTED -gt 0 ]; then
6+
exit 1;
7+
fi
8+
9+
# lets find out if irxevent and xdotool actually exist before we try to call them.
10+
command -v irxevent >/dev/null 2>&1
11+
IRXEVENT=$?
12+
command -v xdotool >/dev/null 2>&1
13+
XDOTOOL=$?
14+
15+
if [ $IRXEVENT -eq 0 ]; then
16+
killall irxevent >/dev/null 2>&1
17+
fi
18+
19+
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
20+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
21+
22+
if [ $# -eq 2 ]; then
23+
url="https://www.netflix.com/SwitchProfile?tkn=$2&nextpage=https%3A%2F%2Fwww.netflix.com%2FWiPlayer%3Fmovieid%3D$1"
24+
else
25+
url="http://www.netflix.com/WiPlayer?movieid=$1"
26+
fi
27+
28+
# notice the ampersand to send google chrome into back ground so that the script continues and we execute the xdotool below
29+
/usr/bin/google-chrome --start-maximized --disable-translate --disable-new-tab-first-run --no-default-browser-check --no-first-run --kiosk "$url" &
30+
CHROME_PID=$!
31+
32+
if [ $IRXEVENT -eq 0 ]; then
33+
# run irxevent as a daemon so that we can call xdotool
34+
irxevent -d $DIR/netflix.lirc &
35+
else
36+
echo "irxevent is not installed, can't do remote control"
37+
fi
38+
39+
if [ $XDOTOOL -eq 0 ]; then
40+
# no point sleeping if xdotool is not installed.
41+
sleep 5
42+
xdotool mousemove 9999 9999 click 1
43+
else
44+
echo "xdotool is not installed, can't remove cursor"
45+
fi
46+
47+
# wait for google-chrome to be killed before killing irxevent below. This only works if we execute irxevent as a daemon, otherwise
48+
# the script would never finish.
49+
wait $CHROME_PID
50+
51+
if [ $IRXEVENT -eq 0 ]; then
52+
killall irxevent >/dev/null 2>&1
53+
fi

default.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
sendKeysPath = xbmc.translatePath('special://home/addons/'+addonID+'/resources/NetfliXBMC_SendKeys.exe')
3939
fakeVidPath = xbmc.translatePath('special://home/addons/'+addonID+'/resources/fakeVid.mp4')
4040
downloadScript = xbmc.translatePath('special://home/addons/'+addonID+'/download.py')
41+
browserScript = xbmc.translatePath('special://home/addons/'+addonID+'/browser.sh')
4142
searchHistoryFolder = os.path.join(addonUserDataFolder, "history")
4243
cacheFolder = os.path.join(addonUserDataFolder, "cache")
4344
cacheFolderCoversTMDB = os.path.join(cacheFolder, "covers")
@@ -564,10 +565,10 @@ def playVideo(id):
564565

565566
def playVideoMain(id):
566567
xbmc.Player().stop()
568+
token = ""
567569
if singleProfile:
568570
url = urlMain+"/WiPlayer?movieid="+id
569571
else:
570-
token = ""
571572
if addon.getSetting("profile"):
572573
token = addon.getSetting("profile")
573574
url = "https://www.netflix.com/SwitchProfile?tkn="+token+"&nextpage="+urllib.quote_plus(urlMain+"/WiPlayer?movieid="+id)
@@ -589,16 +590,16 @@ def playVideoMain(id):
589590
except:
590591
pass
591592
elif osLinux:
592-
xbmc.executebuiltin("RunPlugin(plugin://plugin.program.chrome.launcher/?url="+urllib.quote_plus(url)+"&mode=showSite&kiosk="+kiosk+")")
593-
try:
594-
xbmc.sleep(5000)
595-
subprocess.Popen('xdotool mousemove 9999 9999', shell=True)
596-
xbmc.sleep(5000)
597-
subprocess.Popen('xdotool mousemove 9999 9999', shell=True)
598-
xbmc.sleep(5000)
599-
subprocess.Popen('xdotool mousemove 9999 9999', shell=True)
600-
except:
601-
pass
593+
xbmc.executebuiltin('LIRC.Stop')
594+
595+
if token != "":
596+
call = '"'+browserScript+'" "'+id+'" "'+token+'"';
597+
else:
598+
call = '"'+browserScript+'" "'+id+'"';
599+
600+
subprocess.call(call, shell=True)
601+
602+
xbmc.executebuiltin('LIRC.Start')
602603
elif osWin:
603604
if winBrowser == 1:
604605
path = 'C:\\Program Files\\Internet Explorer\\iexplore.exe'

netflix.lirc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#### BEGIN CurrentWindow - NETFLIX CONTROLS
2+
begin
3+
prog = irxevent
4+
button = KEY_PAUSE
5+
repeat = 0
6+
config = Key space Focus CurrentWindow
7+
end
8+
begin
9+
prog = irxevent
10+
button = KEY_PLAY
11+
repeat = 0
12+
config = Key space Focus CurrentWindow
13+
end
14+
begin
15+
prog = irxevent
16+
button = KEY_UP
17+
config = Key Up Focus CurrentWindow
18+
end
19+
begin
20+
prog = irxevent
21+
button = KEY_DOWN
22+
config = Key Down Focus CurrentWindow
23+
end
24+
begin
25+
prog = irxevent
26+
button = KEY_LEFT
27+
config = Key Left Focus CurrentWindow
28+
end
29+
begin
30+
prog = irxevent
31+
button = KEY_RIGHT
32+
config = Key Right Focus CurrentWindow
33+
end
34+
begin
35+
prog = irxevent
36+
button = KEY_STOP
37+
repeat = 0
38+
config = Key ctrl-w Focus CurrentWindow
39+
end
40+
begin
41+
prog = irxevent
42+
button = KEY_REWIND
43+
repeat = 0
44+
config = Key shift-left Focus CurrentWindow
45+
end
46+
begin
47+
prog = irxevent
48+
button = KEY_FORWARD
49+
repeat = 0
50+
config = Key shift-right Focus CurrentWindow
51+
end
52+
53+
#### END CurrentWindow - NETFLIX CONTROLS

0 commit comments

Comments
 (0)