def resetChannels(): AddonID = 'script.trtv' dialog = xbmcgui.Dialog() path = dixie.GetChannelFolder() chan = os.path.join(path, 'channels') chanchk = xbmc.translatePath( os.path.join('special://profile/addon_data/', AddonID, 'chan.xml')) catsxml = xbmc.translatePath( os.path.join('special://profile/addon_data/', AddonID, 'cats.xml')) success = 0 try: os.remove(chanchk) except: dixie.log( "### IMPORTANT ### Failed to remove the chanchk file in addon_data, please manually remove if it's still there" ) if sfile.exists(chan): xbmc.executebuiltin('Dialog.Show(busydialog)') sfile.rmtree(chan) xbmc.executebuiltin('Dialog.Close(busydialog)') success = 1 if success == 1 and showdialogs: dialog.ok('TRTV - Reset Channels', 'TRTV Channels successfully reset.', 'They will be re-created next time', 'you start the guide') if success == 0 and showdialogs: dialog.ok( 'TRTV - Reset Channels', 'There was nothing to reset, please try running the add-on again so it can repopulate your channels.' ) if os.path.exists(catsxml): if showdialogs: choice = dialog.yesno( 'Do You Need To Reset Categories?', 'It\'s highly unlikely you\'ll need to use this but if your main categories list has become corrupt it can cause problems. Would you like to reset the categories to the defaults?' ) else: choice = 1 if choice == 1: try: os.remove(catsxml) if showdialogs: dialog.ok( 'TRTV - Reset Categories', 'TRTV Categories successfully reset to addon defaults. Any customisations you previously had are now lost.' ) except: if showdialogs: dialog.ok( 'TRTV - Reset Categories', 'There was nothing to reset, please try running the add-on again so it can repopulate your categories.' ) dixie.log( "### IMPORTANT ### Unable to remove the cats.xml file in your addon_data folder. Please manually delete" )
def CheckForChannels(): dir = dixie.GetChannelFolder() folder = os.path.join(dir, 'channels') files = [] try: current, dirs, files = sfile.walk(folder) except: pass if len(files) == 0: dixie.SetSetting('updated.channels', -1) # force refresh of channels backup = os.path.join(dir, 'channels-backup') if not sfile.exists(backup): dixie.BackupChannels()
def resetChannels(): path = dixie.GetChannelFolder() chan = os.path.join(path, 'channels') if sfile.exists(chan): xbmc.executebuiltin('Dialog.Show(busydialog)') sfile.rmtree(chan) xbmc.executebuiltin('Dialog.Close(busydialog)') d = xbmcgui.Dialog() d.ok('On-Tapp.TV', 'On-Tapp.TV Channels successfully reset.', 'They will be re-created next time', 'you start the guide') else: pass
ADDONS = xbmc.translatePath('special://home/addons/') USERDATA = xbmc.translatePath('special://profile/') ADDON_DATA = os.path.join(USERDATA, 'addon_data') dbpath = os.path.join(ADDON_DATA, AddonID, 'program.db') dialog = xbmcgui.Dialog() dp = xbmcgui.DialogProgress() updateicon = os.path.join(ADDONS, AddonID, 'resources', 'update.png') chanxmlfile = os.path.join(ADDON_DATA, AddonID, 'chan.xml') catsxfile = os.path.join(ADDON_DATA, AddonID, 'cats.xml') xmlmaster = os.path.join(ADDONS, AddonID, 'resources', 'chan.xml') catsmaster = os.path.join(ADDONS, AddonID, 'resources', 'cats.xml') csvfile = os.path.join(ADDON_DATA, AddonID, 'programs.csv') tempxml = os.path.join(ADDON_DATA, AddonID, 'temp.xml') tempurl = os.path.join(ADDON_DATA, AddonID, 'extras', 'logos', 'None', 'icon_placeholder') path = dixie.GetChannelFolder() chan = os.path.join(path, 'channels') log_path = xbmc.translatePath('special://logpath/') stop = 0 chanchange = 0 catschange = 0 errorlist = ['none'] countryarray = [['AF', 'Afghanistan'], ['AL', 'Albania'], ['DZ', 'Algeria'], ['AO', 'Angola'], ['AR', 'Argentina'], ['AM', 'Armenia'], ['AU', 'Australia'], ['AT', 'Austria'], ['AZ', 'Azerbaijan'], ['BS', 'Bahamas'], ['BY', 'Belarus'], ['BE', 'Belgium'], ['BO', 'Bolivia'], ['BA', 'Bosnia'], ['BR', 'Brazil'], ['BG', 'Bulgaria'], ['KM', 'Cambodia'], ['CM', 'Cameroon'], ['CA', 'Canada'], ['CL', 'Chile'], ['CN', 'China'], ['CO', 'Colombia'], ['CR', 'Costa Rica'], ['HR', 'Croatia'],
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. # http://www.gnu.org/copyleft/gpl.html import xbmcgui import xbmcaddon import os, re, sys import dixie import sfile AddonID = 'script.trtv' ADDON = xbmcaddon.Addon(id=AddonID) ADDON_DATA = xbmc.translatePath('special://profile/addon_data') SF_CHANNELS = ADDON.getSetting('SF_CHANNELS') SF_METALLIQ = ADDON.getSetting('SF_METALLIQ') PROVIDER_PATH = os.path.join(ADDON_DATA, 'plugin.video.metalliq', 'players') OTT_CHANNELS = os.path.join(dixie.GetChannelFolder(), 'channels') dialog = xbmcgui.Dialog() #-------------------------------------------------------------------------------------------------- # Create favourites.xml file for the various providers def Create_XML(name): favpath = os.path.join(name,'favourites.xml') writefile = open(favpath,'w+') writefile.write('<favourites>\n') channels = name.split(os.sep) channelorig = channels[len(channels)-1] channel = channelorig.replace('__',' +').replace('_',' ') if channel == '/': channel = channels[len(channels)-2].replace('__',' +').replace('_',' ') if channel[-5:-3] == ' (':
import re import io SOURCE = dixie.GetSetting('source') DIXIEURL = dixie.GetSetting('dixie.url').upper() GMTOFFSET = dixie.GetGMTOffset() datapath = dixie.PROFILE settingsFile = os.path.join(datapath, 'settings.cfg') USE_DB_FILE = True SETTINGS_TO_CHECK = ['dixie.url'] channelFolder = dixie.GetChannelFolder() channelPath = os.path.join(channelFolder, 'channels') dixie.log('Channel Folder Setting: %s' % channelPath) try: sfile.makedirs(channelPath) except: pass def GetDixieUrl(): return dixie.GetDixieUrl(DIXIEURL) def GetLogoType(): return dixie.GetSetting('logo.type')