本文整理匯總了Python中channel.Channel.save方法的典型用法代碼示例。如果您正苦於以下問題:Python Channel.save方法的具體用法?Python Channel.save怎麽用?Python Channel.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類channel.Channel
的用法示例。
在下文中一共展示了Channel.save方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: addChannel
# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import save [as 別名]
def addChannel(self):
kb = xbmc.Keyboard('', addon.getLocalizedString(30403))
#url
kb.doModal()
if (kb.isConfirmed()):
url = kb.getText()
if url == '' : sys.exit(0)
else:
#protocol
m = re.search('^(\w+)://', url)
if(m):
protocol = m.group(1)
else:
xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30406), "", 1))
sys.exit(0)
#name
kb = xbmc.Keyboard('', addon.getLocalizedString(30404))
kb.doModal()
if (kb.isConfirmed()):
name = kb.getText()
name = name.title()
if name == '' : sys.exit(0)
else:
#save
ch = Channel(id_cat = self.catId, address = url, name=name, protocol=protocol, status=Channel.STATUS_ONLINE, my=1)
if(ch.save() == False):
xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30408), "", 1))
xbmc.executebuiltin("Container.Refresh")
xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30405), "", 1))
xbmc.executebuiltin("Container.Refresh")
else:
xbmc.executebuiltin("Container.Refresh")
else:
xbmc.executebuiltin("Container.Refresh")