The branch, dharma has been updated
via 96f3b271e9198bdffa7a3f05ec132722cfd1e080 (commit)
from 51ba046ef9eec39656e0fa8f4b86774c089fb526 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=96f3b271e9198bdffa7a3f05ec132722cfd1e080
commit 96f3b271e9198bdffa7a3f05ec132722cfd1e080
Author: spiff <[email protected]>
Date: Fri May 11 09:36:13 2012 +0200
[plugin.video.sarpur] updated to version 1.1.1
diff --git a/plugin.video.sarpur/addon.xml b/plugin.video.sarpur/addon.xml
old mode 100644
new mode 100755
index 8965ae8..1e1dad2
--- a/plugin.video.sarpur/addon.xml
+++ b/plugin.video.sarpur/addon.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.sarpur"
name="Sarpur"
- version="1.0.1"
- provider-name="dagur">
+ version="1.1.1"
+ provider-name="Dagur">
<requires>
<import addon="xbmc.python" version="1.0"/>
<import addon="script.module.beautifulsoup" version="3.0.8"/>
diff --git a/plugin.video.sarpur/changelog.txt
b/plugin.video.sarpur/changelog.txt
index 4ec35bf..4e5a71d 100644
--- a/plugin.video.sarpur/changelog.txt
+++ b/plugin.video.sarpur/changelog.txt
@@ -1,3 +1,15 @@
+[B]Version 1.1.1[/B]
+New:
+- Live stream should work at least for a while
+- Categories working again
+- Submitting to Eden
+
+[B]Version 1.1.0[/B]
+New:
+- Podcasts
+- Eden support
+
+
[B]Version 1.0.1[/B]
Bugfixes:
- Fixed the way data files are being created and dealt with them becoming
corrupt
diff --git a/plugin.video.sarpur/default.py b/plugin.video.sarpur/default.py
old mode 100644
new mode 100755
index 777b1aa..2c9429a
--- a/plugin.video.sarpur/default.py
+++ b/plugin.video.sarpur/default.py
@@ -1,125 +1,148 @@
#!/usr/bin/env python
-import urllib, urllib2, re, xbmcplugin, xbmcgui, xbmc
+import urllib, urllib2, re, xbmcplugin, xbmcgui, xbmc, math, random
from datetime import datetime, timedelta
-from scraper import showtree, tabs, get_episodes, get_stream_info,
get_latest_episodes
+from scraper import showtree, tabs, get_episodes, get_stream_info,
get_latest_episodes, get_podcast_shows, get_podcast_recordings
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3)
Gecko/2008092417 Firefox/3.0.3'
action_key = None
action_value = None
name = None
-
def forsida():
- for tab in tabs:
- title, url = tab
- addDir(title.encode('utf-8'), 'nytt', url)
- for i,stod in enumerate(showtree):
- title = u'%s \xfe\xe6ttir' % stod['name']
- addDir(title.encode('utf-8'), 'stod', i)
-# addDir(u'V\xf6ktun K\xf6tlu'.encode('utf-8'), 'eldfjall', 'katla')
- addDir(u'Bein \xfatsending R\xdaV'.encode('utf-8'), 'spila',
'http://www.ruv.is/ruv')
+ for tab in tabs:
+ title, url = tab
+ addDir(title.encode('utf-8'), 'nytt', url)
+ for i,stod in enumerate(showtree):
+ title = u'%s \xfe\xe6ttir' % stod['name']
+ addDir(title.encode('utf-8'), 'stod', i)
+ addDir(u'Hla\xf0varp'.encode('utf-8'), 'hladvarp', '')
+ addDir(u'Bein \xfatsending R\xdaV'.encode('utf-8'), 'spila_live', 'ruv')
def nytt(flokkur):
- pageurl = u'http://www.ruv.is%s' % flokkur
- for name, url in get_latest_episodes(pageurl.encode('utf-8')):
- addDir(name.encode('utf-8'), 'spila', url.encode('utf-8'))
+ pageurl = u'http://www.ruv.is%s' % flokkur
+ for name, url in get_latest_episodes(pageurl.encode('utf-8')):
+ addDir(name.encode('utf-8'), 'spila', url.encode('utf-8'))
def flokkar(stod):
- for i, flokkur in enumerate(showtree[stod]['categories']):
- addDir(flokkur['name'].encode('utf-8'), 'flokkur', "%d;%d" %
(stod,i))
+ for i, flokkur in enumerate(showtree[stod]['categories']):
+ addDir(flokkur['name'].encode('utf-8'), 'flokkur', "%d;%d" % (stod,i))
def thaettir(stod, flokkur):
- for show in showtree[stod]['categories'][flokkur][u'shows']:
- name, url = show
- if url[0] == '/':
- url = 'http://dagskra.ruv.is%s' % url
- addDir(name.encode('utf-8'), 'thattur', url.encode('utf-8'))
+ for show in showtree[stod]['categories'][flokkur][u'shows']:
+ name, url = show
+ if url[0] == '/':
+ url = 'http://dagskra.ruv.is%s' % url
+ addDir(name.encode('utf-8'), 'thattur', url.encode('utf-8'))
def upptokur(url):
- episodes = get_episodes(url)
- if not episodes:
- w = xbmcgui.Dialog()
- w.ok(u"Engar uppt\xf6kur".encode('utf-8'),
- u"Engar uppt\xf6kur eru \xed bo\xf0i fyrir \xfeennan
\xfe\xe1tt.".encode('utf-8'))
- else:
- for episode in episodes:
- name, url = episode
- addDir(name.encode('utf-8'), 'spila', url,
"DefaultVideo.png")
+ episodes = get_episodes(url)
+ if not episodes:
+ w = xbmcgui.Dialog()
+ w.ok(u"Engar uppt\xf6kur".encode('utf-8'),
+ u"Engar uppt\xf6kur eru \xed bo\xf0i fyrir \xfeennan
\xfe\xe1tt.".encode('utf-8'))
+ else:
+ for episode in episodes:
+ name, url = episode
+ addDir(name.encode('utf-8'), 'spila', url, "DefaultVideo.png")
+
+def hladvarp(thattur):
+ if thattur:
+ for recording in get_podcast_recordings(thattur):
+ name, recording_url = recording
+ addDir(name.encode('utf-8'), 'spila_hladvarp', recording_url,
"DefaultAudio.png")
+ else:
+ for show in get_podcast_shows():
+ name, url = show
+ addDir(name.encode('utf-8'), 'hladvarp', url, "DefaultFolder.png")
+
def spila(url):
- stream_info = get_stream_info(url)
+ stream_info = get_stream_info(url)
#rtmpdump -r rtmp://178.19.48.74/ruvvod?key=93292 -a vod -y
mp4:ruvvod/4621116.f4v -o dagur.f4v
- #playpath = "mp4:ruvvod/4621116.f4v"
- #rtmp_url = "rtmp://178.19.48.74/ruvvod?key=93292"
- item = xbmcgui.ListItem("RTL")
- item.setProperty("PlayPath", stream_info['playpath'])
- item.setProperty("SWFPlayer",
"http://www.ruv.is/files/spilari/player.swf")
- item.setProperty("PageURL", url)
- xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(stream_info['rtmp_url'],
item)
-
-def eldfjall(nafn):
- url = "http://www.ruv.is/%s/" % nafn
- item = xbmcgui.ListItem("RTL")
- #item.setProperty("PlayPath",
"rtsp://10.31.98.2:554/axis-media/media.amp?videocodec=h264&resolution=4CIF&compression=25&textstring=R%DAV%20-%20KATLA%20S%C9%D0%20FR%C1%20H%C1FELLI&textposition=bottom&text=1&clock=1&date=1&overlayimage=0&fps=15&audio=0&videokeyframeinterval=30&videobitrate=250&videobitratepriority=framerate&squarepixel=0&videocodec=h264&rotation=0")
- item.setProperty("SWFPlayer",
"http://uppfaersla.ruv.is/files/spilari/player.swf")
- item.setProperty("PageURL", url)
-
#xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play("rtmp://vefur-vod.ruv.is/katla",
item)
-
xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play("rtsp://10.31.98.2:554/axis-media/media.amp?videocodec=h264&resolution=4CIF&compression=25&textstring=R%DAV%20-%20KATLA%20S%C9%D0%20FR%C1%20H%C1FELLI&textposition=bottom&text=1&clock=1&date=1&overlayimage=0&fps=15&audio=0&videokeyframeinterval=30&videobitrate=250&videobitratepriority=framerate&squarepixel=0&videocodec=h264&rotation=0",
item)
+ #playpath = "mp4:ruvvod/4621116.f4v"
+ #rtmp_url = "rtmp://178.19.48.74/ruvvod?key=93292"
+ item = xbmcgui.ListItem("RTL")
+ item.setProperty("PlayPath", stream_info['playpath'])
+ item.setProperty("SWFPlayer", "http://www.ruv.is/files/spilari/player.swf")
+ item.setProperty("PageURL", url)
+ xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(stream_info['rtmp_url'], item)
+
+def spila_hladvarp(url):
+ xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(url)
+
+def spila_live(stod):
+ stream_info = {}
+ #if stod == 'ruv':
+ #stream_info['playpath'] =
'http://194.144.162.36:1935/ruv/beint-2/playlist.m3u8?key=%d' %
int(math.floor(random.random() * 9999))
+ stream_info['playpath'] = 'beint-2'
+ stream_info['rtmp_url'] = 'rtmp://178.19.48.171/ruv?key=%d' %
int(math.floor(random.random() * 9999))
+ stream_info['page_url'] = 'http://ruv.is/ruv'
+
+ item = xbmcgui.ListItem("RTL")
+ item.setProperty("PlayPath", stream_info['playpath'])
+ item.setProperty("SWFPlayer", "http://www.ruv.is/files/spilari/player.swf")
+ item.setProperty("PageURL", stream_info['page_url'])
+ xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(stream_info['rtmp_url'], item)
+
+
def get_params():
- param=[]
- paramstring=sys.argv[2]
- if len(paramstring)>=2:
- params=sys.argv[2]
- cleanedparams=params.replace('?','')
- if (params[len(params)-1]=='/'):
- params=params[0:len(params)-2]
- pairsofparams=cleanedparams.split('&')
- param={}
- for i in range(len(pairsofparams)):
- splitparams={}
- splitparams=pairsofparams[i].split('=')
- if (len(splitparams))==2:
- param[splitparams[0]]=splitparams[1]
+ param=[]
+ paramstring=sys.argv[2]
+ if len(paramstring)>=2:
+ params=sys.argv[2]
+ cleanedparams=params.replace('?','')
+ if (params[len(params)-1]=='/'):
+ params=params[0:len(params)-2]
+ pairsofparams=cleanedparams.split('&')
+ param={}
+ for i in range(len(pairsofparams)):
+ splitparams={}
+ splitparams=pairsofparams[i].split('=')
+ if (len(splitparams))==2:
+ param[splitparams[0]]=splitparams[1]
- return param
+ return param
def addDir(name, action_key, action_value, iconimage='DefaultFolder.png'):
- is_folder = True
- if action_key == 'spila':
- is_folder = False
-
u=sys.argv[0]+"?action_key="+urllib.quote_plus(action_key)+"&action_value="+str(action_value)+"&name="+urllib.quote_plus(name)
- liz=xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage='')
- liz.setInfo(type="Video", infoLabels={ "Title": name } )
- return
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=is_folder)
+ is_folder = True
+ if action_key[:5] == 'spila':
+ is_folder = False
+
u=sys.argv[0]+"?action_key="+urllib.quote_plus(action_key)+"&action_value="+str(action_value)+"&name="+urllib.quote_plus(name)
+ liz=xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage='')
+ liz.setInfo(type="Video", infoLabels={ "Title": name } )
+ return
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=is_folder)
params=get_params()
try:
- action_key = urllib.unquote_plus(params["action_key"])
- action_value = urllib.unquote_plus(params["action_value"])
- name = urllib.unquote_plus(params["name"])
+ action_key = urllib.unquote_plus(params["action_key"])
+ action_value = urllib.unquote_plus(params["action_value"])
+ name = urllib.unquote_plus(params["name"])
except:
- pass
+ pass
-print action_key
-print action_value
+print "action_key: %s - action_value: %s" % (action_key, action_value)
if action_key is None:
- forsida()
+ forsida()
elif action_key == 'stod':
- flokkar(int(action_value))
+ flokkar(int(action_value))
elif action_key == 'flokkur':
- stod, flokkur = action_value.split(';')
- thaettir(int(stod), int(flokkur))
+ stod, flokkur = action_value.split(';')
+ thaettir(int(stod), int(flokkur))
elif action_key == 'thattur':
- upptokur(action_value)
+ upptokur(action_value)
elif action_key == 'spila':
- spila(action_value)
+ spila(action_value)
elif action_key == 'nytt':
- nytt(action_value)
-elif action_key == 'eldfjall':
- eldfjall(action_value)
-
+ nytt(action_value)
+elif action_key == 'hladvarp':
+ hladvarp(action_value)
+elif action_key == 'spila_hladvarp':
+ spila_hladvarp(action_value)
+elif action_key == 'spila_live':
+ spila_live(action_value)
+
xbmcplugin.endOfDirectory(int(sys.argv[1]))
diff --git a/plugin.video.sarpur/icon.png b/plugin.video.sarpur/icon.png
old mode 100644
new mode 100755
diff --git a/plugin.video.sarpur/scraper.py b/plugin.video.sarpur/scraper.py
old mode 100644
new mode 100755
index c9baac7..c0f9890
--- a/plugin.video.sarpur/scraper.py
+++ b/plugin.video.sarpur/scraper.py
@@ -1,11 +1,12 @@
#!/usr/bin/env python
-import urllib2, re, os
+import urllib2, re, os, xbmcaddon
from BeautifulSoup import BeautifulSoup
from datetime import datetime
import simplejson as json
+addon = xbmcaddon.Addon(id='plugin.video.sarpur')
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3)
Gecko/2008092417 Firefox/3.0.3'
-data_path = os.path.join(os.getcwd(), 'resources','data')
+data_path = os.path.join(addon.getAddonInfo('path'), 'resources','data')
showtreefile_location = os.path.join(data_path,'showtree.dat')
tabfile_location = os.path.join(data_path,'tabs.dat')
showtree = [] #All the shows under the thaettir menu
@@ -47,9 +48,6 @@ def parse_show_index(html):
for show in flokkur.findAll("div"):
showtree[i]["categories"][-1]['shows'].append((show.a.contents[0],
show.a['href']))
-
-
-
def get_episodes(url):
"Find playable files on a shows page"
episodes = []
@@ -79,8 +77,8 @@ def get_latest_episodes(url):
soup = BeautifulSoup(html)
spilari = soup.find("div", attrs={'class':'kubbur sarpefst'})
- dags = re.search(r'\d{1,2}\. \w{3} \d{4} \|
\d\d:\d\d',repr(spilari)).group()
- featured = "%s %s" % (spilari.h1.contents[0], dags)
+ #dags = re.search(r'\d{1,2}\. \w{3} \d{4} \| \d\d:\d\d',repr(spilari),
re.UNICODE).group()
+ featured = spilari.h1.contents[0]
episodes = [(featured, url)]
@@ -91,8 +89,6 @@ def get_latest_episodes(url):
return episodes
-
-
def get_stream_info(page_url):
"Get a page url and finds the url of the rtmp stream"
html = fetch_page(page_url)
@@ -117,6 +113,33 @@ def update_index():
get_tabs()
json.dump(tabs, file(tabfile_location,'wb'))
+def get_podcast_shows():
+ """Gets the names and rss urls of all the Podcasts"""
+ html = fetch_page("http://www.ruv.is/podcast")
+ soup = BeautifulSoup(html)
+
+ shows = []
+
+ for ul in soup.findAll("ul", attrs={'class':'hladvarp-info'}):
+ title = ul('li')[1].h4.contents[0]
+ pageurl = ul('li')[4].a['href']
+ shows.append((title , pageurl))
+
+ return shows
+
+def get_podcast_recordings(url):
+ """Gets the dates and mp3 urls of all the Podcast recordings"""
+ html = fetch_page(url)
+ soup = BeautifulSoup(html)
+ recordings = []
+
+ for item in soup.findAll('item'):
+ date = item.pubdate.contents[0]
+ url = item.guid.contents[0]
+ recordings.append((date,url))
+
+ return recordings
+
## init
try:
delta = datetime.now() -
datetime.fromtimestamp(os.path.getmtime(showtreefile_location))
-----------------------------------------------------------------------
Summary of changes:
plugin.video.sarpur/addon.xml | 4 +-
plugin.video.sarpur/changelog.txt | 12 +++
plugin.video.sarpur/default.py | 193 +++++++++++++++++++++----------------
plugin.video.sarpur/icon.png | Bin 8462 -> 8462 bytes
plugin.video.sarpur/scraper.py | 41 ++++++--
5 files changed, 154 insertions(+), 96 deletions(-)
mode change 100644 => 100755 plugin.video.sarpur/addon.xml
mode change 100644 => 100755 plugin.video.sarpur/default.py
mode change 100644 => 100755 plugin.video.sarpur/icon.png
mode change 100644 => 100755 plugin.video.sarpur/scraper.py
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons