def AddCategoryToFavorites(categoryID): allCatList = common.ReadList(categoriesFile) category = [ u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"), item["name"]) for item in allCatList if item['id'] == categoryID ] channels = common.GetChannels(categoryID) if not common.YesNoDialog(localizedString(30210).encode('utf-8'), localizedString(30221).encode('utf-8'), localizedString(30222).encode('utf-8').format( category[0].encode('utf-8'), len(channels)), localizedString(30223).encode('utf-8'), nolabel=localizedString(30002).encode('utf-8'), yeslabel=localizedString(30001).encode('utf-8')): return xbmc.executebuiltin( 'Notification({0}, Start adding channels to favourites, {1}, {2})'. format(AddonName, 5000, icon)) addFavorites([channel["id"] for channel in channels], categoryID, showNotification=False) common.MakeFavouritesGuide(fullGuideFile) xbmc.executebuiltin( 'Notification({0}, Channels added to favourites, {1}, {2})'.format( AddonName, 5000, __icon__))
def ImportFavourites(): selectedDir = Addon.getSetting("imExFolder") if selectedDir is None or selectedDir == "": return files = [f for f in os.listdir(selectedDir) if f.endswith(".txt")] fileInd = common.GetMenuSelected( localizedString(30025).encode('utf-8'), files) if fileInd == -1: return fullPath = os.path.join(selectedDir.decode("utf-8"), files[fileInd]) favsList = common.ReadList(fullPath) if not common.YesNoDialog( localizedString(30215).encode('utf-8'), localizedString(30216).encode('utf-8'), line2=localizedString(30217).encode('utf-8').format(len(favsList)), line3=localizedString(30218).encode('utf-8'), nolabel=localizedString(30002).encode('utf-8'), yeslabel=localizedString(30001).encode('utf-8')): return common.WriteList(FAV, favsList) common.MakeFavouritesGuide(fullGuideFile) xbmc.executebuiltin( 'Notification({0}, Favourites list is saved., {2}, {3})'.format( AddonName, fullPath, 5000, __icon__)) iptvList = int(Addon.getSetting("iptvList")) if useIPTV and iptvList == 0: MakeIPTVlists() DownloadLogos()
def EmptyFavorties(): if not common.YesNoDialog(localizedString(30213).encode('utf-8'), localizedString(30220).encode('utf-8'), "", "", nolabel=localizedString(30002).encode('utf-8'), yeslabel=localizedString(30001).encode('utf-8')): return xbmc.executebuiltin('Notification({0}, Start removing channels from favourites, {1}, {2})'.format(AddonName, 5000, icon)) common.WriteList(FAV, []) common.MakeFavouritesGuide(fullGuideFile) xbmc.executebuiltin('Notification({0}, Channels removed trom favourites, {1}, {2})'.format(AddonName, 5000, __icon__))
def LoadLogin(): resp = common.YesNoDialog( "Authentification!", "Il faut configurer votre login et mot de passe Annatel TV!\nCliquez sur Yes pour configurer votre login et mot de passe", nolabel="Non", yeslabel="Oui") if (resp): common.OpenSettings() else: common.ShowNotification( "Authentification!\nMerci d\'entrer votre login et mot de passe Annatel TV", 10, addon=__Addon__)
def YesNoDialog(self, message): return common.YesNoDialog(message)
common.debug( str(selectedRestore) + ": " + params['archive']) else: common.DlgNotificationMsg(common.translate(30045), time=5000) common.debug(params['archive'] + ' is not a valid restore point') else: # allow user to select the backup to restore from selectedRestore = common.SelectDialog( title=common.translate(30021), options=pointNames) if selectedRestore != -1: recovery.doSelectRestore(restorePoints[selectedRestore][0]) common.DlgNotificationMsg(common.translate(30055), time=5000) elif mode == recovery.Backup: common.DlgNotificationMsg(common.translate(30054), time=5000) # execute selected operation (Backup or Restore) execute = recovery.run(mode) if execute: if mode == recovery.Restore: common.DlgNotificationMsg(common.translate(30057), time=5000) common.sleep(5000) if common.YesNoDialog(common.translate(30058)): common.restart() elif mode == recovery.Backup: common.DlgNotificationMsg(common.translate(30056), time=5000) else: # can't go any further common.OkDialog(common.translate(30045)) common.Addon().openSettings()