def get_browser_homepage(): homepage = common.file_get_contents("/data/etc/.browser_homepage") if homepage == "": homepage = "http://www.myfav.es/boxee" return homepage
def running_squeezeslave(): tmpfile = "/tmp/squeezeslavepid" os.system("rm " + tmpfile) os.system("pidof squeezeslave > " + tmpfile) pid = common.file_get_contents(tmpfile) if pid == "": return 0 else: return 1
def showmusic_function(): showmusic = common.file_get_contents("/data/etc/.showmusic_enabled") if showmusic == "1": showmusic = "0" else: showmusic = "1" xbmc.executebuiltin("Skin.SetString(showmusic,%s)" % showmusic) common.file_put_contents("/data/etc/.showmusic_enabled", showmusic)
def get_featured_feed(): youtube = common.file_get_contents("/data/etc/youtube") replace = get_featured_feed_value() feed = "feed://featured/?limit=15" if replace == "1": feed = "boxeedb://recent/?limit=15" if replace == "2": feed = "rss://vimeo.com/channels/staffpicks/videos/rss" if replace == "3": feed = "rss://gdata.youtube.com/feeds/api/standardfeeds/recently_featured?alt=rss" if replace == "4": feed = "rss://gdata.youtube.com/feeds/api/users/" + youtube + "/newsubscriptionvideos?alt=rss" if replace == "5": feed = "about:blank" return feed
def get_fanart_list(): global fanart showlist = common.file_get_contents("/data/etc/.fanart") if showlist == "": return showlist = showlist.split("\n") fanart = {} for line in showlist: if "=" in line: line = line.split("=") show = line[0].decode("utf-8") art = line[1].decode("utf-8") fanart[show] = art
def get_fanart_list(): global fanart showlist = common.file_get_contents("/data/etc/.fanart") if showlist == "": return showlist = showlist.split("\n") fanart = {} for line in showlist: if "=" in line: line = line.split("=") show = line[0] art = line[1] fanart[show] = art
def set_telnet_password(): passwd = common.file_get_contents("/data/etc/passwd") kb = xbmc.Keyboard('default', 'heading', True) kb.setDefault(passwd) # optional kb.setHeading('Enter telnet password') # optional kb.setHiddenInput(True) # optional kb.doModal() if kb.isConfirmed(): passwd = kb.getText() if passwd == "": dialog = xbmcgui.Dialog() ok = dialog.ok('Telnet', 'The telnet password must not be empty.') else: common.file_put_contents("/data/etc/passwd", passwd)
def get_fanart_list(exclude_blanks): global fanart showlist = common.file_get_contents("/data/etc/.fanart") if showlist == "": return showlist = showlist.split("\n") fanart = {} for line in showlist: if "=" in line: line = line.split("=") show = line[0].decode("utf-8") art = line[1].decode("utf-8") if art != "-" or exclude_blanks == False: fanart[show] = art
def get_fanart_list(exclude_blanks): global fanart showlist = common.file_get_contents(xbmc.translatePath('special://profile/.fanart')) if showlist == "": return showlist = showlist.split("\n") fanart = {} for line in showlist: if "=" in line: line = line.split("=") show = line[0].decode("utf-8") art = line[1].decode("utf-8") if art != "-" or exclude_blanks == False: fanart[show] = art
def set_youtube_sub(): youtube = common.file_get_contents("/data/etc/youtube") yt = xbmc.Keyboard('default', 'heading', True) yt.setDefault(youtube) # optional yt.setHeading('Enter YouTube username') # optional yt.setHiddenInput(False) # optional yt.doModal() if yt.isConfirmed(): you = yt.getText() if you == "": dialog = xbmcgui.Dialog() ok = dialog.ok('YouTube', 'You most enter a username.') else: common.file_put_contents("/data/etc/youtube", you) xbmc.executebuiltin("Skin.SetString(youtube,%s)" % you)
def get_fanart_list(exclude_blanks): global fanart showlist = common.file_get_contents( xbmc.translatePath('special://profile/.fanart')) if showlist == "": return showlist = showlist.split("\n") fanart = {} for line in showlist: if "=" in line: line = line.split("=") show = line[0].decode("utf-8") art = line[1].decode("utf-8") if art != "-" or exclude_blanks == False: fanart[show] = art
def set_youtube_sub(): youtube = common.file_get_contents("/data/etc/youtube") yt = xbmc.Keyboard('default', 'heading', True) yt.setDefault(youtube) # optional yt.setHeading('Enter YouTube username') # optional yt.setHiddenInput(False) # optional yt.doModal() if yt.isConfirmed(): you = yt.getText() if you == "": dialog = xbmcgui.Dialog() ok = dialog.ok('YouTube', 'You most enter a username.') else: common.file_put_contents("/data/etc/youtube", you) xbmc.executebuiltin("Skin.SetString(youtube,%s)" % you )
def delete_theme(): get_themes() #Load varaiables with theme names based on the directory structure theme_location = get_theme_path() #Load variable theme_location with the theme path theme_name = get_theme_name() currently_enabled = common.file_get_contents("/data/etc/.currently_enabled_theme")#read the currently enabled theme. if theme_name == 'boxee': mc.ShowDialogOk('Error','You cannot remove the boxee theme') return if theme_name == currently_enabled: mc.ShowDialogOk('Error','This is the currently enabled theme. \n if you wish to remove this theme please apply another theme before deleting this theme.') return if mc.ShowDialogConfirm("Confirmation", "Are you sure you wish to delete this theme", "Cancel", "Delete"): commandStr = "rm -rf " + theme_location + "/"#build the delete string commandStr = "%s" % commandStr#converts to a string os.system(commandStr)#action the delete mc.ShowDialogNotification("Theme Deleted") else: return
def set_browser_homepage(): homepage = get_browser_homepage() kb = xbmc.Keyboard('default', 'heading', True) kb.setDefault(homepage) kb.setHeading('Enter homepage URL') # optional kb.setHiddenInput(False) # optional kb.doModal() if kb.isConfirmed(): homepage = kb.getText() common.file_put_contents("/data/etc/.browser_homepage", homepage) template = common.file_get_contents("/data/hack/apps/browser2/template.xml") template = homepage.join(template.split("$URL$")) common.file_put_contents("/data/hack/apps/browser2/descriptor.xml", template) os.system("sh /data/hack/apps.sh") common.set_string("browser-homepage", "".join(get_browser_homepage().split("http://")) )
def get_local_version(): version_local = common.file_get_contents("/data/hack/version") return version_local
def get_homeenabled_value(): homeenabled = common.file_get_contents("/data/etc/.home_enabled") if homeenabled == "": homeenabled = get_home_enabled_default_list() return homeenabled.split("\n")[0]
def get_jump_to_last_unwatched_value(): jumpenabled = common.file_get_contents("/data/etc/.jump_to_unwatched_enabled") if jumpenabled == "": jumpenabled = "0" return jumpenabled
def get_featured_feed_value(): replace = common.file_get_contents("/data/etc/.replace_featured_enabled") if replace == "": replace = "0" return replace
def get_subtitles_enabled(): subtitles = common.file_get_contents("/data/etc/.subtitles_enabled") if subtitles == "": subtitles = "0" return subtitles
def get_squeezecontroller(): squeezecontroller = common.file_get_contents("/data/etc/squeezecontroller") return squeezecontroller
def get_xbmc_found(): found = common.file_get_contents('/data/etc/.xbmc_found') return found
def update(): version_remote = get_remote_version() os.system("dtool 6 1 0 100") os.system("dtool 6 2 0 0") mc.ShowDialogNotification("Beginning Upgrade") if os.path.exists("/media/BOXEE/hack"): mc.ShowDialogNotification("Found USB Drive with Boxee+") ev = common.file_get_contents("/media/BOXEE/hack/version") xbmc.executebuiltin("Notification(,Installing Boxee+,60000)") mc.ShowDialogWait() os.system("rm -Rf /data/hack") os.system("cp -R /media/BOXEE/hack /data/") os.system("chmod -R +x /data/hack/*.sh") os.system("chmod -R +x /data/hack/bin/*") mc.HideDialogWait() else: # Clean Up to Ensure we have Disk Space cleanupdownload() xbmc.executebuiltin("Notification(,Downloading Boxee+,120000)") mc.ShowDialogWait() if os.path.exists("/data/etc/downloadurl"): dl_url = common.file_get_contents("/data/etc/downloadurl") os.system("/opt/local/bin/curl -L " + dl_url + " -o /download/boxeehack.zip") else: os.system("/opt/local/bin/curl -L http://boxeed.in/boxeeplus/boxeehack.zip -o /download/boxeehack.zip") os.system("/opt/local/bin/curl -L http://boxeed.in/boxeeplus/boxeehack.md5 -o /download/boxeehack.md5") dm = common.file_get_contents("/download/boxeehack.md5") os.system("md5sum /download/boxeehack.zip | awk '{ print $1 }'> /download/boxeehack.md52") tm = common.file_get_contents("/download/boxeehack.md5") mc.HideDialogWait() if dm != tm or tm == "": os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin("Notification(,Download Failed - Aborting,60000)") return mc.ShowDialogNotification("Download Complete") time.sleep(2) xbmc.executebuiltin("Notification(,Extracting Archive,120000)") mc.ShowDialogWait() os.system("/bin/busybox unzip /download/boxeehack.zip -d /download/") mc.HideDialogWait() mc.ShowDialogNotification("Extraction Complete") time.sleep(2) mc.ShowDialogNotification("Verifying Extraction") ev = common.file_get_contents("/download/boxeehack-master/hack/version") if ev != version_remote: os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin("Notification(,Extraction Failed - Aborting,60000)") return time.sleep(2) xbmc.executebuiltin("Notification(,Installing Boxee+,60000)") mc.ShowDialogWait() os.system("rm -Rf /data/hack") os.system("cp -R /download/boxeehack-master/hack /data/") os.system("chmod -R +x /data/hack/*.sh") os.system("chmod -R +x /data/hack/bin/*") mc.HideDialogWait() mc.ShowDialogNotification("Verifying Installation") hv = common.file_get_contents("/data/hack/version") if ev != hv: os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin("Notification(,Installation Failed - Aborting,60000)") return time.sleep(2) mc.ShowDialogNotification("Cleaning Up") cleanupdownload() time.sleep(2) os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") # No need to redo all the settings since Boxee+ is already running xbmc.executebuiltin("Notification(,Rebooting,120000)") os.system("reboot")
def update(): version_remote = get_remote_version() os.system("dtool 6 1 0 100") os.system("dtool 6 2 0 0") mc.ShowDialogNotification("Beginning Upgrade") if os.path.exists("/media/BOXEE/hack"): mc.ShowDialogNotification("Found USB Drive with Boxee+") ev = common.file_get_contents("/media/BOXEE/hack/version") xbmc.executebuiltin("Notification(,Installing Boxee+,60000)") mc.ShowDialogWait() os.system("rm -Rf /data/hack") os.system("cp -R /media/BOXEE/hack /data/") os.system("chmod -R +x /data/hack/*.sh") os.system("chmod -R +x /data/hack/bin/*") mc.HideDialogWait() else: # Clean Up to Ensure we have Disk Space cleanupdownload() xbmc.executebuiltin("Notification(,Downloading Boxee+,120000)") mc.ShowDialogWait() os.system( "/opt/local/bin/curl -L http://boxeed.in/boxeeplus/boxeehack.zip -o /download/boxeehack.zip" ) os.system( "/opt/local/bin/curl -L http://boxeed.in/boxeeplus/boxeehack.md5 -o /download/boxeehack.md5" ) dm = common.file_get_contents("/download/boxeehack.md5") os.system( "md5sum /download/boxeehack.zip | awk '{ print $1 }'> /download/boxeehack.md52" ) tm = common.file_get_contents("/download/boxeehack.md5") mc.HideDialogWait() if dm != tm or tm == "": os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin( "Notification(,Download Failed - Aborting,60000)") return mc.ShowDialogNotification("Download Complete") time.sleep(2) xbmc.executebuiltin("Notification(,Extracting Archive,120000)") mc.ShowDialogWait() os.system("/bin/busybox unzip /download/boxeehack.zip -d /download/") mc.HideDialogWait() mc.ShowDialogNotification("Extraction Complete") time.sleep(2) mc.ShowDialogNotification("Verifying Extraction") ev = common.file_get_contents( "/download/boxeehack-master/hack/version") if ev != version_remote: os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin( "Notification(,Extraction Failed - Aborting,60000)") return time.sleep(2) xbmc.executebuiltin("Notification(,Installing Boxee+,60000)") mc.ShowDialogWait() os.system("rm -Rf /data/hack") os.system("cp -R /download/boxeehack-master/hack /data/") os.system("chmod -R +x /data/hack/*.sh") os.system("chmod -R +x /data/hack/bin/*") mc.HideDialogWait() mc.ShowDialogNotification("Verifying Installation") hv = common.file_get_contents("/data/hack/version") if ev != hv: os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") xbmc.executebuiltin( "Notification(,Installation Failed - Aborting,60000)") return time.sleep(2) mc.ShowDialogNotification("Cleaning Up") cleanupdownload() time.sleep(2) os.system("dtool 6 1 0 0") os.system("dtool 6 2 0 50") # No need to redo all the settings since Boxee+ is already running xbmc.executebuiltin("Notification(,Rebooting,120000)") os.system("reboot")
def get_theme_selected_from_file(): theme_selected_tracker = common.file_get_contents("/data/etc/.replace_theme_enabled") if theme_selected_tracker == "": theme_selected_tracker = "0" return theme_selected_tracker
def get_boot_to_xbmc_enabled(): bootenabled = common.file_get_contents('/data/etc/.boot_to_xbmc_enabled') return bootenabled