Permalink
Browse files

ExtraMusicInfo - more debug logs + some fixes

  • Loading branch information...
1 parent 69280b8 commit 86f5b6f80e52abe177ef334e8dd17ff99e35f07c @pieh committed Feb 23, 2011
@@ -528,7 +528,6 @@
</control>
<control type="panel" id="9999">
- <visible>Skin.HasSetting(showSimiliar)</visible>
<posx>380</posx>
<posy>520</posy>
<width>860</width>
@@ -615,56 +614,47 @@
<content>
<item id="1">
- <label>$INFO[Window.Property(SimiliarArtists.1.name)]</label>
- <icon>$INFO[Window.Property(SimiliarArtists.1.thumb)]</icon>
+ <label>$INFO[Window(12001).Property(SimiliarArtists.1.name)]</label>
+ <icon>$INFO[Window(12001).Property(SimiliarArtists.1.thumb)]</icon>
<onclick>Dialog.Close(musicinformation)</onclick>
- <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window.Property(SimiliarArtists.1.xbmc_id)]/)</onclick>
- <visible>IntegerGreaterThan(Window.Property(SimiliarArtists.Count),0)</visible>
+ <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window(12001).Property(SimiliarArtists.1.xbmc_id)]/)</onclick>
+ <visible>IntegerGreaterThan(Window(12001).Property(SimiliarArtists.Count),0)</visible>
</item>
<item id="2">
- <label>$INFO[Window.Property(SimiliarArtists.2.name)]</label>
- <icon>$INFO[Window.Property(SimiliarArtists.2.thumb)]</icon>
+ <label>$INFO[Window(12001).Property(SimiliarArtists.2.name)]</label>
+ <icon>$INFO[Window(12001).Property(SimiliarArtists.2.thumb)]</icon>
<onclick>Dialog.Close(musicinformation)</onclick>
<onclick>ActivateWindow(Window.Property(MusicLibrary,musicdb://2/$INFO[SimiliarArtists.2.xbmc_id)]/)</onclick>
- <visible>IntegerGreaterThan(Window.Property(SimiliarArtists.Count),1)</visible>
+ <visible>IntegerGreaterThan(Window(12001).Property(SimiliarArtists.Count),1)</visible>
</item>
<item id="3">
- <label>$INFO[Window.Property(SimiliarArtists.3.name)]</label>
- <icon>$INFO[Window.Property(SimiliarArtists.3.thumb)]</icon>
+ <label>$INFO[Window(12001).Property(SimiliarArtists.3.name)]</label>
+ <icon>$INFO[Window(12001).Property(SimiliarArtists.3.thumb)]</icon>
<onclick>Dialog.Close(musicinformation)</onclick>
- <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window.Property(SimiliarArtists.3.xbmc_id)]/)</onclick>
- <visible>IntegerGreaterThan(Window.Property(SimiliarArtists.Count),2)</visible>
+ <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window(12001).Property(SimiliarArtists.3.xbmc_id)]/)</onclick>
+ <visible>IntegerGreaterThan(Window(12001).Property(SimiliarArtists.Count),2)</visible>
</item>
<item id="4">
- <label>$INFO[Window.Property(SimiliarArtists.4.name)]</label>
- <icon>$INFO[Window.Property(SimiliarArtists.4.thumb)]</icon>
+ <label>$INFO[Window(12001).Property(SimiliarArtists.4.name)]</label>
+ <icon>$INFO[Window(12001).Property(SimiliarArtists.4.thumb)]</icon>
<onclick>Dialog.Close(musicinformation)</onclick>
- <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window.Property(SimiliarArtists.4.xbmc_id)]/)</onclick>
- <visible>IntegerGreaterThan(Window.Property(SimiliarArtists.Count),3)</visible>
+ <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window(12001).Property(SimiliarArtists.4.xbmc_id)]/)</onclick>
+ <visible>IntegerGreaterThan(Window(12001).Property(SimiliarArtists.Count),3)</visible>
</item>
<item id="5">
- <label>$INFO[Window.Property(SimiliarArtists.5.name)]</label>
- <icon>$INFO[Window.Property(SimiliarArtists.5.thumb)]</icon>
+ <label>$INFO[Window(12001).Property(SimiliarArtists.5.name)]</label>
+ <icon>$INFO[Window(12001).Property(SimiliarArtists.5.thumb)]</icon>
<onclick>Dialog.Close(musicinformation)</onclick>
- <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window.Property(SimiliarArtists.5.xbmc_id)]/)</onclick>
- <visible>IntegerGreaterThan(Window.Property(SimiliarArtists.Count),4)</visible>
+ <onclick>ActivateWindow(MusicLibrary,musicdb://2/$INFO[Window(12001).Property(SimiliarArtists.5.xbmc_id)]/)</onclick>
+ <visible>IntegerGreaterThan(Window(12001).Property(SimiliarArtists.Count),4)</visible>
</item>
</content>
</control>
- <control type="button" id="50">
- <posx>-20</posx>
- <posy>-20</posy>
- <width>1</width>
- <height>1</height>
- <onfocus>RunScript(script.MusicAdds,similiar=$INFO[Listitem.Artist])</onfocus>
- <onfocus>SetFocus(9999)</onfocus>
- <visible>Control.HasFocus(9999)</visible>
- </control>
<control type="panel" id="50">
- <visible>!Control.HasFocus(9999)</visible>
+ <visible>False</visible>
<posx>380</posx>
<posy>520</posy>
<width>860</width>
@@ -819,7 +809,7 @@
<control type="button" id="9995">
<description>Cast/Review</description>
<include>ButtonInfoDialogsCommonValues</include>
- <label>Similiar $INFO[Window.Property(SimiliarArtists.Count)]</label>
+ <label>Similiar $INFO[Window(12001).Property(SimiliarArtists.Count)]</label>
<onclick>SetFocus(9999)</onclick>
</control>
<control type="button" id="5">
View
@@ -2,7 +2,7 @@
<addons>
<addon id="script.ExtraMusicInfo"
name="Extra Music Info"
- version="0.0.1"
+ version="0.0.2"
provider-name="pieh">
<requires>
<import addon="xbmc.python" version="1.0"/>
View
@@ -1 +1 @@
-c1d35a31e3adff48fdda5fcc120e0ba4
+691b5395aa0d946f448c4d216a3a1d10
@@ -13,16 +13,21 @@ def GetSimiliarById(m_id):
if len(curXMLs) > 0:
curXML = curXMLs[0]
else:
- return
+ log('No <lfm> found - printing retrieved xml:')
+ print ret
+ return None
curXMLs = curXML.getElementsByTagName('similarartists')
if len(curXMLs) > 0:
curXML = curXMLs[0]
else:
- return
+ log('No <similiarartists> found - printing retrieved xml:')
+ print ret
+ return None
artistXMLs = curXML.getElementsByTagName('artist')
+
similiars = []
for artistXML in artistXMLs:
@@ -1,4 +1,4 @@
-import xbmc, xbmcgui, urllib, re, xml.dom.minidom
+import xbmc, xbmcgui, urllib, re, xml.dom.minidom, time
from Utils import log, GetStringFromUrl, GetValue, GetAttribute
def GetMusicBrainzId(artist):
@@ -1,4 +1,4 @@
-import urllib, xml.dom.minidom
+import urllib, xml.dom.minidom, xbmc
def log(msg):
print ' >> script.ExtraMusicInfo: %s' % str(msg)
@@ -21,4 +21,7 @@ def GetValue(node, tag):
return unicode(v[0].childNodes[0].data)
def GetAttribute(node, attr):
- v = unicode(node.getAttribute(tag))
+ v = unicode(node.getAttribute(tag))
+
+def Notify(header, line='', line2='', line3=''):
+ xbmc.executebuiltin('Notification(%s,%s,%s,%s)' % (header, line, line2, line3) )
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.ExtraMusicInfo"
name="Extra Music Info"
- version="0.0.1"
+ version="0.0.2"
provider-name="pieh">
<requires>
<import addon="xbmc.python" version="1.0"/>
@@ -10,7 +10,7 @@
from MusicBrainz import GetMusicBrainzId, SetMusicBrainzIDsForAllArtists
from BandsInTown import GetEvents
from Lastfm import GetSimiliarById
-from Utils import log, GetStringFromUrl, GetValue, GetAttribute
+from Utils import log, GetStringFromUrl, GetValue, GetAttribute, Notify
def GetXBMCArtists():
sqlQuery = "SELECT DISTINCT artist.strArtist, song.idArtist, song.strMusicBrainzArtistID FROM song JOIN artist ON artist.idArtist=song.idArtist"
@@ -35,11 +35,11 @@ def GetThumbForArtistName(ArtistName):
thumb = xbmc.getCacheThumbName('artist' + ArtistName)
thumb = xbmc.translatePath("special://profile/Thumbnails/Music/Artists/%s" % thumb )
- print '%s -> %s' % (ArtistName, thumb)
-
if not os.path.isfile(thumb):
thumb = ''
+ print '%s -> %s' % (ArtistName, thumb)
+
return thumb
def GetArtists():
@@ -50,8 +50,11 @@ def GetArtists():
def GetSimiliarInLibrary(id):
simi_artists = GetSimiliarById(id)
+ if simi_artists == None:
+ Notify('Last.fm didn\'t return proper response')
+ return None
+
xbmc_artists = GetXBMCArtists()
-
artists = []
start = time.clock()
@@ -77,8 +80,7 @@ def GetSimiliarInLibrary(id):
finish = time.clock()
log('%i of %i artists found in last.FM is in XBMC database' % (len(artists), len(simi_artists)))
- log('Joining xbmc library and last.fm similiar artists took %f seconds' % (finish - start))
- xbmc.executebuiltin('Notification(Joining xbmc library and last.fm similiar artists,took %f seconds)' % (finish - start) )
+ Notify('Joining xbmc library and last.fm similiar artists', 'took %f seconds)' % (finish - start))
return artists
@@ -138,7 +140,6 @@ def passDataToSkin(prefix, data):
passDataToSkin('MusicEvents', events)
elif info == 'updatexbmcdatabasewithartistmbidbg':
-
SetMusicBrainzIDsForAllArtists(False, 'forceupdate' in AdditionalParams)
elif info == 'updatexbmcdatabasewithartistmbid':
SetMusicBrainzIDsForAllArtists(True, 'forceupdate' in AdditionalParams)
Binary file not shown.

0 comments on commit 86f5b6f

Please sign in to comment.