The branch, dharma-pre has been updated
via dd40bee9d4833880deecdc59284e534d519869c8 (commit)
from eae8244c82ee3daabfb929929051bcbf1413387f (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=dd40bee9d4833880deecdc59284e534d519869c8
commit dd40bee9d4833880deecdc59284e534d519869c8
Author: amet <a...@nospam>
Date: Sat Nov 27 11:30:52 2010 +0400
[script.audio.grooveshark] -v 0.3.1:
- Fixed: The script couldn't get a session id due to API changes.
- New feature: Preliminary support for GrooveShark Radio.
- Enhancement: More options added in settings.
- Bug fix: The script would crash XBMC Dharma if no stream URL was
returned.
diff --git a/script.audio.grooveshark/GrooveShark.py
b/script.audio.grooveshark/GrooveShark.py
index dd9c90b..eaa7111 100644
--- a/script.audio.grooveshark/GrooveShark.py
+++ b/script.audio.grooveshark/GrooveShark.py
@@ -23,18 +23,19 @@ from GrooveGUI import *
from operator import itemgetter, attrgetter
class searchThread(threading.Thread):
- def __init__(self, item, query):
+ def __init__(self, item, query, searchLimit):
threading.Thread.__init__(self)
self.item = item
self.query = query
+ self.searchLimit = searchLimit
def run (self):
try:
function = self.item['function']
if self.query == None:
- self.item['result'] =
function(GrooveClass.SEARCH_LIMIT)
+ self.item['result'] = function(self.searchLimit)
else:
- self.item['result'] = function(self.query,
GrooveClass.SEARCH_LIMIT)
+ self.item['result'] = function(self.query,
self.searchLimit)
except:
self.item['result'] = None
print "GrooveShark: Search thread failed"
@@ -75,6 +76,7 @@ class GrooveClass(xbmcgui.WindowXML):
self.loadState()
try:
self.gs = GrooveAPI(enableDebug =
__debugging__, isXbox = __isXbox__)
+
self.gs.setRemoveDuplicates(__settings__.getSetting('remove_duplicates'))
except:
self.message(__language__(3046),
__language__(3011)) #Unable to get new session ID
xbmc.log('GrooveShark Exception (onInit): ' +
str(sys.exc_info()[0]))
@@ -86,6 +88,8 @@ class GrooveClass(xbmcgui.WindowXML):
if self.loadState() == False:
self.getPopularSongs()
else:
+ if __isXbox__ == True:
+ xbmc.sleep(500) # hack_kid
self.listMenu()
def __del__(self):
@@ -94,7 +98,16 @@ class GrooveClass(xbmcgui.WindowXML):
def initPlayer(self):
try:
- self.player = GroovePlayer(xbmc.PLAYER_CORE_MPLAYER)
+ core = __settings__.getSetting('player_core')
+ if core == 'MPlayer':
+ self.player =
GroovePlayer(xbmc.PLAYER_CORE_MPLAYER)
+ elif core == 'DVDPlayer':
+ self.player =
GroovePlayer(xbmc.PLAYER_CORE_DVDPLAYER)
+ elif core == 'PAPlayer':
+ self.player =
GroovePlayer(xbmc.PLAYER_CORE_PAPLAYER)
+ else:
+ self.player = GroovePlayer()
+ print 'GrooveShark: Player core: ' + core
self.player.setCallBackFunc(self.playerChanged)
except:
xbmc.log('GrooveShark Exception (initPlayer): ' +
str(sys.exc_info()[0]))
@@ -196,7 +209,27 @@ class GrooveClass(xbmcgui.WindowXML):
self.getPopular()
elif control == 1005:
try:
+ username = __settings__.getSetting('username')
+ password = __settings__.getSetting('password')
+ core = __settings__.getSetting('player_core')
+ debug = __settings__.getSetting('debug')
__settings__.openSettings()
+ self.searchLimit =
int(__settings__.getSetting('search_limit'))
+
self.gs.setRemoveDuplicates(__settings__.getSetting('remove_duplicates'))
+ self.useCoverArt =
self.convertToBool(__settings__.getSetting('covers_in_script'))
+ self.useCoverArtNowPlaying =
self.convertToBool(__settings__.getSetting('cover_now_playing'))
+ # Check to see if things have changed:
+ if __settings__.getSetting('username') !=
username or __settings__.getSetting('password') != password:
+ self.gs.logout()
+ if __settings__.getSetting('player_core') !=
core:
+ self.initPlayer()
+ if __settings__.getSetting('debug') != debug:
+ debug = __settings__.getSetting('debug')
+ if debug == 'false':
+ __debugging__ = False
+ else:
+ __debugging__ = True
+ self.gs = GrooveAPI(enableDebug =
__debugging__, isXbox = __isXbox__)
except:
traceback.print_exc()
elif control == 1007: #Exit
@@ -265,11 +298,11 @@ class GrooveClass(xbmcgui.WindowXML):
self.setStateListUp(GrooveClass.STATE_LIST_SEARCH)
else:
#if self.settings[2] == True: # Get verified
albums. Disabled in API so skip it for now
- #self.albums =
self.gs.artistGetVerifiedAlbums(self.searchResultArtists[n-1][1],GrooveClass.SEARCH_LIMIT)
- # self.albums =
self.gs.artistGetAlbums(self.searchResultArtists[n-1][1],GrooveClass.SEARCH_LIMIT)
+ #self.albums =
self.gs.artistGetVerifiedAlbums(self.searchResultArtists[n-1][1],self.searchLimit)
+ # self.albums =
self.gs.artistGetAlbums(self.searchResultArtists[n-1][1],self.searchLimit)
#else: # Get all albums
b = busy()
- self.albums =
self.gs.artistGetAlbums(self.searchResultArtists[n-1][1],GrooveClass.SEARCH_LIMIT)
+ self.albums =
self.gs.artistGetAlbums(self.searchResultArtists[n-1][1],self.searchLimit)
self.setStateListDown(GrooveClass.STATE_LIST_ALBUMS_BY_ARTIST)
b.close()
del b
@@ -278,7 +311,7 @@ class GrooveClass(xbmcgui.WindowXML):
self.setStateListUp(GrooveClass.STATE_LIST_SEARCH)
else:
b = busy()
- self.songs =
self.gs.albumGetSongs(self.searchResultAlbums[n-1][3],GrooveClass.SEARCH_LIMIT)
+ self.songs =
self.gs.albumGetSongs(self.searchResultAlbums[n-1][3],self.searchLimit)
self.setStateListDown(GrooveClass.STATE_LIST_SONGS_ON_ALBUM_FROM_SEARCH)
b.close()
del b
@@ -302,7 +335,7 @@ class GrooveClass(xbmcgui.WindowXML):
self.setStateListUp(GrooveClass.STATE_LIST_ARTISTS)
else:
b = busy()
- self.songs =
self.gs.albumGetSongs(self.albums[n-1][3],GrooveClass.SEARCH_LIMIT)
+ self.songs =
self.gs.albumGetSongs(self.albums[n-1][3],self.searchLimit)
self.setStateListDown(GrooveClass.STATE_LIST_SONGS_ON_ALBUM)
b.close()
del b
@@ -333,7 +366,7 @@ class GrooveClass(xbmcgui.WindowXML):
self.setStateListUp(GrooveClass.STATE_LIST_SIMILAR)
else:
b = busy()
- self.songs =
self.gs.artistGetSongs(self.albums[n-1][7],GrooveClass.SEARCH_LIMIT)
+ self.songs =
self.gs.artistGetSongs(self.albums[n-1][7],self.searchLimit)
self.setStateListDown(GrooveClass.STATE_LIST_SIMILAR_SONGS)
b.close()
del b
@@ -347,6 +380,12 @@ class GrooveClass(xbmcgui.WindowXML):
if __debugging__ == True:
print 'GrooveShark: ' + str(msg)
+ def convertToBool(self, s):
+ if s == 'true' or s == 'True' or s == True:
+ return True
+ else:
+ return False
+
def initVars(self):
self.stateList = GrooveClass.STATE_LIST_EMPTY
self.searchResultSongs = []
@@ -366,6 +405,9 @@ class GrooveClass(xbmcgui.WindowXML):
self.rootDir = __cwd__
self.xbmcPlaylist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
self.location = []
+ self.searchLimit = int(__settings__.getSetting('search_limit'))
+ self.useCoverArt =
self.convertToBool(__settings__.getSetting('covers_in_script'))
+ self.useCoverArtNowPlaying =
self.convertToBool(__settings__.getSetting('cover_now_playing'))
if __isXbox__ == True:
self.dataDir = 'script_data'
dataRoot = os.path.join('special://profile/',
self.dataDir)
@@ -613,7 +655,7 @@ class GrooveClass(xbmcgui.WindowXML):
# Radio is not stable yet
def showOptionsRadioPlaylist(self, songs):
items = [__language__(102),'More songs like this','Fewer songs
like this', 'Turn off radio'] #FIXME
- result = gSimplePopup(title='Radio', items=items, width=200)
+ result = gSimplePopup(title='Radio', items=items, width=0.2)
if result == 0: #Play
n = self.getCurrentListPosition()
@@ -629,7 +671,7 @@ class GrooveClass(xbmcgui.WindowXML):
def showOptionsRadioSearch(self, songs):
items = ['Add song','Add all songs','Add artist','Turn off
radio'] #FIXME
- result = gSimplePopup(title='Radio', items=items, width=200)
+ result = gSimplePopup(title='Radio', items=items, width=0.2)
if result == 0: #Play
n = self.getCurrentListPosition()
@@ -645,7 +687,7 @@ class GrooveClass(xbmcgui.WindowXML):
def showOptionsNowPlaying(self, songs):
items = [__language__(102),__language__(113),
__language__(122), __language__(104)]
- result = gSimplePopup(title='', items=items, width=200)
+ result = gSimplePopup(title='', items=items, width=0.2)
n = self.getCurrentListPosition()-1
if result == 0: #Play
@@ -689,24 +731,31 @@ class GrooveClass(xbmcgui.WindowXML):
n = self.getCurrentListPosition()
songId = songs[n-1][1]
self.gs.playlistAddSong(pId, songId, 0)
+
def showOptionsSearch(self, songs, withBrowse = False):
items =
[__language__(102),__language__(101),__language__(103),__language__(104),
__language__(119)]
+ if __isXbox__ == False:
+ items.append(__language__(123))
+ if self.isRadioOn() == True:
+ items.append(__language__(124))
if withBrowse == True:
items.append(__language__(120)) #Browse this songs album
- result = gSimplePopup(title='', items=items, width=200)
+ result = gSimplePopup(title='', items=items, width=0.2,
returnAll = True)
+ n = result[0]
+ result = result[1]
- if result == 1: #Queue
+ if result == __language__(101): #Queue
n = self.getCurrentListPosition()-1
self.queueSong(songs[n])
- elif result == 0: #Play
+ elif result == __language__(102): #Play
n = self.getCurrentListPosition()-1
self.playSongs(songs, n)
- elif result == 2: #Queue all
+ elif result == __language__(103): #Queue all
self.queueSongs(songs)
- elif result == 3: #Add to playlist
+ elif result == __language__(104): #Add to playlist
if self.gs.loggedInStatus() != 1:
result = self.login()
if result == 1:
@@ -736,7 +785,7 @@ class GrooveClass(xbmcgui.WindowXML):
songId = songs[n-1][1]
self.gs.playlistAddSong(pId, songId, 0)
- elif result == 4: #Similar
+ elif result == __language__(119): #Similar
b = busy()
try:
self.getSimilar(songs)
@@ -748,11 +797,11 @@ class GrooveClass(xbmcgui.WindowXML):
del b
self.message(__language__(3047),
__language__(3011)) #Could not get similar items
- elif result == 5: #Browse
+ elif result == __language__(120): #Browse
b = busy()
n = self.getCurrentListPosition()
try:
- self.songs =
self.gs.albumGetSongs(self.searchResultSongs[n-1][4],GrooveClass.SEARCH_LIMIT)
+ self.songs =
self.gs.albumGetSongs(self.searchResultSongs[n-1][4],self.searchLimit)
self.setStateListDown(GrooveClass.STATE_LIST_BROWSE_ALBUM_FOR_SONG, truncate =
False)
b.close()
del b
@@ -760,6 +809,27 @@ class GrooveClass(xbmcgui.WindowXML):
traceback.print_exc()
b.close()
del b
+
+ elif result == __language__(123): #Use for radio
+ n = self.getCurrentListPosition()
+ radio = {'seedArtists':[self.searchResultSongs[n-1]],
'frowns':[], 'songIDsAlreadySeen':[], 'recentArtists':[]}
+ if self.gs.saveRadio(radio = radio) == 1:
+ print 'GrooveShark: Radio saved'
+ print self.gs.getSavedRadio()
+ else:
+ print 'GrooveShark: Radio not saved'
+ if self.gs.radioStart() == 1:
+ song = self.gs.radioGetNextSong()
+ self.xbmcPlaylist.clear()
+ self.queueSong(song[0], options = 'radio')
+ self.playSong(0)
+ else:
+ print 'GrooveShark: Could not start radio'
+ pass
+
+ elif result == __language__(124):
+ n = self.getCurrentListPosition()
+ self.gs.radioAddArtist(self.searchResultSongs[n-1])
else:
pass
@@ -767,7 +837,11 @@ class GrooveClass(xbmcgui.WindowXML):
items =
[__language__(102),__language__(101),__language__(103),__language__(113),__language__(114),__language__(115)]
# if __isXbox__:
# items.append(__language__(116))
- result = gSimplePopup(title='', items=items, width=200)
+ if __isXbox__ == False:
+ items.append(__language__(123))
+ if self.isRadioOn() == True:
+ items.append(__language__(124))
+ result = gSimplePopup(title='', items=items, width=0.2)
n = self.getCurrentListPosition()-1
if result == 0: #Play
self.playSongs(self.playlist, n)
@@ -791,11 +865,40 @@ class GrooveClass(xbmcgui.WindowXML):
elif result == 5: # Save As
self.savePlaylist()
- elif result == 6: #Close playlist FIXME: Does it make sense to
keep it?
+ elif result == 6: # Use for radio
+ self.xbmcPlaylist.clear()
+ self.queueSong(self.playlist[n], options = 'radio')
+ self.playSong(0)
+ pass
+
+ elif result == 7: # Add to radio
+ self.gs.radioAddArtist(self.playlist[n])
+ pass
+
+ elif result == -2: #Close playlist FIXME: Does it make sense to
keep it?
self.closePlaylist()
else:
pass
+ def isRadioOn(self):
+ protocol = 'plugin://' + __scriptid__ + '/?playSong'
+ songList = []
+ try:
+ url = self.xbmcPlaylist[0].getfilename()
+ except:
+ return False
+ parts = url.split('=')
+ try:
+ if parts[0] == protocol:
+ parts = url.split('&')
+ print parts[2]
+ if parts[2] == 'options=radio':
+ return True
+ else:
+ return False
+ except:
+ return False
+
def playSongs(self, songs, n):
if __isXbox__ == True:
self.nowPlayingList = []
@@ -805,7 +908,7 @@ class GrooveClass(xbmcgui.WindowXML):
self.queueSongs(songs)
self.playSong(n)
- def queueSong(self, song, i = -1):
+ def queueSong(self, song, i = -1, options = ''):
if __isXbox__ == True:
self.nowPlayingList.append(song)
else:
@@ -815,13 +918,17 @@ class GrooveClass(xbmcgui.WindowXML):
n = i
replace = [{'searchFor':'&','replaceWith':'and'},
{'searchFor':'?','replaceWith':''}]
songId = song[1]
- title = self.replaceCharacters(song[0], replace)
+ title = song[0]
albumId = song[4]
- artist = self.replaceCharacters(song[6], replace)
- album = self.replaceCharacters(song[3], replace)
+ artist = song[6]
+ artistId = song[7]
+ album = song[3]
duration = song[2]
- imgUrl = song[9] # Medium image
- url =
'plugin://%s/?playSong=%s&album=%s&title=%s&artist=%s&cover=%s&duration=%s' %
(__scriptid__, songId, album, title, artist, imgUrl.replace('http://', ''),
duration) # Adding plugin:// to the url makes xbmc call the script to resolve
the real url
+ if self.useCoverArt == True:
+ imgUrl = song[9] # Medium image
+ else:
+ imgUrl = os.path.join(__cwd__,
'resources','skins','DefaultSkin','media','default-cover.png')
+ url = 'plugin://%s/?playSong=%s&artistId=%s&options=%s'
% (__scriptid__, songId, artistId, options) # Adding plugin:// to the url makes
xbmc call the script to resolve the real url
listItem = xbmcgui.ListItem('music',
thumbnailImage=imgUrl, iconImage=imgUrl)
listItem.setProperty( 'Music', "true" )
listItem.setProperty('mimetype', 'audio/mpeg')
@@ -837,6 +944,21 @@ class GrooveClass(xbmcgui.WindowXML):
for i in range(len(songs)):
self.queueSong(songs[i], i = i + n)
+ def queueRadio(self, radio = None, options = ''):
+ if radio != None:
+ self.xbmcPlaylist.clear()
+ imgUrl = ''
+ url = 'plugin://%s/?radio=%s' % (__scriptid__, radio)
+ listItem = xbmcgui.ListItem('music',
thumbnailImage=imgUrl, iconImage=imgUrl)
+ listItem.setProperty( 'Music', "true" )
+ listItem.setProperty('mimetype', 'audio/mpeg')
+ listItem.setProperty('IsPlayable', 'true') # Tell XBMC
that it is playable and not a folder
+ listItem.setInfo( type = 'Music', infoLabels =
{'title': 'GrooveShark radio', 'artist': 'GrooveShark radio'})
+ self.xbmcPlaylist.add(url, listitem=listItem, index = 0)
+ return 1
+ else:
+ return 0
+
def replaceCharacters(self, text, items):
newText = text
for item in items:
@@ -855,9 +977,9 @@ class GrooveClass(xbmcgui.WindowXML):
b.setProgress(25)
self.searchResultArtists =
self.getSimilarArtists(artistId)
b.setProgress(50)
- self.searchResultAlbums =
self.gs.artistGetAlbums(artistId, GrooveClass.SEARCH_LIMIT)
+ self.searchResultAlbums =
self.gs.artistGetAlbums(artistId, self.searchLimit)
b.setProgress(75)
- self.searchResultPlaylists =
self.gs.searchPlaylists(artistName, GrooveClass.SEARCH_LIMIT)
+ self.searchResultPlaylists =
self.gs.searchPlaylists(artistName, self.searchLimit)
b.setProgress(100)
xbmc.sleep(500)
self.setStateListDown(GrooveClass.STATE_LIST_SIMILAR,
reset = True, query = artistName)
@@ -908,7 +1030,7 @@ class GrooveClass(xbmcgui.WindowXML):
def getSimilarSongs(self, songId):
try:
- return self.gs.songGetSimilar(songId,
GrooveClass.SEARCH_LIMIT)
+ return self.gs.songGetSimilar(songId, self.searchLimit)
except:
return []
traceback.print_exc()
@@ -916,7 +1038,7 @@ class GrooveClass(xbmcgui.WindowXML):
def getSimilarArtists(self, artistId):
try:
- return self.gs.artistGetSimilar(artistId,
GrooveClass.SEARCH_LIMIT)
+ return self.gs.artistGetSimilar(artistId,
self.searchLimit)
except:
traceback.print_exc()
pass
@@ -956,7 +1078,7 @@ class GrooveClass(xbmcgui.WindowXML):
b = busy()
searchList = []
for item in lst:
- f = searchThread(item, text)
+ f = searchThread(item, text, self.searchLimit)
searchList.append(f)
f.start()
total = len(searchList)
@@ -1024,7 +1146,10 @@ class GrooveClass(xbmcgui.WindowXML):
else:
durStr = '(' + str(durMin) +
':' + str(durSec) + ')'
songId = str(songs[i][1])
- path = songs[i][8]
+ if self.useCoverArt == True:
+ path = songs[i][8]
+ else:
+ path = os.path.join(__cwd__,
'resources','skins','DefaultSkin','media','default-cover.png')
l1 = songs[i][0]
l2 = songs[i][6] + '\n' + songs[i][3]
item = xbmcgui.ListItem (label=l1,label2=l2,
thumbnailImage=path, iconImage=path)
@@ -1059,7 +1184,10 @@ class GrooveClass(xbmcgui.WindowXML):
return
i = 0
while(i < len(albums)):
- path = albums[i][4]
+ if self.useCoverArt == True:
+ path = albums[i][4]
+ else:
+ path =
os.path.join(__cwd__,'resources','skins','DefaultSkin',
'media','default-cover.png')
if withArtist == 0:
item = xbmcgui.ListItem (label=albums[i][2],
thumbnailImage=path, iconImage=path)
else:
@@ -1090,12 +1218,16 @@ class GrooveClass(xbmcgui.WindowXML):
else:
return 0
- def playerChanged(self, event):
+ def playerChanged(self, event, windowId = None):
if event == 0: # Stopped
pass
elif event == 1: # Ended
- self.playNextSong()
+ if __isXbox__ == True:
+ self.playNextSong()
+ if windowId != None:
+ if windowId == 12006: #Visualization
+ xbmcgui.Window(windowId).show()
elif event == 2: # Started
if __isXbox__ == True:
@@ -1115,6 +1247,11 @@ class GrooveClass(xbmcgui.WindowXML):
pass
elif event == 5: # Play next
+ if __isXbox__ == True:
+ self.playNextSong()
+ if windowId != None:
+ if windowId == 12006: #Visualization
+ xbmcgui.Window(windowId).show()
pass
def newRadioPlaylist(self, createFromNumber = 0):
@@ -1150,9 +1287,13 @@ class GrooveClass(xbmcgui.WindowXML):
imgUrl = self.nowPlayingList[p][9] # Medium image
self.nowPlaying = p
try:
- path = self.getThumbPath([self.nowPlayingList[p][1],
self.nowPlayingList[p][8]])
+ if self.useCoverArtNowPlaying == True:
+ path = imgUrl
+ else:
+ path =
os.path.join(__cwd__,'resources','skins','DefaultSkin',
'media','default-cover.png')
listItem = xbmcgui.ListItem('music',
thumbnailImage=path, iconImage=path)
listItem.setInfo( type = 'music', infoLabels = {
'title': title, 'artist': artist } )
+ listItem.setProperty('mimetype', 'audio/mpeg')
url = self.gs.getStreamURL(str(songId))
if url != "":
self.setPlayerLabel('Buffering...')
@@ -1190,6 +1331,7 @@ class GrooveClass(xbmcgui.WindowXML):
self.setPlaying(song, labelId=4001, imgId=9002, title='Playing
Next')
def playNextSong(self, timesCalled = 0):
+ print '########### Play next'
if __isXbox__ == True:
# Try to play the next song on the current playlist
if self.nowPlaying != -1:
@@ -1322,7 +1464,10 @@ class GrooveClass(xbmcgui.WindowXML):
i += 1
b.close()
del b
- result =
gShowPlaylists(playlists=items,options=[__language__(110),__language__(111),__language__(112)])
+
options=[__language__(110),__language__(111),__language__(112)]
+ if __isXbox__ == False:
+ options.append(__language__(123))
+ result = gShowPlaylists(playlists=items,options=options)
action = result[0]
n = result[1]
if action == 0: #Load
@@ -1342,17 +1487,12 @@ class GrooveClass(xbmcgui.WindowXML):
self.message(__language__(3043),__language__(3011)) #Could not get the playlist
elif action == 1: #Rename
name = self.getInput(__language__(3030),
default=playlists[n][0])
- b = busy()
try:
if name != '':
if
self.gs.playlistRename(playlists[n][1], name) == 0:
self.message(__language__(3031), __language__(3011))
- b.close()
- del b
self.showPlaylists()
except:
- b.close()
- del b
traceback.print_exc()
self.message(__language__(3031),
__language__(3011)) #Could not rename the playlist
@@ -1379,16 +1519,12 @@ class GrooveClass(xbmcgui.WindowXML):
elif action == 3: #Radio
playlistId = playlists[n][1]
playlistName = playlists[n][0]
- playlist = self.gs.playlistGetSongs(playlistId,
limit=100)
- seedArtists = []
- for i in range(len(playlist)):
- seedArtists.append(playlist[i][7])
- print 'Before radioStart'
- self.gs.radioStart(artists = seedArtists)
- print 'After radioStart'
- self.playlist = []
- for i in range(5):
-
self.playlist.append(self.gs.radioGetNextSong()[0])
+ playlist = self.gs.playlistGetSongs(playlistId)
+ radio = {'seedArtists':playlist, 'frowns':[],
'songIDsAlreadySeen':[], 'recentArtists':[]}
+ self.gs.saveRadio(radio = radio)
+ song = self.gs.radioGetNextSong()
+ self.xbmcPlaylist.clear()
+ self.queueSong(song[0], options = 'radio')
self.playSong(0)
except:
@@ -1539,8 +1675,3 @@ class GrooveClass(xbmcgui.WindowXML):
else:
return
os.path.join(__cwd__,'resources','skins','DefaultSkin' ,'media',
'default-cover.png')
-
-
-
-
-
diff --git a/script.audio.grooveshark/addon.xml
b/script.audio.grooveshark/addon.xml
index 44d6cf0..3ee9d9a 100644
--- a/script.audio.grooveshark/addon.xml
+++ b/script.audio.grooveshark/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.audio.grooveshark"
name="GrooveShark"
- version="0.3.0"
+ version="0.3.1"
provider-name="Solver">
<requires>
<import addon="xbmc.python" version="1.0"/>
diff --git a/script.audio.grooveshark/changelog.txt
b/script.audio.grooveshark/changelog.txt
index f7a38e0..e0827a7 100644
--- a/script.audio.grooveshark/changelog.txt
+++ b/script.audio.grooveshark/changelog.txt
@@ -1,3 +1,13 @@
+0.3.1:
+
+ - Fixed: The script couldn't get a session id due to API changes.
+
+ - New feature: Preliminary support for GrooveShark Radio.
+
+ - Enhancement: More options added in settings.
+
+ - Bug fix: The script would crash XBMC Dharma if no stream URL was returned.
+
0.3.0:
From this version onward only XBOX and Dharma will be supported.
diff --git a/script.audio.grooveshark/default.py
b/script.audio.grooveshark/default.py
index 4d526bd..a325077 100644
--- a/script.audio.grooveshark/default.py
+++ b/script.audio.grooveshark/default.py
@@ -40,7 +40,7 @@ try: #It's an XBOX/pre-dharma
__language__ = xbmc.Language(__cwd__.replace( ";", ""
)).getLocalizedString
__debugging__ = __settings__.getSetting("debug")
__isXbox__ = True
- __version__ = "0.3.0"
+ __version__ = "0.3.1"
BASE_RESOURCE_PATH = xbmc.translatePath(os.path.join(__cwd__,
'resources', 'lib' ))
print 'GrooveShark: Initialized as a XBOX plugin'
@@ -54,7 +54,9 @@ except: #It's post-dharma
BASE_RESOURCE_PATH =
xbmc.translatePath(os.path.join(__settings__.getAddonInfo('path'), 'resources',
'lib' ))
__cwd__ = __settings__.getAddonInfo('path')
print 'GrooveShark: Initialized as a post-dharma plugin'
- traceback.print_exc()
+ #traceback.print_exc()
+
+#__isXbox__ = True
if __isXbox__ == True:
__settings__.setSetting("xbox", "true")
@@ -95,16 +97,8 @@ else:
get = tools.getCmd
songId = get('playSong')
playlist = get('playlist')
- title = get('title')
- album = get('album')
- artist = get('artist')
- cover = 'http://' + get('cover')
- duration = get('duration')
- try:
- duration = int(duration)
- except:
- duration = 0
-
+ options = get('options')
+ radio = get('radio')
if (playlist != None): # To be implemented...
#listitem=xbmcgui.ListItem('Playlists')#,
iconImage=icon, thumbnailImage=thumbnail )
#listitem.addContextMenuItems( cm,
replaceItems=True )
@@ -117,17 +111,67 @@ else:
print 'GrooveShark: Song ID: ' + str(songId)
url = gs.getStreamURL(str(songId))
if url != "":
- listitem=xbmcgui.ListItem(label=title,
iconImage=cover, thumbnailImage=cover, path=url);
- listitem.setInfo(type='Music',
infoLabels = { 'title': title, 'artist': artist , 'url': url, 'duration':
duration})
+
listitem=xbmcgui.ListItem(label='music', path=url)
+ listitem.setInfo(type='Music',
infoLabels = {'url': url})
listitem.setProperty('mimetype',
'audio/mpeg')
+ if options == 'radio':
+ print 'GrooveShark: Radio mode'
+
gs.radioSetAlreadyListenedSong(songId = songId) # Set this song as listened to
+ playlist =
xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
+ playlist.clear()
+ song = gs.radioGetNextSong()
+ if song != None:
+ song = song[0]
+ songId = song[1]
+ title = song[0]
+ albumId = song[4]
+ artist = song[6]
+ artistId = song[7]
+ album = song[3]
+ duration = song[2]
+ cover = song[9] #
Medium image
+ try:
+ duration =
int(duration)
+ except:
+ duration = 0
+ url =
'plugin://%s/?playSong=%s&artistId=%s&options=%s' % (__scriptid__, songId,
artistId, 'radio')
+
listitemNext=xbmcgui.ListItem(label=title, iconImage=cover,
thumbnailImage=cover, path=url)
+
listitemNext.setInfo(type='Music', infoLabels = { 'title': title, 'artist':
artist, 'album': album , 'url': url})
+
listitemNext.setProperty('mimetype', 'audio/mpeg')
+
listitemNext.setProperty('IsPlayable', 'true')
+ playlist.add(url,
listitemNext, 0)
+ print 'GrooveShark: Found stream url:
(' + url + ')'
xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True,
listitem=listitem)
else:
+ print 'GrooveShark: No stream url
returned for song id'
+
listitem=xbmcgui.ListItem(label='music', path='')
+
xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, listitem)
+ elif (radio != None):
+ print 'GrooveShark: Radio'
+ song = gs.radioGetNextSong()
+ if song != None:
+ song = song[0]
+ songId = song[1]
+ title = song[0]
+ albumId = song[4]
+ artist = song[6]
+ cover = song[9] # Medium image
+ url = gs.getStreamURL(str(songId))
+ listitem=xbmcgui.ListItem(label=title,
iconImage=cover, thumbnailImage=cover, path=url)
+ listitem.setInfo(type='Music',
infoLabels = { 'title': title, 'artist': artist , 'url': url})
+ listitem.setProperty('mimetype',
'audio/mpeg')
+
xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True,
listitem=listitem)
+ else:
xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=False,
listitem=None)
+
else:
-
xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=False,
listitem=None)
+ listitem=xbmcgui.ListItem(label='music',
path='')
+
xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=False,
listitem=listitem)
print 'GrooveShark: Unknown command'
except:
- xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]),
succeeded=False, listitem=None)
+ print 'GrooveShark: Exception thrown when determining
stream url for song id'
+ listitem=xbmcgui.ListItem(label='music', path='')
+ xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]),
succeeded=False, listitem=listitem)
traceback.print_exc()
else:
if __name__ == "__main__":
diff --git a/script.audio.grooveshark/resources/language/Danish/strings.xml
b/script.audio.grooveshark/resources/language/Danish/strings.xml
index 5db07f2..30808fa 100644
--- a/script.audio.grooveshark/resources/language/Danish/strings.xml
+++ b/script.audio.grooveshark/resources/language/Danish/strings.xml
@@ -25,6 +25,8 @@
<string id="120">Se denne sangs album</string>
<string id="121">Afslut</string>
<string id="122">Fjern alle sange</string>
+ <string id="123">Anvend til radio</string>
+ <string id="124">Tilføj til radio</string>
<!-- Dialogs -->
<string id="1000">Indtast en søgning</string>
@@ -35,8 +37,8 @@
<!-- Settings -->
<string id="2000">Brugernavn</string>
- <string id="2001">Password</string>
- <string id="2002">Debugging (Genstart script for at anvende)</string>
+ <string id="2001">Kodeord</string>
+ <string id="2002">Fejlfinding</string>
<string id="2003">XBOX</string>
<string id="2004">Shuffle</string>
diff --git a/script.audio.grooveshark/resources/language/English/strings.xml
b/script.audio.grooveshark/resources/language/English/strings.xml
index 7f11872..5623bc0 100644
--- a/script.audio.grooveshark/resources/language/English/strings.xml
+++ b/script.audio.grooveshark/resources/language/English/strings.xml
@@ -25,6 +25,8 @@
<string id="120">Browse this songs album</string>
<string id="121">Exit</string>
<string id="122">Remove all songs</string>
+ <string id="123">Use for radio</string>
+ <string id="124">Add to radio</string>
<!-- Dialogs -->
<string id="1000">Enter a search phrase</string>
@@ -36,7 +38,7 @@
<!-- Settings -->
<string id="2000">Username</string>
<string id="2001">Password</string>
- <string id="2002">Debugging (restart script to apply)</string>
+ <string id="2002">Debugging</string>
<string id="2003">XBOX</string>
<string id="2004">Shuffle</string>
diff --git a/script.audio.grooveshark/resources/lib/GrooveAPI.py
b/script.audio.grooveshark/resources/lib/GrooveAPI.py
index db214cd..04c613e 100644
--- a/script.audio.grooveshark/resources/lib/GrooveAPI.py
+++ b/script.audio.grooveshark/resources/lib/GrooveAPI.py
@@ -76,6 +76,12 @@ class GrooveAPI:
if self.enableDebug == True:
print msg
+ def setRemoveDuplicates(self, enable):
+ if enable == True or enable == 'true' or enable == 'True':
+ self.removeDuplicates = True
+ else:
+ self.removeDuplicates = False
+
def getSavedSession(self):
sessionID = ''
path = os.path.join(self.confDir, 'session', 'session.txt')
@@ -85,14 +91,13 @@ class GrooveAPI:
f.close()
except:
sessionID = ''
- pass
-
+ pass
return sessionID
def saveSession(self):
try:
dir = os.path.join(self.confDir, 'session')
- # Create the 'data' directory if it doesn't exist.
+ # Create the 'session' directory if it doesn't exist.
if not os.path.exists(dir):
os.mkdir(dir)
path = os.path.join(dir, 'session.txt')
@@ -125,14 +130,7 @@ class GrooveAPI:
def callRemote(self, method, params={}):
data = {'header': {'sessionID': self.sessionID}, 'method':
method, 'parameters': params}
- #data = {'header': {'sessionID': None}, 'method': method,
'parameters': params}
data = self.simplejson.dumps(data)
- #proxy_support = urllib2.ProxyHandler({"http" :
"http://wwwproxy.kom.aau.dk:3128"})
- ## build a new opener with proxy details
- #opener = urllib2.build_opener(proxy_support,
urllib2.HTTPHandler)
- ## install it
- #urllib2.install_opener(opener)
- #print data
req = urllib2.Request("http://api.grooveshark.com/ws/1.0/?json")
req.add_header('Host', 'api.grooveshark.com')
req.add_header('Content-type', 'text/json')
@@ -152,10 +150,11 @@ class GrooveAPI:
self.saveSession()
return self.callRemote(method,
params)
else:
- self.debug('SessionID expired,
but unable to get new')
+ self.debug('GrooveShark:
SessionID expired, but unable to get new')
return []
return result
except:
+ traceback.print_exc()
return []
def startSession(self):
@@ -167,7 +166,7 @@ class GrooveAPI:
if 'fault' in result:
return ''
else:
- return result['header']['sessionID']
+ return result['result']['sessionID']
def sessionDestroy(self):
return self.callRemote("session.destroy")
@@ -281,7 +280,6 @@ class GrooveAPI:
return []
i = 0
list = []
- print result
while(i < len(playlists)):
p = playlists[i]
list.append([p['playlistName'].encode('ascii',
'ignore'), p['playlistID']])
@@ -361,15 +359,6 @@ class GrooveAPI:
self.radioEnabled = 1
return 1
- def autoplayStop(self):
- result = self.callRemote("autoplay.stop", {})
- if 'fault' in result:
- self.radioEnabled = 1
- return 0
- else:
- self.radioEnabled = 0
- return 1
-
def autoplayGetNextSongEx(self, seedArtists = [], frowns = [],
songIDsAlreadySeen = [], recentArtists = []):
result = self.callRemote("autoplay.getNextSongEx",
{"seedArtists": seedArtists, "frowns": frowns, "songIDsAlreadySeen":
songIDsAlreadySeen, "recentArtists": recentArtists})
if 'fault' in result:
@@ -378,15 +367,19 @@ class GrooveAPI:
return result
def radioGetNextSong(self):
- if self.seedArtists == []:
- return []
+ radio = self.getSavedRadio()
+ if radio == None:
+ return None
else:
- result = self.autoplayGetNextSongEx(self.seedArtists,
self.frowns, self.songIDsAlreadySeen, self.recentArtists)
+ seedArtists = []
+ for song in radio['seedArtists']:
+ seedArtists.append(song[7])
+ result = self.autoplayGetNextSongEx(seedArtists,
radio['frowns'], radio['songIDsAlreadySeen'], radio['recentArtists'])
if 'fault' in result:
return []
else:
song = self.parseSongs(result)
- self.radioAlreadySeen(song[0][1])
+ self.radioSetAlreadyListenedSong(songId =
song[0][1])
return song
def radioFrown(self, songId):
@@ -395,15 +388,24 @@ class GrooveAPI:
def radioAlreadySeen(self, songId):
self.songIDsAlreadySeen.append(songId)
- def radioAddArtist(self, artistId):
- self.seedArtists.append(artistId)
+ def radioAddArtist(self, song = None, radioName = None):
+ radio = self.getSavedRadio(name = radioName)
+ if radio != None and song != None:
+ radio['seedArtists'].append(song)
+ return self.saveRadio(radio = radio)
+ else:
+ return 0
- def radioStart(self, artists = [], frowns = []):
- for artist in artists:
- self.seedArtists.append(artist)
- for artist in frowns:
- self.frowns.append(artist)
- if self.autoplayStartWithArtistIDs(self.seedArtists) == 1:
+ def radioStart(self):
+ return 1
+ radio = self.getSavedRadio()
+ if radio == None:
+ return 0
+ else:
+ seedArtists = []
+ for song in radio['seedArtists']:
+ seedArtists.append(song[7])
+ if self.autoplayStartWithArtistIDs(seedArtists) == 1:
self.radioEnabled = 1
return 1
else:
@@ -420,6 +422,51 @@ class GrooveAPI:
def radioTurnedOn(self):
return self.radioEnabled
+ def radioSetAlreadyListenedSong(self, name = None, songId = ''):
+ radio = self.getSavedRadio(name = name)
+ if radio != None and songId != '':
+ radio['songIDsAlreadySeen'].append(songId)
+ #while len(radio['songIDsAlreadySeen']) > 20:
+ # radio['songIDsAlreadySeen'].pop(0) # Trim
+ return self.saveRadio(radio = radio)
+ else:
+ return 0
+
+ def getSavedRadio(self, name = None):
+ if name == None:
+ path = os.path.join(self.confDir, 'radio',
'default.txt')
+ else:
+ path = os.path.join(self.confDir, 'radio', 'saved',
name)
+ try:
+ f = open(path, 'rb')
+ radio = pickle.load(f)
+ f.close()
+ except:
+ radio = None
+ return radio
+
+ def saveRadio(self, name = None, radio = {}): #blaher
+ try:
+ dir = os.path.join(self.confDir, 'radio')
+ # Create the 'data' directory if it doesn't exist.
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.mkdir(os.path.join(dir, 'saved'))
+ if name == None:
+ path = os.path.join(dir, 'default.txt')
+ else:
+ path = os.path.join(dir, 'saved', name)
+ f = open(path, 'wb')
+ pickle.dump(radio, f, protocol=pickle.HIGHEST_PROTOCOL)
+ f.close()
+ return 1
+ except IOError, e:
+ print 'There was an error while saving the radio pickle
(%s)' % e
+ return 0
+ except:
+ print "An unknown error occured during save radio: " +
str(sys.exc_info()[0])
+ return 0
+
def favoriteSong(self, songID):
return self.callRemote("song.favorite", {"songID": songID})
@@ -506,6 +553,10 @@ class GrooveAPI:
result = self.callRemote("song.about", {"songID": songId})
return result['result']['song']
+ def getVersion(self):
+ result = self.callRemote("service.getVersion", {})
+ return result
+
def parseSongs(self, items):
try:
if 'result' in items:
@@ -535,8 +586,9 @@ class GrooveAPI:
songName =
s['songName'].encode('ascii', 'ignore')
albumName =
s['albumName'].encode('ascii', 'ignore')
artistName =
s['artistName'].encode('ascii', 'ignore')
- if (entry[0].lower() ==
songName.lower()) and (entry[3].lower() == albumName.lower()) and
(entry[6].lower() == artistName.lower()):
- notIn = False
+ if
self.removeDuplicates == True:
+ if
(entry[0].lower() == songName.lower()) and (entry[3].lower() ==
albumName.lower()) and (entry[6].lower() == artistName.lower()):
+ notIn =
False
if notIn == True:
list.append([s['songName'].encode('ascii', 'ignore'),\
s['songID'],\
diff --git a/script.audio.grooveshark/resources/lib/GrooveGUI.py
b/script.audio.grooveshark/resources/lib/GrooveGUI.py
index 406e5e9..f551e3a 100644
--- a/script.audio.grooveshark/resources/lib/GrooveGUI.py
+++ b/script.audio.grooveshark/resources/lib/GrooveGUI.py
@@ -15,42 +15,24 @@ if __isXbox__ == False: # MusicSuggestions is not supported
fox XBOX yet
from MusicSuggestions import getTextThread
def gShowPlaylists(playlists=[], options=[]):
-# popup = popupList(title= 'Playlists', items=playlists, btns=options,
width=400)
-# popup.doModal()
-# selected = popup.selected
-# del popup
-# return selected
+ popup = popupList(title= 'Playlists', items=playlists, btns=options,
width=0.5)
+ popup.doModal()
+ selected = popup.selected
+ del popup
+ return selected
- selected = gSimplePopup(title=__language__(1001), items=playlists)
- if selected != -1:
- if options != []:
- action = gSimplePopup(__language__(1002), items=options)
- if action == -1:
- return [-1, -1]
- else:
- return [action, selected]
- else:
- return [-1, selected]
+def gSimplePopup(title='', items=[], width=300, returnAll = False):
+ popupMenu = popupBtns(title='', btns=items, width=width)
+ popupMenu.doModal()
+ n = popupMenu.selected
+ del popupMenu
+ if returnAll == False:
+ return n
else:
- return [-1, -1]
-
-
-def gSimplePopup(title='', items=[], width=300):
-# popupMenu = popupBtns(title='', btns=items, width=width)
-# rootDir = os.getcwd()
-# print 'RootDir: ' + rootDir
- #popupMenu = popupBtns("button-popup.xml", rootDir, "DefaultSkin")
-# popupMenu.doModal()
-# selected = popupMenu.selected
-# del popupMenu
-# return selected
- dialog = xbmcgui.Dialog()
- return dialog.select(title, items)
-
-#class popupBtns
-# def __init__(self, title, btns=[], width=100):
-# dialog = xbmcgui.Dialog()
-# self.selected = dialog.select(title, btns)
+ if n == -1:
+ return [n, '']
+ else:
+ return [n, items[n]]
class popupBtnsXml(xbmcgui.WindowXMLDialog):
#def __init__(self, title, btns=[], width=100):
@@ -59,6 +41,24 @@ class popupBtnsXml(xbmcgui.WindowXMLDialog):
pass
def onInit(self):
+ print "################## INIT"
+ #h = len(self.btns) * (hCnt + 5) + yo
+ mediaDir =
os.path.join(os.getcwd().replace(";",""),'resources','skins','DefaultSkin','media')
+ #rw = self.getWidth()
+ #rh = self.getHeight()
+ #x = rw/2 - w/2
+ #y = rh/2 -h/2
+
+ #print 'rw: ' + str(rw)
+ #print 'rh: ' + str(rh)
+ #print 'Media Dir: ' +os.path.join(mediaDir,'gs-bg-menu.png')
+ w = 100
+ h = 100
+ # Background
+ #self.imgBg = xbmcgui.ControlImage(0+x-30,0+y-30,w+60,h+60,
os.path.join(mediaDir,'gs-bg-menu.png'))
+ self.imgBg = xbmcgui.ControlImage(0,0,w+60,h+60,
os.path.join(mediaDir,'gs-bg-menu.png'))
+ print self.imgBg
+ self.addControl(self.imgBg)
pass
def onAction(self, action):
@@ -91,8 +91,6 @@ def busy():
t = busyThread()
w = t.getWindow()
t.start()
- #xbmc.sleep(100)
- #w.place()
return w
@@ -120,7 +118,6 @@ class popupBusyXml(xbmcgui.WindowXMLDialog):
self.close()
def onClick(self, controlId):
- print 'control, click: ' + controlID
aId = controlId.getId()
if aId == 10:
self.close()
@@ -154,8 +151,8 @@ class popupBusyXml(xbmcgui.WindowXMLDialog):
i = n
self.getControl(300).setLabel(str(i) + '%')
-class popupBtnsOld(xbmcgui.WindowDialog):
- def __init__(self, title, btns=[], width=100):
+class popupBtns(xbmcgui.WindowDialog):
+ def __init__(self, title='', btns=[], width=1):
self.w = width
self.selected = -1
self.btns = btns
@@ -163,31 +160,26 @@ class popupBtnsOld(xbmcgui.WindowDialog):
for i in range(len(btns)-1): # There has to be a better way to
do this. zeros doesn't work...
self.btnCnts.append(0)
- #def onInit(self):
+# def onInit(self):
w = self.w
- pad = 10
- hCnt = 30
- yo = 5
+ w = int(self.getWidth()*width)
+ pad = self.getHeight()/100
+ hCnt = 5*pad
+ yo = pad
h = len(self.btns) * (hCnt + 5) + yo
- mediaDir =
os.path.join(os.getcwd().replace(";",""),'resources/skins/DefaultSkin/media')
+ mediaDir =
os.path.join(os.getcwd().replace(";",""),'resources','skins','DefaultSkin','media')
rw = self.getWidth()
rh = self.getHeight()
x = rw/2 - w/2
- y = rh/2 -h/2
-
- print 'rw: ' + str(rw)
- print 'rh: ' + str(rh)
- print 'Media Dir: ' +os.path.join(mediaDir,'gs-bg-menu.png')
+ y = rh/2 - h/2
# Background
- #self.imgBg = xbmcgui.ControlImage(0+x-30,0+y-30,w+60,h+60,
os.path.join(mediaDir,'gs-bg-menu.png'))
- self.imgBg = xbmcgui.ControlImage(0,0,w+60,h+60,
os.path.join(mediaDir,'gs-bg-menu.png'))
- print self.imgBg
+ self.imgBg =
xbmcgui.ControlImage(0+x-4*pad,0+y-4*pad,w+8*pad,h+8*pad,
os.path.join(mediaDir,'gs-bg-menu.png'))
self.addControl(self.imgBg)
i = 0
- while i < len(btns):
+ while i < len(self.btns):
self.btnCnts[i] = xbmcgui.ControlButton(pad+x, yo+y,
w-2*pad, hCnt, str(self.btns[i]), os.path.join(mediaDir,'button_focus.png'),
'', font='font12', textColor='0xFFFFFFFF', alignment=2)
self.addControl(self.btnCnts[i])
yo += hCnt + 5
@@ -231,12 +223,12 @@ class popupBtnsOld(xbmcgui.WindowDialog):
class popupList(xbmcgui.WindowDialog):
def __init__(self, title, btns=[], items=[], width=100):
- w = width
- pad = 5
+ w = int(self.getWidth()*width)
+ pad = int(self.getHeight()/100)
hCnt = 30
yo = 30
self.selected = [-1, -1]
- h = 420
+ h = self.getHeight()-30*pad
self.btns = btns
mediaDir =
os.path.join(os.getcwd(),'resources','skins','DefaultSkin','media')
rw = self.getWidth()
@@ -249,14 +241,14 @@ class popupList(xbmcgui.WindowDialog):
#self.addControl(self.imgBg)
self.imgBg = xbmcgui.ControlImage(0+x-30,0+y-30,w+60,h+60,
os.path.join(mediaDir,'gs-bg-menu.png'))
self.addControl(self.imgBg)
- self.imgBg =
xbmcgui.ControlImage(0+x+pad,yo+y,w-2*pad,h-yo-2*pad,
os.path.join(mediaDir,'list-bg2.png'))
+ self.imgBg =
xbmcgui.ControlImage(0+x+pad,5*pad+y,w-2*pad,h-5*pad,
os.path.join(mediaDir,'list-bg2.png'))
self.addControl(self.imgBg)
# Title
self.labelTitle = xbmcgui.ControlLabel(0+x, 0+y, w, hCnt,
title, 'font14', '0xFFFFFFFF', alignment=2)
self.addControl(self.labelTitle)
- self.cntList = xbmcgui.ControlList(2*pad+x, yo+y+pad, w-4*pad,
h-4*pad, buttonFocusTexture = os.path.join(mediaDir,'button_focus.png'),
font='font12', textColor='0xFFFFFFFF', space=0)
+ self.cntList = xbmcgui.ControlList(2*pad+x, yo+y+3*pad,
w-4*pad, h-10*pad, buttonFocusTexture =
os.path.join(mediaDir,'button_focus.png'), font='font12',
textColor='0xFFFFFFFF', space=0, itemHeight=7*pad)
self.addControl(self.cntList)
for item in items:
self.cntList.addItem(str(item))
@@ -277,7 +269,7 @@ class popupList(xbmcgui.WindowDialog):
return None
elif action == 7:
if len(self.btns) != 0:
- popupMenu = popupBtnsOld(title='',
btns=self.btns, width=150)
+ popupMenu = popupBtns(title='', btns=self.btns,
width=0.2)
popupMenu.doModal()
if popupMenu.selected != -1:
self.selected = [popupMenu.selected,
self.cntList.getSelectedPosition()]
diff --git a/script.audio.grooveshark/resources/lib/GroovePlayer.py
b/script.audio.grooveshark/resources/lib/GroovePlayer.py
index f8a8667..1dc297e 100644
--- a/script.audio.grooveshark/resources/lib/GroovePlayer.py
+++ b/script.audio.grooveshark/resources/lib/GroovePlayer.py
@@ -14,7 +14,7 @@ class GroovePlayer(xbmc.Player):
def onPlayBackEnded(self):
self.state = 0
- self.function(1)
+ self.function(1, xbmcgui.getCurrentWindowId())
def onPlayBackStarted(self):
self.state = 2
@@ -28,8 +28,8 @@ class GroovePlayer(xbmc.Player):
self.state = 2
self.function(4)
- def playnext(self):
- self.function(5)
+ #def playnext(self):
+ # self.function(5)
def isPaused(self):
if self.state == 1:
diff --git a/script.audio.grooveshark/resources/settings.xml
b/script.audio.grooveshark/resources/settings.xml
index e9cc464..50b6df3 100644
--- a/script.audio.grooveshark/resources/settings.xml
+++ b/script.audio.grooveshark/resources/settings.xml
@@ -1,10 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
- <setting id="username" type="text" label="2000" default="" />
- <setting id="password" type="text" option="hidden" label="2001"
enable="!eq(-1,)" default="" />
- <setting type="sep" />
- <setting id="xbox" type="bool" label="2003" default="false"
visible="false"/>
- <setting id="xbox_shuffle" type="bool" label="2004" default="false"
visible="eq(-1,true)"/>
- <setting type="sep" />
- <setting id="debug" type="bool" label="2002" default="false" />
+ <category label="Login">
+ <setting id="username" type="text" label="2000" default="" />
+ <setting id="password" type="text" option="hidden" label="2001"
enable="!eq(-1,)" default="" />
+ <setting type="lsep" label="You can create an account at
grooveshark.com if"/>
+ <setting type="lsep" label="you don't already have one. By
doing so you will"/>
+ <setting type="lsep" label="be able to use playlists."/>
+ </category>
+ <category label="Playback">
+ <setting id="xbox" type="bool" label="2003" default="false"
visible="false"/>
+ <setting id="xbox_shuffle" type="bool" label="2004"
default="false" visible="eq(-1,true)"/>
+ <setting id="cover_now_playing" type="bool" label="Cover art
for playing song" default="true" visible="eq(-2,true)"/>
+ <setting id="player_core" type="labelenum" label="Player core"
default="Auto" values="Auto|MPlayer|DVDPlayer|PAPlayer"/>
+ <setting type="lsep" label="If some songs do not play try
changing"/>
+ <setting type="lsep" label="the player core."/>
+ </category>
+ <category label="Search">
+ <setting id="search_limit" type="labelenum" label="Search
limit" default="50" values="10|20|30|40|50|60|70|80|90|100"/>
+ <setting id="timeout" type="labelenum" label="Timeout in
seconds" default="40" values="10|15|20|25|30|35|40|45|50|55|60"/>
+ <setting id="remove_duplicates" type="bool" label="Remove
duplicates" default="true" />
+ <setting id="covers_in_script" type="bool" label="Use cover
art" default="true" />
+ </category>
+ <category label="Debug">
+ <setting id="debug" type="bool" label="2002" default="false" />
+ </category>
</settings>
diff --git
a/script.audio.grooveshark/resources/skins/DefaultSkin/720p/grooveshark.xml
b/script.audio.grooveshark/resources/skins/DefaultSkin/720p/grooveshark.xml
index 24232e6..487d7b3 100644
--- a/script.audio.grooveshark/resources/skins/DefaultSkin/720p/grooveshark.xml
+++ b/script.audio.grooveshark/resources/skins/DefaultSkin/720p/grooveshark.xml
@@ -17,7 +17,7 @@
<posy>0</posy>
<height>720</height>
<width>1280</width>
- <texture>gs-bg.jpg</texture>
+ <texture>gs-bg.png</texture>
<animation effect="fade" time="1000" start="0"
end="100">WindowOpen</animation>
</control>
<control type="image">
diff --git
a/script.audio.grooveshark/resources/skins/DefaultSkin/PAL/grooveshark.xml
b/script.audio.grooveshark/resources/skins/DefaultSkin/PAL/grooveshark.xml
index 042f1fa..63786d4 100644
--- a/script.audio.grooveshark/resources/skins/DefaultSkin/PAL/grooveshark.xml
+++ b/script.audio.grooveshark/resources/skins/DefaultSkin/PAL/grooveshark.xml
@@ -13,7 +13,7 @@
<posy>0</posy>
<height>576</height>
<width>720</width>
- <texture>gs-bg.jpg</texture>
+ <texture>gs-bg.png</texture>
<animation effect="fade" time="1000" start="0"
end="100">WindowOpen</animation>
</control>
<control type="image">
-----------------------------------------------------------------------
Summary of changes:
script.audio.grooveshark/GrooveShark.py | 251 +++++++++++++++-----
script.audio.grooveshark/addon.xml | 2 +-
script.audio.grooveshark/changelog.txt | 10 +
script.audio.grooveshark/default.py | 76 +++++--
.../resources/language/Danish/strings.xml | 6 +-
.../resources/language/English/strings.xml | 4 +-
.../resources/lib/GrooveAPI.py | 124 +++++++---
.../resources/lib/GrooveGUI.py | 110 ++++-----
.../resources/lib/GroovePlayer.py | 6 +-
script.audio.grooveshark/resources/settings.xml | 31 ++-
.../skins/DefaultSkin/720p/grooveshark.xml | 2 +-
.../skins/DefaultSkin/PAL/grooveshark.xml | 2 +-
.../DefaultSkin/media/{gs-bg.jpg => gs-bg.png} | Bin 208356 -> 208356
bytes
13 files changed, 437 insertions(+), 187 deletions(-)
copy script.audio.grooveshark/resources/skins/DefaultSkin/media/{gs-bg.jpg =>
gs-bg.png} (100%)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons