The branch, eden has been updated
via dca0340e49ace254ba658ee65fbd5e977c7dd835 (commit)
via 28e30a008f182784331b38763bfc7a03b471b661 (commit)
from 0b54be09e2bf6bd54b33167e012da639b6097f98 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=dca0340e49ace254ba658ee65fbd5e977c7dd835
commit dca0340e49ace254ba658ee65fbd5e977c7dd835
Author: spiff <[email protected]>
Date: Tue Aug 21 16:52:35 2012 +0200
[plugin.audio.groove] updated to version 1.0.6
diff --git a/plugin.audio.groove/addon.xml b/plugin.audio.groove/addon.xml
index dca6d04..1a77971 100644
--- a/plugin.audio.groove/addon.xml
+++ b/plugin.audio.groove/addon.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.audio.groove" name="Grooveshark XBMC"
- version="1.0.3" provider-name="Stephen Denham">
+ version="1.0.6" provider-name="Stephen Denham">
<requires>
<import addon="xbmc.python" version="2.0" />
<import addon="script.module.simplejson"/>
diff --git a/plugin.audio.groove/changelog.txt
b/plugin.audio.groove/changelog.txt
index deea963..064b934 100644
--- a/plugin.audio.groove/changelog.txt
+++ b/plugin.audio.groove/changelog.txt
@@ -1,3 +1,15 @@
+1.0.6
+
+Fix play next issue.
+
+1.0.5
+
+Fix IP address.
+
+1.0.4
+
+Fix playlist name encoding bug.
+
1.0.3
Fix bug in album song name.
diff --git a/plugin.audio.groove/default.py b/plugin.audio.groove/default.py
index ab1f436..3a5551c 100644
--- a/plugin.audio.groove/default.py
+++ b/plugin.audio.groove/default.py
@@ -482,59 +482,75 @@ class Grooveshark:
global player
player.stop()
if item != None:
+ # Get stream as it could have expired
+ item.select(True)
url = ''
songid = item.getProperty('songid')
- duration = int(self._getSongDuration(songid))
stream = groovesharkApi.getSubscriberStreamKey(songid)
if stream != False:
url = stream['url']
key = stream['StreamKey']
server = stream['StreamServerID']
- duration = self._setDuration(stream['uSecs'])
- if url != '':
- item.setPath(url)
- xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]),
succeeded=True, listitem=item)
- if __debugging__ :
- xbmc.log("Grooveshark playing: " + url)
- # Wait for play then start timer
- seconds = 0
- while seconds < STREAM_TIMEOUT:
- try:
- if player.isPlayingAudio() == True:
- if playTimer != None:
- playTimer.cancel()
- songMarkTime = 0
- playTimer = PlayTimer(1, markSong, duration,
[songid, duration, key, server])
- playTimer.start()
- break
- except: pass
- time.sleep(1)
- seconds = seconds + 1
+ duration = int(self._setDuration(stream['uSecs']))
+ stream = [songid, duration, url, key, server]
+ self._setSongStream(stream)
+ if url != '':
+ item.setPath(url)
+ xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]),
succeeded=True, listitem=item)
+ if __debugging__ :
+ xbmc.log("Grooveshark playing: " + url)
+ # Wait for play then start timer
+ seconds = 0
+ while seconds < STREAM_TIMEOUT:
+ try:
+ if player.isPlayingAudio() == True:
+ if playTimer != None:
+ playTimer.cancel()
+ songMarkTime = 0
+ playTimer = PlayTimer(1, markSong,
self._setDuration(duration), [songid, duration, key, server])
+ playTimer.start()
+ break
+ except: pass
+ time.sleep(1)
+ seconds = seconds + 1
+ else:
+ xbmc.log("No song URL")
else:
- xbmc.log("No song URL")
+ xbmc.log("No song stream")
else:
xbmc.executebuiltin('XBMC.Notification(' + __language__(30008) +
', ' + __language__(30044) + ', 1000, ' + thumbDef + ')')
# Make a song directory item
- def songItem(self, songid, name, album, artist, coverart,
trackLabelFormat=ARTIST_ALBUM_NAME_LABEL):
- songImg = self._get_icon(coverart, 'song-' + str(songid) + "-image")
- if int(trackLabelFormat) == NAME_ALBUM_ARTIST_LABEL:
- trackLabel = name + " - " + album + " - " + artist
- else:
- trackLabel = artist + " - " + album + " - " + name
- duration = self._getSongDuration(songid)
- item = xbmcgui.ListItem(label = trackLabel, thumbnailImage=songImg,
iconImage=songImg)
- item.setInfo( type="music", infoLabels={ "title": name, "album":
album, "artist": artist, "duration": duration} )
- item.setProperty('mimetype', 'audio/mpeg')
- item.setProperty("IsPlayable", "true")
- item.setProperty('songid', str(songid))
- item.setProperty('coverart', songImg)
- item.setProperty('title', name)
- item.setProperty('album', album)
- item.setProperty('artist', artist)
- item.setProperty('duration', str(duration))
+ def songItem(self, songid, name, album, artist, coverart,
trackLabelFormat=ARTIST_ALBUM_NAME_LABEL, tracknumber=1):
- return item
+ stream = self._getSongStream(songid)
+ if stream != False:
+ duration = stream[1]
+ url = stream[2]
+ key = stream[3]
+ server = stream[4]
+ songImg = self._get_icon(coverart, 'song-' + str(songid) +
"-image")
+ if int(trackLabelFormat) == NAME_ALBUM_ARTIST_LABEL:
+ trackLabel = name + " - " + album + " - " + artist
+ else:
+ trackLabel = artist + " - " + album + " - " + name
+ item = xbmcgui.ListItem(label = trackLabel,
thumbnailImage=songImg, iconImage=songImg)
+ item.setPath(url)
+ item.setInfo( type="music", infoLabels={ "title": name, "album":
album, "artist": artist, "duration": duration, "tracknumber" : tracknumber} )
+ item.setProperty('mimetype', 'audio/mpeg')
+ item.setProperty("IsPlayable", "true")
+ item.setProperty('songid', str(songid))
+ item.setProperty('coverart', songImg)
+ item.setProperty('title', name)
+ item.setProperty('album', album)
+ item.setProperty('artist', artist)
+ item.setProperty('duration', str(duration))
+ item.setProperty('key', str(key))
+ item.setProperty('server', str(server))
+ return item
+ else:
+ xbmc.log("No song URL")
+ return None
# Next page of songs
def songPage(self, offset, trackLabelFormat, playlistid = 0, playlistname
= ''):
@@ -701,15 +717,6 @@ class Grooveshark:
dialog.ok(__language__(30008), __language__(30069),
__language__(30070))
return 0
- # Get a song directory item
- def _get_song_item(self, song, trackLabelFormat):
- name = song[0]
- songid = song[1]
- album = song[2]
- artist = song[4]
- coverart = song[6]
- return self.songItem(songid, name, album, artist, coverart,
trackLabelFormat)
-
# File download
def _get_icon(self, url, songid):
if url != 'None':
@@ -754,10 +761,13 @@ class Grooveshark:
items = end - start
while n < end:
song = songs[n]
+ name = song[0]
songid = song[1]
- duration = self._getSongDuration(songid)
- if duration != -1:
- item = self._get_song_item(song, trackLabelFormat)
+ album = song[2]
+ artist = song[4]
+ coverart = song[6]
+ item = self.songItem(songid, name, album, artist, coverart,
trackLabelFormat, (n+1))
+ if item != None:
coverart = item.getProperty('coverart')
songname = song[0]
songalbum = song[2]
@@ -906,51 +916,92 @@ class Grooveshark:
xbmc.log("An error occurred saving songs")
pass
- def _getSongDuration(self, songid):
+ # Duration to seconds
+ def _setDuration(self, usecs):
+ if usecs < 60000000:
+ usecs = usecs * 10 # Some durations are 10x to small
+ return int(usecs / 1000000)
+
+ def _getSongStream(self, songid):
id = int(songid)
- duration = -1
- durations = []
- path = os.path.join(cacheDir, 'duration.dmp')
+ stream = None
+ streams = []
+ path = os.path.join(cacheDir, 'streams.dmp')
try:
f = open(path, 'rb')
- durations = pickle.load(f)
- for song in durations:
+ streams = pickle.load(f)
+ for song in streams:
if song[0] == id:
duration = song[1]
+ url = song[2]
+ key = song[3]
+ server = song[4]
+ stream = [id, duration, url, key, server]
+ if __debugging__ :
+ xbmc.log("Found " + str(id) + " in stream cache")
break;
f.close()
except:
pass
# Not in cache
- if duration < 0:
+ if stream == None:
stream = groovesharkApi.getSubscriberStreamKey(songid)
if stream != False and stream['url'] != '':
duration = self._setDuration(stream['uSecs'])
- song = [id, duration]
- self._setSongDuration(song, durations)
+ url = stream['url']
+ key = stream['StreamKey']
+ server = stream['StreamServerID']
+ stream = [id, duration, url, key, server]
+ self._addSongStream(stream)
- return duration
+ return stream
- def _setSongDuration(self, song, durations):
+ def _addSongStream(self, stream):
+ streams = self._getStreams()
+ streams.append(stream)
+ path = os.path.join(cacheDir, 'streams.dmp')
try:
- durations.append(song)
- # Create the cache directory if it doesn't exist.
- if not os.path.exists(cacheDir):
- os.makedirs(cacheDir)
- path = os.path.join(cacheDir, 'duration.dmp')
f = open(path, 'wb')
- pickle.dump(durations, f, protocol=pickle.HIGHEST_PROTOCOL)
+ pickle.dump(streams, f, protocol=pickle.HIGHEST_PROTOCOL)
+ f.close()
+ if __debugging__ :
+ xbmc.log("Added " + str(stream[0]) + " to stream cache")
+ except:
+ xbmc.log("An error occurred adding to stream")
+
+ def _setSongStream(self, stream):
+ id = int(stream[0])
+ stream[1] = self._setDuration(stream[1])
+ streams = self._getStreams()
+ path = os.path.join(cacheDir, 'streams.dmp')
+ i = 0
+
+ for song in streams:
+ if song[0] == id:
+ streams[i] = stream
+ try:
+ f = open(path, 'wb')
+ pickle.dump(streams, f, protocol=pickle.HIGHEST_PROTOCOL)
+ f.close()
+ if __debugging__ :
+ xbmc.log("Updated " + str(id) + " in stream cache")
+ break;
+ except:
+ xbmc.log("An error occurred setting stream")
+ i = i + 1
+
+ def _getStreams(self):
+ path = os.path.join(cacheDir, 'streams.dmp')
+ try:
+ f = open(path, 'rb')
+ streams = pickle.load(f)
f.close()
except:
- xbmc.log("An error occurred saving duration")
+ streams = []
pass
+ return streams
- # Duration to seconds
- def _setDuration(self, usecs):
- if usecs < 60000000:
- usecs = usecs * 10 # Some durations are 10x to small
- return usecs / 1000000
# Parse URL parameters
def get_params():
diff --git a/plugin.audio.groove/description.xml
b/plugin.audio.groove/description.xml
index 7c25d17..6dfe92e 100644
--- a/plugin.audio.groove/description.xml
+++ b/plugin.audio.groove/description.xml
@@ -18,7 +18,7 @@
<title>Grooveshark XBMC</title>
<!-- (required) Major.minor.build -->
- <version>1.0.3</version>
+ <version>1.0.6</version>
<!--
(required) author name & email. at least one author name is
required
diff --git a/plugin.audio.groove/resources/lib/GroovesharkAPI.py
b/plugin.audio.groove/resources/lib/GroovesharkAPI.py
index 9c05ea2..efa338e 100644
--- a/plugin.audio.groove/resources/lib/GroovesharkAPI.py
+++ b/plugin.audio.groove/resources/lib/GroovesharkAPI.py
@@ -556,6 +556,6 @@ class GrooveAPI:
while (i < len(playlists)):
s = playlists[i]
- list.append([str(s['PlaylistName']).encode('ascii',
'ignore'), s['PlaylistID']])
+ list.append([str(s['PlaylistName']).encode('utf-8'),
s['PlaylistID']])
i = i + 1
return list
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=28e30a008f182784331b38763bfc7a03b471b661
commit 28e30a008f182784331b38763bfc7a03b471b661
Author: spiff <[email protected]>
Date: Tue Aug 21 16:51:12 2012 +0200
[plugin.video.engadget] updated to version 1.0.3
diff --git a/plugin.video.engadget/addon.xml b/plugin.video.engadget/addon.xml
index 3103fcd..9894198 100644
--- a/plugin.video.engadget/addon.xml
+++ b/plugin.video.engadget/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.engadget"
name="Engadget"
- version="1.0.2"
+ version="1.0.3"
provider-name="divingmule">
<requires>
<import addon="xbmc.python" version="2.0"/>
@@ -15,5 +15,6 @@
<summary>Engadget videos</summary>
<description>With this add-on you can watch The Engadget Show and other
videos from engadget.com.</description>
<platform>all</platform>
+ <language>en</language>
</extension>
</addon>
diff --git a/plugin.video.engadget/changelog.txt
b/plugin.video.engadget/changelog.txt
index aac8fc3..e5417fd 100644
--- a/plugin.video.engadget/changelog.txt
+++ b/plugin.video.engadget/changelog.txt
@@ -1,3 +1,6 @@
+Version 1.0.3
+fix for engadget videos
+
Version 1.0.2
fix for changes in the rss feed
diff --git a/plugin.video.engadget/default.py b/plugin.video.engadget/default.py
index df5645f..1deb233 100644
--- a/plugin.video.engadget/default.py
+++ b/plugin.video.engadget/default.py
@@ -9,23 +9,41 @@ icon = xbmc.translatePath( os.path.join( home, 'icon.png' ) )
nexticon = xbmc.translatePath( os.path.join( home, 'resources/next.png' ) )
videoq = __settings__.getSetting('video_quality')
-
+def make_request(url, headers=None):
+ try:
+ if headers is None:
+ headers = {'User-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:14.0) Gecko/20100101 Firefox/14.0.1',
+ 'Referer' : 'http://www.engadget.com/'}
+ req = urllib2.Request(url,None,headers)
+ response = urllib2.urlopen(req)
+ data = response.read()
+ response.close()
+ return data
+ except urllib2.URLError, e:
+ print 'We failed to open "%s".' % url
+ if hasattr(e, 'reason'):
+ print 'We failed to reach a server.'
+ print 'Reason: ', e.reason
+ if hasattr(e, 'code'):
+ print 'We failed with error code - %s.' % e.code
+ xbmc.executebuiltin("XBMC.Notification(Engadget,HTTP ERROR:
"+str(e.code)+",5000,"+icon+")")
+
+
def Categories():
addDir(__language__(30000),'http://www.engadget.com/engadgetshow.xml',1,'http://www.blogcdn.com/www.engadget.com/media/2011/07/engadget-show-logo-1310764107.jpg')
addDir(__language__(30001),'http://api.viddler.com/api/v2/viddler.videos.getByUser.xml?key=tg50w8nr11q8176liowh&user=engadget',2,icon)
def getEngadgetVideos(url):
- req = urllib2.Request(url)
- response = urllib2.urlopen(req)
- link=response.read()
- response.close()
- soup = BeautifulStoneSoup(link,
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
+ soup = BeautifulStoneSoup(make_request(url),
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
videos = soup('video_list')[0]('video')
page = int(soup('list_result')[0]('page')[0].string)+1
for video in videos:
name = video('title')[0].string
link = video('html5_video_source')[0].string
+ # link += '&ec_rate=406&ec_prebuf=10'
+ link += '|User-Agent='
+ link += urllib.quote_plus('Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:14.0) Gecko/20100101 Firefox/14.0.1')
thumb = video('thumbnail_url')[0].string
length = video('length')[0].string
addLink(name,link,length,thumb)
@@ -34,11 +52,7 @@ def getEngadgetVideos(url):
def getEngadgetShow(url):
url = 'http://www.engadget.com/engadgetshow.xml'
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link=response.read()
- soup = BeautifulStoneSoup(link,
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
+ soup = BeautifulStoneSoup(make_request(url),
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
episodes = soup('item')
for episode in episodes:
try:
-----------------------------------------------------------------------
Summary of changes:
plugin.audio.groove/addon.xml | 2 +-
plugin.audio.groove/addon.xml.trans | 23 +++
plugin.audio.groove/changelog.txt | 12 ++
plugin.audio.groove/default.py | 201 ++++++++++++--------
plugin.audio.groove/description.xml | 2 +-
.../resources/lib/GroovesharkAPI.py | 2 +-
plugin.video.engadget/addon.xml | 3 +-
plugin.video.engadget/changelog.txt | 3 +
plugin.video.engadget/default.py | 36 +++-
9 files changed, 194 insertions(+), 90 deletions(-)
create mode 100644 plugin.audio.groove/addon.xml.trans
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