Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Add new stream setup dialog (work in progress)

  • Loading branch information...
commit 2de1a9c11ebb131e57bf857691a18e690029232e 1 parent f734d3b
@twinther authored
View
2  addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.tvguide" name="TV Guide" version="1.3.5" provider-name="twinther [tommy@winther.nu]">
+<addon id="script.tvguide" name="TV Guide" version="1.4.0" provider-name="twinther [tommy@winther.nu]">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
View
3  changelog.txt
@@ -1,3 +1,6 @@
+[B]Version 1.4.0 - 2012-xx-xx[/B]
+- Add new stream setup dialog
+
[B]Version 1.3.5 - 2012-06-03[/B]
- Fixed key-repeat problem when re-ordering channels
- Fixed problem with parsing some XMLTV dates
View
231 gui.py
@@ -19,6 +19,7 @@
#
import datetime
import threading
+import os
import xbmc
import xbmcgui
@@ -28,6 +29,10 @@
from strings import *
import buggalo
+from xml.etree import ElementTree
+from xml.parsers.expat import ExpatError
+import ConfigParser
+
DEBUG = False
MODE_EPG = 'EPG'
@@ -64,6 +69,34 @@
def debug(s):
if DEBUG: xbmc.log(str(s), xbmc.LOGDEBUG)
+def loadFavouritesXml():
+ entries = list()
+ path = xbmc.translatePath('special://userdata/favourites.xml')
+ if os.path.exists(path):
+ f = open(path)
+ xml = f.read()
+ f.close()
+
+ try:
+ doc = ElementTree.fromstring(xml)
+ for node in doc.findall('favourite'):
+ entries.append((node.get('name'), node.text))
+ except ExpatError:
+ pass
+
+ return entries
+
+def getAddonsParser():
+ """
+ @return ConfigParser.ConfigParser
+ """
+ path = os.path.join(ADDON.getAddonInfo('path'), 'resources', 'addons.ini')
+ parser = ConfigParser.ConfigParser()
+ parser.optionxform = lambda option: option
+ parser.read(path)
+ return parser
+
+
class SourceInitializer(threading.Thread):
def __init__(self, sourceInitializedHandler):
super(SourceInitializer, self).__init__()
@@ -428,10 +461,10 @@ def _showContextMenu(self, program):
self.onRedrawEPG(self.channelIdx, self.viewStartDate)
- elif buttonClicked == PopupMenu.C_POPUP_CHOOSE_STRM:
- filename = xbmcgui.Dialog().browse(1, ADDON.getLocalizedString(30304), 'video', '.strm')
- if filename:
- self.source.setCustomStreamUrl(program.channel, filename)
+ elif buttonClicked == PopupMenu.C_POPUP_CHOOSE_STREAM:
+ d = StreamSetupDialog(self.source, program.channel)
+ d.doModal()
+ del d
elif buttonClicked == PopupMenu.C_POPUP_PLAY:
if self.source.isPlayable(program.channel):
@@ -928,9 +961,11 @@ def setControlText(self, controlId, text):
control.setText(text)
+
+
class PopupMenu(xbmcgui.WindowXMLDialog):
C_POPUP_PLAY = 4000
- C_POPUP_CHOOSE_STRM = 4001
+ C_POPUP_CHOOSE_STREAM = 4001
C_POPUP_REMIND = 4002
C_POPUP_CHANNELS = 4003
C_POPUP_QUIT = 4004
@@ -966,9 +1001,9 @@ def onInit(self):
playControl.setLabel(strings(WATCH_CHANNEL, self.program.channel.title))
if not self.source.isPlayable(self.program.channel):
playControl.setEnabled(False)
- self.setFocusId(self.C_POPUP_CHOOSE_STRM)
+ self.setFocusId(self.C_POPUP_CHOOSE_STREAM)
if self.source.getCustomStreamUrl(self.program.channel):
- chooseStrmControl = self.getControl(self.C_POPUP_CHOOSE_STRM)
+ chooseStrmControl = self.getControl(self.C_POPUP_CHOOSE_STREAM)
chooseStrmControl.setLabel(strings(REMOVE_STRM_FILE))
if self.program.channel.logo is not None:
@@ -993,9 +1028,9 @@ def onAction(self, action):
@buggalo.buggalo_try_except({'method' : 'PopupMenu.onClick'})
def onClick(self, controlId):
- if controlId == self.C_POPUP_CHOOSE_STRM and self.source.getCustomStreamUrl(self.program.channel):
+ if controlId == self.C_POPUP_CHOOSE_STREAM and self.source.getCustomStreamUrl(self.program.channel):
self.source.deleteCustomStreamUrl(self.program.channel)
- chooseStrmControl = self.getControl(self.C_POPUP_CHOOSE_STRM)
+ chooseStrmControl = self.getControl(self.C_POPUP_CHOOSE_STREAM)
chooseStrmControl.setLabel(strings(CHOOSE_STRM_FILE))
if not self.source.isPlayable(self.program.channel):
@@ -1009,7 +1044,6 @@ def onClick(self, controlId):
def onFocus(self, controlId):
pass
-
class ChannelsMenu(xbmcgui.WindowXMLDialog):
C_CHANNELS_LIST = 6000
C_CHANNELS_SELECTION_VISIBLE = 6001
@@ -1139,3 +1173,180 @@ def swapChannels(self, fromIdx, toIdx):
+class StreamSetupDialog(xbmcgui.WindowXMLDialog):
+ C_STREAM_STRM_TAB = 101
+ C_STREAM_FAVOURITES_TAB = 102
+ C_STREAM_ADDONS_TAB = 103
+ C_STREAM_STRM_BROWSE = 1001
+ C_STREAM_STRM_FILE_LABEL = 1005
+ C_STREAM_STRM_PREVIEW = 1002
+ C_STREAM_STRM_OK = 1003
+ C_STREAM_STRM_CANCEL = 1004
+ C_STREAM_FAVOURITES = 2001
+ C_STREAM_FAVOURITES_PREVIEW = 2002
+ C_STREAM_FAVOURITES_OK = 2003
+ C_STREAM_FAVOURITES_CANCEL = 2004
+ C_STREAM_ADDONS = 3001
+ C_STREAM_ADDONS_STREAMS = 3002
+ C_STREAM_ADDONS_NAME = 3003
+ C_STREAM_ADDONS_DESCRIPTION = 3004
+ C_STREAM_ADDONS_PREVIEW = 3005
+ C_STREAM_ADDONS_OK = 3006
+ C_STREAM_ADDONS_CANCEL = 3007
+
+ C_STREAM_VISIBILITY_MARKER = 100
+
+ VISIBLE_STRM = 'strm'
+ VISIBLE_FAVOURITES = 'favourites'
+ VISIBLE_ADDONS = 'addons'
+
+ def __new__(cls, source, channel):
+ return super(StreamSetupDialog, cls).__new__(cls, 'script-tvguide-streamsetup.xml', ADDON.getAddonInfo('path'))
+
+ def __init__(self, source, channel):
+ """
+ @type source: source.Source
+ @type channel:source.Channel
+ """
+ super(StreamSetupDialog, self).__init__()
+ self.source = source
+ self.channel = channel
+
+ self.addonsParser = getAddonsParser()
+ self.player = xbmc.Player()
+ self.previousAddonId = None
+ self.strmFile = None
+
+ def close(self):
+ if self.player.isPlaying():
+ self.player.stop()
+ super(StreamSetupDialog, self).close()
+
+ @buggalo.buggalo_try_except({'method' : 'StreamSetupDialog.onInit'})
+ def onInit(self):
+ self.getControl(self.C_STREAM_VISIBILITY_MARKER).setLabel(self.VISIBLE_STRM)
+
+ favourites = loadFavouritesXml()
+ items = list()
+ for label, value in favourites:
+ item = xbmcgui.ListItem(label)
+ item.setProperty('stream', value)
+ items.append(item)
+
+ listControl = self.getControl(StreamSetupDialog.C_STREAM_FAVOURITES)
+ listControl.addItems(items)
+
+ items = list()
+ for id in self.addonsParser.sections():
+ addon = xbmcaddon.Addon(id)
+ item = xbmcgui.ListItem(addon.getAddonInfo('name'), iconImage=addon.getAddonInfo('icon'))
+ item.setProperty('addon_id', id)
+ items.append(item)
+ listControl = self.getControl(StreamSetupDialog.C_STREAM_ADDONS)
+ listControl.addItems(items)
+ self.updateAddonInfo()
+
+
+ @buggalo.buggalo_try_except({'method' : 'StreamSetupDialog.onAction'})
+ def onAction(self, action):
+ print action.getId()
+
+ if action.getId() in [ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU, KEY_NAV_BACK, KEY_CONTEXT_MENU]:
+ self.close()
+ return
+
+ elif self.getFocusId() == self.C_STREAM_ADDONS:
+ self.updateAddonInfo()
+
+
+ @buggalo.buggalo_try_except({'method' : 'StreamSetupDialog.onClick'})
+ def onClick(self, controlId):
+ if controlId == self.C_STREAM_STRM_BROWSE:
+ stream = xbmcgui.Dialog().browse(1, ADDON.getLocalizedString(30304), 'video', '.strm')
+ if stream:
+ self.source.setCustomStreamUrl(self.channel, stream)
+ self.getControl(self.C_STREAM_STRM_FILE_LABEL).setText(stream)
+ self.strmFile = stream
+
+ elif controlId == self.C_STREAM_ADDONS_OK:
+ listControl = self.getControl(self.C_STREAM_ADDONS_STREAMS)
+ item = listControl.getSelectedItem()
+ stream = item.getProperty('stream')
+ self.source.setCustomStreamUrl(self.channel, stream)
+ self.close()
+
+ elif controlId == self.C_STREAM_FAVOURITES_OK:
+ listControl = self.getControl(self.C_STREAM_FAVOURITES)
+ item = listControl.getSelectedItem()
+ stream = item.getProperty('stream')
+ self.source.setCustomStreamUrl(self.channel, stream)
+ self.close()
+
+ elif controlId == self.C_STREAM_STRM_OK:
+ self.source.setCustomStreamUrl(self.channel, self.strmFile)
+ self.close()
+
+ elif controlId in [self.C_STREAM_ADDONS_CANCEL, self.C_STREAM_FAVOURITES_CANCEL, self.C_STREAM_STRM_CANCEL]:
+ self.close()
+
+ elif controlId in [self.C_STREAM_ADDONS_PREVIEW, self.C_STREAM_FAVOURITES_PREVIEW, self.C_STREAM_STRM_PREVIEW]:
+ if self.player.isPlaying():
+ self.player.stop()
+ return
+
+ stream = None
+ visible = self.getControl(self.C_STREAM_VISIBILITY_MARKER).getLabel()
+ if visible == self.VISIBLE_ADDONS:
+ listControl = self.getControl(self.C_STREAM_ADDONS_STREAMS)
+ item = listControl.getSelectedItem()
+ stream = item.getProperty('stream')
+ elif visible == self.VISIBLE_FAVOURITES:
+ listControl = self.getControl(self.C_STREAM_FAVOURITES)
+ item = listControl.getSelectedItem()
+ stream = item.getProperty('stream')
+ elif visible == self.VISIBLE_STRM:
+ stream = self.strmFile
+
+ if stream is not None:
+ if stream[0:9] == 'PlayMedia':
+ stream = stream[11:-2]
+
+ print stream
+ self.player.play(item = stream, windowed = True)
+
+ @buggalo.buggalo_try_except({'method' : 'StreamSetupDialog.onFocus'})
+ def onFocus(self, controlId):
+ if controlId == self.C_STREAM_STRM_TAB:
+ self.getControl(self.C_STREAM_VISIBILITY_MARKER).setLabel(self.VISIBLE_STRM)
+ elif controlId == self.C_STREAM_FAVOURITES_TAB:
+ self.getControl(self.C_STREAM_VISIBILITY_MARKER).setLabel(self.VISIBLE_FAVOURITES)
+ elif controlId == self.C_STREAM_ADDONS_TAB:
+ self.getControl(self.C_STREAM_VISIBILITY_MARKER).setLabel(self.VISIBLE_ADDONS)
+
+
+ def updateAddonInfo(self):
+ listControl = self.getControl(self.C_STREAM_ADDONS)
+ item = listControl.getSelectedItem()
+ if item is None:
+ return
+
+ if item.getProperty('addon_id') == self.previousAddonId:
+ return
+
+ self.previousAddonId = item.getProperty('addon_id')
+ addon = xbmcaddon.Addon(id = item.getProperty('addon_id'))
+ self.getControl(self.C_STREAM_ADDONS_NAME).setLabel('[B]%s[/B]' % addon.getAddonInfo('name'))
+ self.getControl(self.C_STREAM_ADDONS_DESCRIPTION).setText(addon.getAddonInfo('description'))
+
+ streams = self.addonsParser.items(item.getProperty('addon_id'))
+ items = list()
+ for (label, stream) in streams:
+ item = xbmcgui.ListItem(label)
+ item.setProperty('stream', stream)
+ items.append(item)
+ listControl = self.getControl(StreamSetupDialog.C_STREAM_ADDONS_STREAMS)
+ listControl.reset()
+ listControl.addItems(items)
+
+
+
View
154 resources/addons.ini
@@ -0,0 +1,154 @@
+# This file contains the "built-in" channels
+# It is parsed by Pythons ConfigParser
+
+[plugin.video.dr.dk.live]
+DR1=plugin://plugin.video.dr.dk.live/?playChannel=1
+DR2=plugin://plugin.video.dr.dk.live/?playChannel=2
+DR Update=plugin://plugin.video.dr.dk.live/?playChannel=3
+DR K=plugin://plugin.video.dr.dk.live/?playChannel=4
+DR Ramasjang=plugin://plugin.video.dr.dk.live/?playChannel=5
+DR HD=plugin://plugin.video.dr.dk.live/?playChannel=6
+Kanal Sport=plugin://plugin.video.dr.dk.live/?playChannel=203
+
+[plugin.video.yousee.tv]
+3Sat=plugin://plugin.video.yousee.tv/?channel=195
+6'eren=plugin://plugin.video.yousee.tv/?channel=17
+6´eren HD=plugin://plugin.video.yousee.tv/?channel=64
+AAG=plugin://plugin.video.yousee.tv/?channel=272
+ARD=plugin://plugin.video.yousee.tv/?channel=66
+Al Jazeera English=plugin://plugin.video.yousee.tv/?channel=187
+Animal Planet=plugin://plugin.video.yousee.tv/?channel=31
+Animal Planet HD=plugin://plugin.video.yousee.tv/?channel=28
+Arte=plugin://plugin.video.yousee.tv/?channel=125
+BBC Entertainment=plugin://plugin.video.yousee.tv/?channel=40
+BBC HD=plugin://plugin.video.yousee.tv/?channel=43
+BBC Knowledge=plugin://plugin.video.yousee.tv/?channel=91
+BBC Lifestyle=plugin://plugin.video.yousee.tv/?channel=92
+BBC World=plugin://plugin.video.yousee.tv/?channel=41
+Blue Hustler=plugin://plugin.video.yousee.tv/?channel=367
+CANAL+ Action=plugin://plugin.video.yousee.tv/?channel=79
+CANAL+ Emotion=plugin://plugin.video.yousee.tv/?channel=81
+CANAL+ Family=plugin://plugin.video.yousee.tv/?channel=96
+CANAL+ First=plugin://plugin.video.yousee.tv/?channel=77
+CANAL+ First HD=plugin://plugin.video.yousee.tv/?channel=82
+CANAL+ Hits=plugin://plugin.video.yousee.tv/?channel=78
+CANAL+ Series=plugin://plugin.video.yousee.tv/?channel=80
+CANAL+ Sport 1=plugin://plugin.video.yousee.tv/?channel=85
+CANAL+ Sport 2=plugin://plugin.video.yousee.tv/?channel=86
+CANAL+ Sport Extra=plugin://plugin.video.yousee.tv/?channel=87
+CANAL9=plugin://plugin.video.yousee.tv/?channel=99
+CNN=plugin://plugin.video.yousee.tv/?channel=42
+Canal+ Sport HD=plugin://plugin.video.yousee.tv/?channel=88
+Cartoon Network=plugin://plugin.video.yousee.tv/?channel=20
+DK4=plugin://plugin.video.yousee.tv/?channel=13
+DR HD=plugin://plugin.video.yousee.tv/?channel=503
+DR K=plugin://plugin.video.yousee.tv/?channel=504
+DR Ramasjang=plugin://plugin.video.yousee.tv/?channel=505
+DR Update=plugin://plugin.video.yousee.tv/?channel=889
+DR1=plugin://plugin.video.yousee.tv/?channel=1
+DR2=plugin://plugin.video.yousee.tv/?channel=2
+Discovery Channel=plugin://plugin.video.yousee.tv/?channel=30
+Discovery Science=plugin://plugin.video.yousee.tv/?channel=101
+Discovery World=plugin://plugin.video.yousee.tv/?channel=100
+DiscoveryHD Showcase=plugin://plugin.video.yousee.tv/?channel=33
+Disney Channel=plugin://plugin.video.yousee.tv/?channel=19
+Disney Channel HD=plugin://plugin.video.yousee.tv/?channel=124
+Disney Junior=plugin://plugin.video.yousee.tv/?channel=174
+Disney XD=plugin://plugin.video.yousee.tv/?channel=21
+ESPN America=plugin://plugin.video.yousee.tv/?channel=141
+ESPN Classic Europe=plugin://plugin.video.yousee.tv/?channel=139
+EuroSport 2 HD=plugin://plugin.video.yousee.tv/?channel=173
+EuroSport HD=plugin://plugin.video.yousee.tv/?channel=27
+Eurosport=plugin://plugin.video.yousee.tv/?channel=24
+Eurosport 2=plugin://plugin.video.yousee.tv/?channel=140
+Folketinget=plugin://plugin.video.yousee.tv/?channel=160
+France 2=plugin://plugin.video.yousee.tv/?channel=200
+Geo TV=plugin://plugin.video.yousee.tv/?channel=273
+HRT1=plugin://plugin.video.yousee.tv/?channel=218
+HUSTLER tv=plugin://plugin.video.yousee.tv/?channel=366
+Hayat TV=plugin://plugin.video.yousee.tv/?channel=216
+History Channel HD=plugin://plugin.video.yousee.tv/?channel=84
+Investigation Discovery=plugin://plugin.video.yousee.tv/?channel=149
+Kanal 4=plugin://plugin.video.yousee.tv/?channel=9
+Kanal 5=plugin://plugin.video.yousee.tv/?channel=10
+Kanal 5 HD=plugin://plugin.video.yousee.tv/?channel=15
+Kanal Sport=plugin://plugin.video.yousee.tv/?channel=67
+Kanal Sport HD=plugin://plugin.video.yousee.tv/?channel=127
+Kral TV=plugin://plugin.video.yousee.tv/?channel=240
+Lig TV=plugin://plugin.video.yousee.tv/?channel=235
+MTV=plugin://plugin.video.yousee.tv/?channel=123
+MTV Dance=plugin://plugin.video.yousee.tv/?channel=111
+MTV Hits=plugin://plugin.video.yousee.tv/?channel=112
+MTV Live HD=plugin://plugin.video.yousee.tv/?channel=29
+MTV Rocks=plugin://plugin.video.yousee.tv/?channel=110
+Mezzo=plugin://plugin.video.yousee.tv/?channel=126
+Motors TV=plugin://plugin.video.yousee.tv/?channel=122
+NDR=plugin://plugin.video.yousee.tv/?channel=53
+NRK1=plugin://plugin.video.yousee.tv/?channel=48
+Nat Geo Wild=plugin://plugin.video.yousee.tv/?channel=120
+NatGeo Wild HD=plugin://plugin.video.yousee.tv/?channel=23
+National Geographic=plugin://plugin.video.yousee.tv/?channel=32
+National Geographic HD=plugin://plugin.video.yousee.tv/?channel=34
+Nick Jr.=plugin://plugin.video.yousee.tv/?channel=93
+Nickelodeon=plugin://plugin.video.yousee.tv/?channel=18
+Nickelodeon HD=plugin://plugin.video.yousee.tv/?channel=63
+Pink+=plugin://plugin.video.yousee.tv/?channel=219
+Playboy TV=plugin://plugin.video.yousee.tv/?channel=368
+Pro7=plugin://plugin.video.yousee.tv/?channel=56
+RTL=plugin://plugin.video.yousee.tv/?channel=54
+RTSsat=plugin://plugin.video.yousee.tv/?channel=220
+RaiUno=plugin://plugin.video.yousee.tv/?channel=202
+STV=plugin://plugin.video.yousee.tv/?channel=238
+Sat1=plugin://plugin.video.yousee.tv/?channel=55
+ShowTV=plugin://plugin.video.yousee.tv/?channel=236
+Showtime=plugin://plugin.video.yousee.tv/?channel=90
+Silver HD=plugin://plugin.video.yousee.tv/?channel=175
+Star Go=plugin://plugin.video.yousee.tv/?channel=274
+Star PI=plugin://plugin.video.yousee.tv/?channel=275
+Star!=plugin://plugin.video.yousee.tv/?channel=118
+Sverige 1=plugin://plugin.video.yousee.tv/?channel=45
+Sverige 1 HD=plugin://plugin.video.yousee.tv/?channel=89
+Sverige 2=plugin://plugin.video.yousee.tv/?channel=46
+Sverige 2 HD=plugin://plugin.video.yousee.tv/?channel=65
+TCM=plugin://plugin.video.yousee.tv/?channel=22
+TGRT EU=plugin://plugin.video.yousee.tv/?channel=234
+TLC Danmark=plugin://plugin.video.yousee.tv/?channel=59
+TLC HD Danmark=plugin://plugin.video.yousee.tv/?channel=61
+TNT=plugin://plugin.video.yousee.tv/?channel=62
+TRT=plugin://plugin.video.yousee.tv/?channel=230
+TV 2=plugin://plugin.video.yousee.tv/?channel=3
+TV 2 Charlie=plugin://plugin.video.yousee.tv/?channel=5
+TV 2 Danmark HD=plugin://plugin.video.yousee.tv/?channel=83
+TV 2 Film=plugin://plugin.video.yousee.tv/?channel=6
+TV 2 Film HD=plugin://plugin.video.yousee.tv/?channel=16
+TV 2 News=plugin://plugin.video.yousee.tv/?channel=38
+TV 2 Sport=plugin://plugin.video.yousee.tv/?channel=25
+TV 2 Sport HD=plugin://plugin.video.yousee.tv/?channel=26
+TV 2 Zulu=plugin://plugin.video.yousee.tv/?channel=4
+TV 5=plugin://plugin.video.yousee.tv/?channel=128
+TV Pol=plugin://plugin.video.yousee.tv/?channel=210
+TV2 Norge=plugin://plugin.video.yousee.tv/?channel=49
+TV3=plugin://plugin.video.yousee.tv/?channel=7
+TV3 Puls=plugin://plugin.video.yousee.tv/?channel=12
+TV3+=plugin://plugin.video.yousee.tv/?channel=8
+TV3+ HD=plugin://plugin.video.yousee.tv/?channel=172
+TV4=plugin://plugin.video.yousee.tv/?channel=44
+TVE=plugin://plugin.video.yousee.tv/?channel=204
+The Voice TV=plugin://plugin.video.yousee.tv/?channel=35
+Travel Channel=plugin://plugin.video.yousee.tv/?channel=117
+VH1=plugin://plugin.video.yousee.tv/?channel=37
+VH1 Classic=plugin://plugin.video.yousee.tv/?channel=113
+VOX=plugin://plugin.video.yousee.tv/?channel=57
+Viasat Explorer=plugin://plugin.video.yousee.tv/?channel=131
+Viasat Film=plugin://plugin.video.yousee.tv/?channel=109
+Viasat Film Action=plugin://plugin.video.yousee.tv/?channel=104
+Viasat Film Classic=plugin://plugin.video.yousee.tv/?channel=108
+Viasat Film Drama=plugin://plugin.video.yousee.tv/?channel=105
+Viasat Film Family=plugin://plugin.video.yousee.tv/?channel=106
+Viasat Film Nordic=plugin://plugin.video.yousee.tv/?channel=107
+Viasat Golf=plugin://plugin.video.yousee.tv/?channel=138
+Viasat History=plugin://plugin.video.yousee.tv/?channel=130
+Viasat Nature Crime=plugin://plugin.video.yousee.tv/?channel=95
+ZDF=plugin://plugin.video.yousee.tv/?channel=52
+ZDF HD=plugin://plugin.video.yousee.tv/?channel=69
+Zone Reality=plugin://plugin.video.yousee.tv/?channel=116
View
2  resources/language/Danish/strings.xml
@@ -68,6 +68,8 @@
<string id="30502">Gem</string>
<string id="30503">Annuller</string>
+ <string id="30601">.strm fil</string>
+
<!-- weeb.tv mod -->
<string id="30800">JSON-EPG URL</string>
<string id="30801">Afspil kanaler via Weeb.Tv addon</string>
View
13 resources/language/English/strings.xml
@@ -68,6 +68,19 @@
<string id="30502">Save</string>
<string id="30503">Cancel</string>
+ <string id="30600">[B]Setup stream[/B]</string>
+ <string id="30601">.strm file</string>
+ <string id="30602">Favourites</string>
+ <string id="30603">Addons</string>
+ <string id="30604">Preview stream</string>
+ <string id="30605">Save</string>
+ <string id="30606">Cancel</string>
+
+ <string id="30610">Browse...</string>
+ <string id="30611">Click Browse... below and navigate to your stream file. When you have chosen your file you can preview the stream to test if it works in XBMC.</string>
+
+ <string id="30620">Choose a favourite below. Only [I]PlayMedia[/I] favourites are supported.</string>
+
<!-- weeb.tv mod -->
<string id="30800">JSON-EPG URL</string>
<string id="30801">Play channels using the Weeb.Tv addon</string>
View
523 resources/skins/Default/720p/script-tvguide-streamsetup.xml
@@ -0,0 +1,523 @@
+<?xml version="1.0" encoding="utf-8"?>
+<window type="dialog" id="3004">
+ <allowoverlay>no</allowoverlay>
+ <defaultcontrol always="false">101</defaultcontrol>
+ <coordinates>
+ <system>1</system>
+ <posx>0</posx>
+ <posy>0</posy>
+ </coordinates>
+ <animation effect="fade" start="0" end="100" time="250">WindowOpen</animation>
+ <animation effect="fade" start="100" end="0" time="250">WindowClose</animation>
+ <controls>
+ <control type="label" id="100">
+ <description>tabs visibility marker</description>
+ <visible>false</visible>
+ </control>
+
+
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>1280</width>
+ <height>720</height>
+ <texture>tvguide-background-default.jpg</texture>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>1280</width>
+ <height>720</height>
+ <texture>tvguide-glasspane.png</texture>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>1280</width>
+ <height>720</height>
+ <texture>tvguide-glasspane.png</texture>
+ </control>
+
+ <control type="label">
+ <posx>253</posx>
+ <posy>20</posy>
+ <width>174</width>
+ <height>40</height>
+ <label>$ADDON[script.tvguide 30600]</label>
+ <align>center</align>
+ </control>
+
+ <control type="button" id="101">
+ <posx>60</posx>
+ <posy>60</posy>
+ <width>173</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30601]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onleft>103</onleft>
+ <onright>102</onright>
+ <ondown>1001</ondown>
+ </control>
+ <control type="button" id="102">
+ <posx>253</posx>
+ <posy>60</posy>
+ <width>174</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30602]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onleft>101</onleft>
+ <onright>103</onright>
+ <ondown>2001</ondown>
+ </control>
+ <control type="button" id="103">
+ <posx>447</posx>
+ <posy>60</posy>
+ <width>173</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30603]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onleft>102</onleft>
+ <onright>101</onright>
+ <ondown>3001</ondown>
+ </control>
+
+ <control type="videowindow">
+ <posx>650</posx>
+ <posy>130</posy>
+ <width>600</width>
+ <height>330</height>
+ </control>
+
+ <control type="group" id="1000">
+ <posx>40</posx>
+ <posy>120</posy>
+ <width>800</width>
+ <height>340</height>
+ <visible>StringCompare(Control.GetLabel(100),strm)</visible>
+
+ <control type="textbox">
+ <posx>20</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>80</height>
+ <label>$ADDON[script.tvguide 30611]</label>
+ <wrapmultiline>true</wrapmultiline>
+ </control>
+
+ <control type="button" id="1001">
+ <posx>20</posx>
+ <posy>100</posy>
+ <width>173</width>
+ <height>40</height>
+ <label>$ADDON[script.tvguide 30610]</label>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>101</onup>
+ <onright>1002</onright>
+ <ondown>1002</ondown>
+ </control>
+
+ <control type="textbox" id="1005">
+ <posx>20</posx>
+ <posy>160</posy>
+ <width>560</width>
+ <height>80</height>
+ <wrapmultiline>true</wrapmultiline>
+ </control>
+
+
+ <control type="button" id="1002">
+ <posx>640</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30604]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>101</onup>
+ <onleft>1001</onleft>
+ <onright>1003</onright>
+ </control>
+ <control type="button" id="1003">
+ <posx>830</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30605]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>101</onup>
+ <onleft>1002</onleft>
+ <onright>1004</onright>
+ </control>
+ <control type="button" id="1004">
+ <posx>1020</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30606]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>101</onup>
+ <onleft>1003</onleft>
+ </control>
+
+ </control>
+
+ <control type="group" id="2000">
+ <posx>40</posx>
+ <posy>120</posy>
+ <width>800</width>
+ <height>340</height>
+ <visible>StringCompare(Control.GetLabel(100),favourites)</visible>
+
+ <control type="textbox">
+ <posx>20</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>80</height>
+ <label>$ADDON[script.tvguide 30620]</label>
+ <wrapmultiline>true</wrapmultiline>
+ </control>
+
+ <control type="list" id="2001">
+ <posx>20</posx>
+ <posy>75</posy>
+ <width>560</width>
+ <height>480</height>
+ <viewtype label="list">list</viewtype>
+ <orientation>vertical</orientation>
+ <focusposition>7</focusposition>
+ <onleft>102</onleft>
+ <onright>2002</onright>
+
+ <itemlayout width="560" height="40">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <texture>tvguide-program-grey.png</texture>
+ </control>
+ <control type="label">
+ <posx>16</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </itemlayout>
+ <focusedlayout width="560" height="40">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <texture>tvguide-program-grey.png</texture>
+ <visible>!Control.HasFocus(2001)</visible>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <texture>tvguide-program-grey-focus.png</texture>
+ <visible>Control.HasFocus(2001)</visible>
+ </control>
+ <control type="label">
+ <posx>16</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </focusedlayout>
+ </control>
+
+ <control type="button" id="2002">
+ <posx>640</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30604]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>102</onup>
+ <onleft>2001</onleft>
+ <onright>2003</onright>
+ </control>
+ <control type="button" id="2003">
+ <posx>830</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30605]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>102</onup>
+ <onleft>2002</onleft>
+ <onright>2004</onright>
+ </control>
+ <control type="button" id="2004">
+ <posx>1020</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30606]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>102</onup>
+ <onleft>2003</onleft>
+ </control>
+
+ </control>
+
+
+ <control type="group" id="3000">
+ <posx>40</posx>
+ <posy>120</posy>
+ <width>1280</width>
+ <height>600</height>
+ <visible>StringCompare(Control.GetLabel(100),addons)</visible>
+
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>12</width>
+ <height>212</height>
+ <texture>tvguide-channel-leftarrow.png</texture>
+ </control>
+
+ <control type="wraplist" id="3001">
+ <posx>20</posx>
+ <posy>0</posy>
+ <width>212</width>
+ <height>212</height>
+ <viewtype label="list">list</viewtype>
+ <orientation>horizontal</orientation>
+ <focusposition>0</focusposition>
+ <onup>103</onup>
+ <ondown>3002</ondown>
+
+ <itemlayout width="212" height="212">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>212</width>
+ <height>212</height>
+ <texture>tvguide-program-grey.png</texture>
+ </control>
+ <control type="image">
+ <posx>10</posx>
+ <posy>10</posy>
+ <width>192</width>
+ <height>192</height>
+ <info>ListItem.Icon</info>
+ </control>
+ </itemlayout>
+ <focusedlayout width="212" height="212">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>212</width>
+ <height>212</height>
+ <texture>tvguide-program-grey.png</texture>
+ <visible>!Control.HasFocus(3001)</visible>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>212</width>
+ <height>212</height>
+ <texture>tvguide-program-grey-focus.png</texture>
+ <visible>Control.HasFocus(3001)</visible>
+ </control>
+ <control type="image">
+ <posx>10</posx>
+ <posy>10</posy>
+ <width>192</width>
+ <height>192</height>
+ <info>ListItem.Icon</info>
+ </control>
+ </focusedlayout>
+ </control>
+
+ <control type="label" id="3003">
+ <posx>250</posx>
+ <posy>0</posy>
+ <width>330</width>
+ <height>40</height>
+ <label>[B]plugin.video.xxx[/B]</label>
+ </control>
+ <control type="textbox" id="3004">
+ <posx>250</posx>
+ <posy>40</posy>
+ <width>330</width>
+ <height>170</height>
+ <label>description...</label>
+ <wrapmultiline>true</wrapmultiline>
+ <autoscroll time="3600" delay="6000" repeat="6000">true</autoscroll>
+ </control>
+
+ <control type="list" id="3002">
+ <posx>20</posx>
+ <posy>235</posy>
+ <width>560</width>
+ <height>320</height>
+ <viewtype label="list">list</viewtype>
+ <orientation>vertical</orientation>
+ <focusposition>7</focusposition>
+ <onleft>3001</onleft>
+ <onright>3005</onright>
+
+ <itemlayout width="560" height="40">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <texture>tvguide-program-grey.png</texture>
+ </control>
+ <control type="label">
+ <posx>16</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </itemlayout>
+ <focusedlayout width="560" height="40">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <texture>tvguide-program-grey.png</texture>
+ <visible>!Control.HasFocus(3002)</visible>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <texture>tvguide-program-grey-focus.png</texture>
+ <visible>Control.HasFocus(3002)</visible>
+ </control>
+ <control type="label">
+ <posx>16</posx>
+ <posy>0</posy>
+ <width>560</width>
+ <height>38</height>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <info>ListItem.Label</info>
+ </control>
+ </focusedlayout>
+ </control>
+
+ <control type="button" id="3005">
+ <posx>640</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30604]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>103</onup>
+ <onleft>3002</onleft>
+ <onright>3006</onright>
+ </control>
+ <control type="button" id="3006">
+ <posx>830</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30605]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>103</onup>
+ <onleft>3005</onleft>
+ <onright>3007</onright>
+ </control>
+ <control type="button" id="3007">
+ <posx>1020</posx>
+ <posy>515</posy>
+ <width>170</width>
+ <height>40</height>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font13</font>
+ <textcolor>ffffffff</textcolor>
+ <label>$ADDON[script.tvguide 30606]</label>
+ <texturefocus>tvguide-program-grey-focus.png</texturefocus>
+ <texturenofocus>tvguide-program-grey.png</texturenofocus>
+ <onup>103</onup>
+ <onleft>3006</onleft>
+ </control>
+
+ </control>
+
+
+ </controls>
+</window>
View
19 service.py
@@ -22,20 +22,17 @@
import xbmc
import source as src
-ADDON = xbmcaddon.Addon(id = 'script.tvguide')
-source = src.instantiateSource(ADDON)
-if ADDON.getSetting('cache.data.on.xbmc.startup') == 'true':
- try:
+try:
+ ADDON = xbmcaddon.Addon(id = 'script.tvguide')
+ source = src.instantiateSource(ADDON)
+ if ADDON.getSetting('cache.data.on.xbmc.startup') == 'true':
channelList = None
if source._isChannelListCacheExpired():
channelList = source.updateChannelAndProgramListCaches()
- except Exception, ex:
- xbmc.log('[script.tvguide] Unable to update caches: %s' % str(ex) , xbmc.LOGDEBUG)
-
-if ADDON.getSetting('notifications.enabled') == 'true':
- try:
+ if ADDON.getSetting('notifications.enabled') == 'true':
n = notification.Notification(source, ADDON.getAddonInfo('path'))
n.scheduleNotifications()
- except Exception, ex:
- xbmc.log('[script.tvguide] Unable to schedules notifications: %s' % str(ex), xbmc.LOGDEBUG)
+
+except Exception, ex:
+ xbmc.log('[script.tvguide] Uncaugt exception in service.py: %s' % str(ex) , xbmc.LOGDEBUG)
View
15 source.py
@@ -481,9 +481,13 @@ def play(self, channel, playBackStoppedHandler):
def playInThread(self, channel, playBackStoppedHandler):
customStreamUrl = self.getCustomStreamUrl(channel)
if customStreamUrl:
- customStreamUrl = customStreamUrl.encode('utf-8', 'ignore')
- xbmc.log("Playing custom stream url: %s" % customStreamUrl)
- self.player.play(item = customStreamUrl, windowed=True)
+ if customStreamUrl[0:9] == 'PlayMedia' or customStreamUrl[0:14] == 'ActivateWindow':
+ xbmc.log("Playing custom url using executebuiltin: %s" % customStreamUrl)
+ xbmc.executebuiltin(customStreamUrl)
+ else:
+ customStreamUrl = customStreamUrl.encode('utf-8', 'ignore')
+ xbmc.log("Playing custom stream url: %s" % customStreamUrl)
+ self.player.play(item = customStreamUrl, windowed=True)
elif channel.isPlayable():
streamUrl = channel.streamUrl.encode('utf-8', 'ignore')
@@ -726,6 +730,9 @@ def __init__(self, addon, cachePath):
xbmc.log('[script.tvguide] Caching XMLTV file...')
xbmcvfs.copy(addon.getSetting('xmltv.file'), tempFile)
+ if not os.path.exists(tempFile):
+ raise SourceException('XML TV file was not cached, does it exist?')
+
# if xmlTvFile doesn't exists or the file size is different from tempFile
# we copy the tempFile to xmlTvFile which in turn triggers a reload in self._isChannelListCacheExpired(..)
if not os.path.exists(self.xmlTvFile) or os.path.getsize(self.xmlTvFile) != os.path.getsize(tempFile):
@@ -904,7 +911,7 @@ def parseXMLTV(context, f, size, logoFolder, progress_callback):
title = elem.findtext("display-name")
logo = None
if logoFolder:
- logoFile = os.path.join(logoFolder, title + '.png')
+ logoFile = os.path.join(logoFolder.encode('utf-8', 'ignore'), title.encode('utf-8', 'ignore') + '.png')
if xbmcvfs.exists(logoFile):
logo = logoFile
if not logo:
View
21 ysapi.py
@@ -76,7 +76,7 @@ def categories(self):
"""
return self._invoke(AREA_TVGUIDE, 'categories')
- def programs(self, channelId, offset = None, tvdate = None):
+ def programs(self, channelId= None, offset = None, tvdate = None):
"""
Returns program list
@@ -87,7 +87,8 @@ def programs(self, channelId, offset = None, tvdate = None):
"""
params = dict()
- params['channel_id'] = channelId
+ if channelId is not None:
+ params['channel_id'] = channelId
if tvdate is not None:
params['tvdate'] = tvdate.strftime('%Y-%m-%d')
elif offset is not None:
@@ -99,8 +100,18 @@ def programs(self, channelId, offset = None, tvdate = None):
if __name__ == '__main__':
api = YouSeeTVGuideApi()
- json = api.programs(1)
+ json = api.channels()
- s = simplejson.dumps(json, sort_keys=True, indent=' ')
- print '\n'.join([l.rstrip() for l in s.splitlines()])
+ entries = dict()
+
+ for channels in json:
+ for channel in channels['channels']:
+ if not entries.has_key(channel['name']):
+ entries[channel['name']] = 'plugin://plugin.video.yousee.tv/?channel=%s' % channel['id']
+
+ for e in sorted(entries.keys()):
+ print e + '=' + entries[e]
+
+ #s = simplejson.dumps(json, sort_keys=True, indent=' ')
+ #print '\n'.join([l.rstrip() for l in s.splitlines()])
Please sign in to comment.
Something went wrong with that request. Please try again.