• 1
  • 14
  • 15
  • 16(current)
  • 17
  • 18
  • 47
[RELEASE] Chrome Launcher
Hi,
My Xbmc won't find my display..
If I run chromium from /usr/bin/chromium it has this error :
Code:
(chromium:4760): Gtk-WARNING **: cannot open display:
And if i use this script:
Code:
openbox &
chromium "$@" &
wait %2
kill %1
The error is:
Code:
Openbox-Message: Can't open screen in environmentvariable DISPLAY

Anyone here who can help me ?
Reply
What is DISPLAY set to. It should be set to the current X screen like :0

change the chromium line to

DISPLAY=:0 chromium "$@" &
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
Thanks for the quick reply !
But now I get the error Gtk-WARNING **: cannot open display:0 ..
How do I know on wich display xbmc runs on ?
Reply
What OS are you using? Maybe openbox needs to know the DISPLAY too?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
Yes, same for Openbox.
I use raspbmc. Xorg and Openbox are installed
Reply
I know next to nothing about raspmc. But does it run X at all?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
First of all I just want to say thanks! I had toyed with this addon a while back but never got it working right. But a recent upgrade and reinstall got it all running!
So heres my question. I use the transparency skin whic as a heavy fanart skin.
I was wondering if there was a way to get a designated fanart image to show in the menu background? I don't know if this would be a skin issue or a addon issue?
Also I was wondering if there was a way to change the key presses needed to exit (ctrl + f4). for example alt+f4 (basically so I can map it to my harmony remote)
Any suggestions would be appreciated.
Cheers
p.s. I will post a similar request in the transparency forum..
Reply
So after some fiddling I think I am on the right path but I am having a few problems with the script launching.
This is my default.py file
Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib
import sys
import re
import os
import subprocess
import xbmcplugin
import xbmcgui
import xbmcaddon


addon = xbmcaddon.Addon()
pluginhandle = int(sys.argv[1])
addonID = addon.getAddonInfo('id')
addonPath = addon.getAddonInfo('path')
translation = addon.getLocalizedString
osWin = xbmc.getCondVisibility('system.platform.windows')
osOsx = xbmc.getCondVisibility('system.platform.osx')
osLinux = xbmc.getCondVisibility('system.platform.linux')
useOwnProfile = addon.getSetting("useOwnProfile") == "true"
useCustomPath = addon.getSetting("useCustomPath") == "true"
customPath = xbmc.translatePath(addon.getSetting("customPath"))

userDataFolder = xbmc.translatePath("special://profile/addon_data/"+addonID)
profileFolder = os.path.join(userDataFolder, 'profile')
siteFolder = os.path.join(userDataFolder, 'sites')

if not os.path.isdir(userDataFolder):
    os.mkdir(userDataFolder)
if not os.path.isdir(profileFolder):
    os.mkdir(profileFolder)
if not os.path.isdir(siteFolder):
    os.mkdir(siteFolder)

#youtubeUrl = "http://www.youtube.com/leanback"
#vimeoUrl = "http://www.vimeo.com/couchmode"


def index():
    files = os.listdir(siteFolder)
    for file in files:
        if file.endswith(".link"):
            fh = open(os.path.join(siteFolder, file), 'r')
            title = ""
            url = ""
            thumb = ""
            fanart = ""
            kiosk = "yes"
            stopPlayback = "no"
            for line in fh.readlines():
                entry = line[:line.find("=")]
                content = line[line.find("=")+1:]
                if entry == "title":
                    title = content.strip()
                elif entry == "url":
                    url = content.strip()
                elif entry == "thumb":
                    thumb = content.strip()
        elif entry == "fanart":
                    fanart = content.strip()
                elif entry == "kiosk":
                    kiosk = content.strip()
                elif entry == "stopPlayback":
                    stopPlayback = content.strip()
            fh.close()
            addSiteDir(title, url, 'showSite', thumb, stopPlayback, kiosk)
#    addDir("[ Vimeo Couchmode ]", vimeoUrl, 'showSite', os.path.join(addonPath, "vimeo.png"), "yes", "yes")
#    addDir("[ Youtube Leanback ]", youtubeUrl, 'showSite', os.path.join(addonPath, "youtube.png"), "yes", "yes")
    addDir("[B]- "+translation(30001)+"[/B]", "", 'addSite', "")
    xbmcplugin.endOfDirectory(pluginhandle)


def addSite(site="", title=""):
    if site:
        filename = getFileName(title)
        content = "title="+title+"\nurl="+site+"\nthumb=DefaultFolder.png\nfanart=DefaultFolder.png\nstopPlayback=no\nkiosk=yes"
        fh = open(os.path.join(siteFolder, filename+".link"), 'w')
        fh.write(content)
        fh.close()
    else:
        keyboard = xbmc.Keyboard('', translation(30003))
        keyboard.doModal()
        if keyboard.isConfirmed() and keyboard.getText():
            title = keyboard.getText()
            keyboard = xbmc.Keyboard('http://', translation(30004))
            keyboard.doModal()
            if keyboard.isConfirmed() and keyboard.getText():
                url = keyboard.getText()
                keyboard = xbmc.Keyboard('no', translation(30009))
                keyboard.doModal()
                if keyboard.isConfirmed() and keyboard.getText():
                    stopPlayback = keyboard.getText()
                    keyboard = xbmc.Keyboard('yes', translation(30016))
                    keyboard.doModal()
                    if keyboard.isConfirmed() and keyboard.getText():
                        kiosk = keyboard.getText()
                        content = "title="+title+"\nurl="+url+"\nthumb=DefaultFolder.png\nfanart=DefaultFolder.png\nstopPlayback="+stopPlayback+"\nkiosk="+kiosk
                        fh = open(os.path.join(siteFolder, getFileName(title)+".link"), 'w')
                        fh.write(content)
                        fh.close()
    xbmc.executebuiltin("Container.Refresh")


def getFileName(title):
    return (''.join(c for c in unicode(title, 'utf-8') if c not in '/\\:?"*|<>')).strip()


def getFullPath(path, url, useKiosk, userAgent):
    profile = ""
    if useOwnProfile:
        profile = '--user-data-dir="'+profileFolder+'" '
    kiosk = ""
    if useKiosk=="yes":
        kiosk = '--kiosk '
    if userAgent:
        userAgent = '--user-agent="'+userAgent+'" '
    return '"'+path+'" '+profile+userAgent+'--start-maximized --disable-translate --disable-new-tab-first-run --no-default-browser-check --no-first-run '+kiosk+'"'+url+'"'


def showSite(url, stopPlayback, kiosk, userAgent):
    if stopPlayback == "yes":
        xbmc.Player().stop()
    if osWin:
        path = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'
        path64 = 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
        if useCustomPath and os.path.exists(customPath):
            fullUrl = getFullPath(customPath, url, kiosk, userAgent)
            subprocess.Popen(fullUrl, shell=False)
        elif os.path.exists(path):
            fullUrl = getFullPath(path, url, kiosk, userAgent)
            subprocess.Popen(fullUrl, shell=False)
        elif os.path.exists(path64):
            fullUrl = getFullPath(path64, url, kiosk, userAgent)
            subprocess.Popen(fullUrl, shell=False)
        else:
            xbmc.executebuiltin('XBMC.Notification(Info:,'+str(translation(30005))+'!,5000)')
            addon.openSettings()
    elif osOsx:
        path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
        if useCustomPath and os.path.exists(customPath):
            fullUrl = getFullPath(customPath, url, kiosk, userAgent)
            subprocess.Popen(fullUrl, shell=True)
        elif os.path.exists(path):
            fullUrl = getFullPath(path, url, kiosk, userAgent)
            subprocess.Popen(fullUrl, shell=True)
        else:
            xbmc.executebuiltin('XBMC.Notification(Info:,'+str(translation(30005))+'!,5000)')
            addon.openSettings()
    elif osLinux:
        path = "/usr/bin/google-chrome"
        if useCustomPath and os.path.exists(customPath):
            fullUrl = getFullPath(customPath, url, kiosk, userAgent)
            subprocess.Popen(fullUrl, shell=True)
        elif os.path.exists(path):
            fullUrl = getFullPath(path, url, kiosk, userAgent)
            subprocess.Popen(fullUrl, shell=True)
        else:
            xbmc.executebuiltin('XBMC.Notification(Info:,'+str(translation(30005))+'!,5000)')
            addon.openSettings()


def removeSite(title):
    os.remove(os.path.join(siteFolder, getFileName(title)+".link"))
    xbmc.executebuiltin("Container.Refresh")


def editSite(title):
    filenameOld = getFileName(title)
    file = os.path.join(siteFolder, filenameOld+".link")
    fh = open(file, 'r')
    title = ""
    url = ""
    kiosk = "yes"
    thumb = "DefaultFolder.png"
    fanart = "DefaultFolder.png"
    stopPlayback = "no"
    for line in fh.readlines():
        entry = line[:line.find("=")]
        content = line[line.find("=")+1:]
        if entry == "title":
            title = content.strip()
        elif entry == "url":
            url = content.strip()
        elif entry == "kiosk":
            kiosk = content.strip()
        elif entry == "thumb":
            thumb = content.strip()
        elif entry == "fanart":
            fanart = content.strip()    
        elif entry == "stopPlayback":
            stopPlayback = content.strip()
    fh.close()

    oldTitle = title
    keyboard = xbmc.Keyboard(title, translation(30003))
    keyboard.doModal()
    if keyboard.isConfirmed() and keyboard.getText():
        title = keyboard.getText()
        keyboard = xbmc.Keyboard(url, translation(30004))
        keyboard.doModal()
        if keyboard.isConfirmed() and keyboard.getText():
            url = keyboard.getText()
            keyboard = xbmc.Keyboard(stopPlayback, translation(30009))
            keyboard.doModal()
            if keyboard.isConfirmed() and keyboard.getText():
                stopPlayback = keyboard.getText()
                keyboard = xbmc.Keyboard(kiosk, translation(30016))
                keyboard.doModal()
                if keyboard.isConfirmed() and keyboard.getText():
                    kiosk = keyboard.getText()
                    content = "title="+title+"\nurl="+url+"\nthumb="+thumb+"\nfanart="+fanart+"\nstopPlayback="+stopPlayback+"\nkiosk="+kiosk
                    fh = open(os.path.join(siteFolder, getFileName(title)+".link"), 'w')
                    fh.write(content)
                    fh.close()
                    if title != oldTitle:
                        os.remove(os.path.join(siteFolder, filenameOld+".link"))
    xbmc.executebuiltin("Container.Refresh")


def parameters_string_to_dict(parameters):
    paramDict = {}
    if parameters:
        paramPairs = parameters[1:].split("&")
        for paramsPair in paramPairs:
            paramSplits = paramsPair.split('=')
            if (len(paramSplits)) == 2:
                paramDict[paramSplits[0]] = paramSplits[1]
    return paramDict


def addDir(name, url, mode, iconimage, stopPlayback="", kiosk=""):
    u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+urllib.quote_plus(mode)+"&stopPlayback="+urllib.quote_plus(stopPlayback)+"&kiosk="+urllib.quote_plus(kiosk)
    ok = True
    liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage, fanart_image=fanart)
    liz.setInfo(type="Video", infoLabels={"Title": name})
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True)
    return ok


def addSiteDir(name, url, mode, iconimage, stopPlayback, kiosk):
    u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+urllib.quote_plus(mode)+"&stopPlayback="+urllib.quote_plus(stopPlayback)+"&kiosk="+urllib.quote_plus(kiosk)
    ok = True
    liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
    liz.setInfo(type="Video", infoLabels={"Title": name})
    liz.addContextMenuItems([(translation(30006), 'RunPlugin(plugin://'+addonID+'/?mode=editSite&url='+urllib.quote_plus(name)+')',), (translation(30002), 'RunPlugin(plugin://'+addonID+'/?mode=removeSite&url='+urllib.quote_plus(name)+')',)])
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=True)
    return ok

params = parameters_string_to_dict(sys.argv[2])
mode = urllib.unquote_plus(params.get('mode', ''))
name = urllib.unquote_plus(params.get('name', ''))
url = urllib.unquote_plus(params.get('url', ''))
stopPlayback = urllib.unquote_plus(params.get('stopPlayback', 'no'))
kiosk = urllib.unquote_plus(params.get('kiosk', 'yes'))
userAgent = urllib.unquote_plus(params.get('userAgent', ''))


if mode == 'addSite':
    addSite()
elif mode == 'showSite':
    showSite(url, stopPlayback, kiosk, userAgent)
elif mode == 'removeSite':
    removeSite(url)
elif mode == 'editSite':
    editSite(url)
else:
    index()
I have added a bunch of references for fanart where I thought necessary, as well as reference in the liz = xbmc.guiList items
But I am having trouble with the AddSiteDir functions
This is the error from the debug
Code:
21:14:24 T:140486782060288   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.NameError'>
                                            Error Contents: global name 'fanart' is not defined
                                            Traceback (most recent call last):
                                              File "/home/xbmc/.xbmc/addons/plugin.program.chrome.launcher/default.py", line 268, in <module>
                                                index()
                                              File "/home/xbmc/.xbmc/addons/plugin.program.chrome.launcher/default.py", line 70, in index
                                                addDir("[B]- "+translation(30001)+"[/B]", "", 'addSite', "")
                                              File "/home/xbmc/.xbmc/addons/plugin.program.chrome.launcher/default.py", line 235, in addDir
                                                liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage, fanart_image=fanart)
                                            NameError: global name 'fanart' is not defined
                                            -->End of Python script error report<--

I am slowly getting closer but I need to define fanart.
I believe I need something along the lines of

item.setProperty('fanart_image',fanart)

but I am at a loss as to where to put it.
I know this has been a long post hopefully someone can help.
Cheers
Justin
p.s will post again in the Transparency forum as well.
Reply
Recently set up XBMCbuntu on an ASRock ION 300ht, and have spent some time getting it to work how I want, and Chrome Launcher is pretty key to that to get things like Netflix and BBC iPlayer working. This forum has been excellent and so thanks to all who have contributed, and of course to the developer.

I couldn’t get window manager scripts to work using a pure XBMC boot set-up, so have ended up booting into Openbox and using an autostart set-up to automatically start XBMC. Takes a little longer to boot, but all the window manager issues go away.

Couldn’t get anywhere with a regular MCE remote cos I couldn’t get the keymapping add-on to load – reports wrong structure for the system. Maybe an ASRock issue, despite reconfiguring LIRC to the Nuvotron settings. However I’ve had great success with an MCE compatible remote made by CiT. This includes a ‘Close’ button which closes the Chrome Kiosk window seamlessly and returns to XBMC. This remote also includes a toggle’able virtual mouse which uses the arrow keys to move the cursor around the screen - works great within the Chrome webpage where the regular arrow keys don’t function, so I’d recommend giving it a go. No re-mapping of keys needed at all. This seemed to be the biggest barrier to getting the system properly functional, for me at least.

I’m still trying to get scripts working to open an Openbox window, but the main barrier seems to be making them executable. When I run:

sudo chmod +x script.sh

it reports that it can’t find script.sh. I’ve tried including the full path but still no good. Any tips?
Reply
(2014-11-03, 14:26)Swell6 Wrote: Recently set up XBMCbuntu on an ASRock ION 300ht, and have spent some time getting it to work how I want, and Chrome Launcher is pretty key to that to get things like Netflix and BBC iPlayer working. This forum has been excellent and so thanks to all who have contributed, and of course to the developer.

I couldn’t get window manager scripts to work using a pure XBMC boot set-up, so have ended up booting into Openbox and using an autostart set-up to automatically start XBMC. Takes a little longer to boot, but all the window manager issues go away.

Couldn’t get anywhere with a regular MCE remote cos I couldn’t get the keymapping add-on to load – reports wrong structure for the system. Maybe an ASRock issue, despite reconfiguring LIRC to the Nuvotron settings. However I’ve had great success with an MCE compatible remote made by CiT. This includes a ‘Close’ button which closes the Chrome Kiosk window seamlessly and returns to XBMC. This remote also includes a toggle’able virtual mouse which uses the arrow keys to move the cursor around the screen - works great within the Chrome webpage where the regular arrow keys don’t function, so I’d recommend giving it a go. No re-mapping of keys needed at all. This seemed to be the biggest barrier to getting the system properly functional, for me at least.

I’m still trying to get scripts working to open an Openbox window, but the main barrier seems to be making them executable. When I run:

sudo chmod +x script.sh

it reports that it can’t find script.sh. I’ve tried including the full path but still no good. Any tips?

Answered my own question re. making script.sh executable. I right clicked the script file in file manager and set the permissions to allow the script to be executable - in case anyone else has this issue.

Just to add, the script works fine and resolves the window manager issue, so Chrome Launcher and NetfliXBMC now work seamlessly from a pure XBMC boot.
Reply
My problem is solved.
Solutions are here if anyone else is trying to implement something similar.
Big thanks to Ronie from Transparency for his help!
http://forum.kodi.tv/showthread.php?tid=...pid1828911
Reply
(2014-10-18, 07:02)$tocK Wrote: Hi Guys,

I am finally getting somewhere,

i have managed to get the mouse and keyboard to go through to Google chrome,

I am hoping to do a how to once i'm finished as i haven't found one yet.

My last problems are:

Problem 1: I have set up my MCE remote to work with XBMC, however when i go to Netflix in Google chrome, the remote controls don't go through only the mouse and keyboard. Does anyone know how to pass the remote control to Google Chrome?

Problem 2: I have no sound. I have sound in XBMC when using the remote, but as soon as i go to Netflix, i have no sound. Does anyone know how to fix this?

Thanks,

$tocK

Could you please share how you got the mouse / keyboard working? i have the same issue in xbmcbuntu
Reply
(2014-11-13, 00:02).eh. Wrote:
(2014-10-18, 07:02)$tocK Wrote: Hi Guys,

I am finally getting somewhere,

i have managed to get the mouse and keyboard to go through to Google chrome,

I am hoping to do a how to once i'm finished as i haven't found one yet.

My last problems are:

Problem 1: I have set up my MCE remote to work with XBMC, however when i go to Netflix in Google chrome, the remote controls don't go through only the mouse and keyboard. Does anyone know how to pass the remote control to Google Chrome?

Problem 2: I have no sound. I have sound in XBMC when using the remote, but as soon as i go to Netflix, i have no sound. Does anyone know how to fix this?

Thanks,

$tocK

Could you please share how you got the mouse / keyboard working? i have the same issue in xbmcbuntu

I have managed to get it working somewhat with my Harmony Remote. I have a few different devices in order to manage to get all the functions I wanted.

But the Microsoft Media Player (Microsoft MCE Keyboard) has Mouse functions (Mouse left, mouse right etc) So I have those working but I am still working on getting the buttons (i.e left and right clicks) working.

I also added the Media Center PC SE (Microsoft Windows Media Center SE) as it has Alt+ functions (as well as a keyboard) so I was able to map Alt+F4 to a button so I can exit Chrome Launcher. (this isn't working flawlessly yet as I am having issues with either the remote sending or xbmc reading multiple presses but it does work)

Hope this points you in the right direction.

Cheers

Justin
Reply
A few days ago I set up RaspBMC on the Raspberry Pi, and after installing the Chrome Launcher, whenever I try to open launcher, I just get the message 'Chrome not found." I tried uninstalling it and installing from a flash drive instead, and that did not help either. I couldn't find anywhere else this question had been asked, so would anybody here have any solutions?

Thanks,
Krats
Reply
HI

I have a problem when i try to use Chrome Launcher, The symptoms are as follows.

When launching a page, even the stock vimeo page, Chrome launches, then quickly goes to background. It continues to run and in the case of vimeo, video playback starts, but I cannot access it. When I exit xbmc, Vimeo is still full screen playing in Kiosk mode.

This also happens when I use SkyGO, I dont know if this is related.

I would post some log file, but I dont see any mention of the app in there?

Thanks

Joe
Reply
  • 1
  • 14
  • 15
  • 16(current)
  • 17
  • 18
  • 47

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Chrome Launcher8