Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed: Notification

- No more empty directory on start
- Just one notification when playing track
  • Loading branch information...
commit 64ffa3af3fcfb9825a293d9be7ea995b91223527 1 parent 0217f40
@showi showi authored
View
1  default.py
@@ -39,5 +39,6 @@
try:
boot.bootstrap_app()
+ boot.dispatch()
except QobuzXbmcError as e:
warn('['+pluginId+']', "Exception while running plugin")
View
61 resources/lib/qobuz/OLDcore.py
@@ -1,61 +0,0 @@
-# Copyright 2011 Joachim Basmaison, Cyril Leclerc
-#
-# This file is part of xbmc-qobuz.
-#
-# xbmc-qobuz is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# xbmc-qobuz is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with xbmc-qobuz. If not, see <http://www.gnu.org/licenses/>.
-import os
-import sys
-
-import xbmcaddon
-import xbmc
-
-from api import QobuzApi
-from debug import log, info, warn
-import qobuz
-
-"""
- Class QobuzXbmc
-"""
-class QobuzCore:
-
- def __init__(self):
- self.data = ""
- self.conn = ""
-
- def is_logged(self):
- return qobuz.api.auth
-
- def login(self):
- username = qobuz.addon.getSetting('username')
- password = qobuz.addon.getSetting('password')
- if not username or not password:
- return None
- auth = qobuz.api.login(username, password)
- if not auth: return None
- try:
- if auth.get_data()['code'] == "401":
- warn(self, "Bad Auth")
- self.delete_user_data()
- auth.delete_cache()
- return None
- except: return auth
-
- def delete_user_data(self):
- from utils.cache_manager import cache_manager
- c = cache_manager()
- if not c.delete_user_data():
- warn(self, "Fail to erase all specific user data")
- qobuz.gui.notifyH(self, "Cache can be inconsistant")
-
-
View
86 resources/lib/qobuz/OLDimages.py
@@ -1,86 +0,0 @@
-# Copyright 2011 Joachim Basmaison, Cyril Leclerc
-#
-# This file is part of xbmc-qobuz.
-#
-# xbmc-qobuz is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# xbmc-qobuz is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with xbmc-qobuz. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-from debug import *
-from cache.icacheable import ICacheable
-import qobuz
-import time
-
-class QobuzImage_access():
-
- def __init__(self):
- self.images = {}
- self.add('fanArt', os.path.join(qobuz.path.image, '..', '..', 'fanart.jpg'))
- self.add('qobuzIcon', os.path.join(qobuz.path.image, 'default.png'))
- self.add('qobuzIconRed', os.path.join(qobuz.path.image, 'default_red.png'))
-
- def add(self, name, filename):
- self.images[name] = filename
-
- def get(self, name, path = '', ext = 'png'):
- if name in self.images:
- return self.images[name]
- path = 'file://' + os.path.join(qobuz.path.image, path, name + '.' + ext)
- #path = os.path.join(path, name + '.' + ext)
- self.add(name, path)
- return path
-
- def genre(self, name):
- if isinstance(name, int):
- if name == 0:
- name = 'default'
- elif name == 64:
- name = 'electro'
- elif name == 80:
- name = 'jazz'
- return self.get('genre.name', 'genres')
-
- def getFanArt(self):
- return self.fanArt
-
- import random
-
-class QobuzImage_cache(ICacheable):
-
- def __init__(self):
- super(QobuzImage_cache, self).__init__(qobuz.path.cache,
- 'images-cache', None, False)
- self.set_cache_refresh(-1)
- debug(self, "Cache duration: " + str(self.cache_refresh))
- self.fetch_data()
-
- def _fetch_data(self):
- return {}
-
- def set(self, id, image):
- data = self.get_raw_data()
- data[id] = { 'url': image, 'time': time.time() }
- self._save_cache_data(data)
- return image
-
- def get(self, id):
- data = self.get_data()
- if id in data and (time.time() - data[id]['time']) < 3600000:
- return data[id]['url']
- return ''
-
-class QobuzImage():
-
- def __init__(self):
- self.access = QobuzImage_access()
- self.cache = QobuzImage_cache()
View
5 resources/lib/qobuz/bootstrap.py
@@ -95,7 +95,6 @@ def bootstrap_app(self):
self.bootstrap_registry()
self.bootstrap_sys_args()
- return self.dispatch()
def bootstrap_lang(self):
qobuz.lang = qobuz.addon.getLocalizedString
@@ -222,8 +221,8 @@ def dispatch(self):
if self.MODE == Mode.PLAY:
debug(self, "Playing song")
self.bootstrap_player()
- if qobuz.addon.getSetting('notification_playingsong') == 'true':
- qobuz.gui.notify(34000, 34001)
+# if qobuz.addon.getSetting('notification_playingsong') == 'true':
+# qobuz.gui.notify(34000, 34001)
try:
context_type = urllib.unquote(self.params["context_type"])
except:
View
7 resources/lib/qobuz/gui/dialog/search.py
@@ -1,5 +1,5 @@
import sys
-import xbmcgui
+import xbmcgui, xbmc
#getLocalizedString = sys.modules['__main__'].getLocalizedString
@@ -9,7 +9,12 @@ def __init__(self, *args, **kwargs):
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
def onInit(self):
+ #blanks the screen - this is crude, and probably wrong, but works
+ self.background = xbmcgui.ControlImage(0,0,1280,720, 'black.png')
+ self.addControl(self.background)
self.action_exitkeys_id = [10, 13]
+ self.keyboard = xbmc.Keyboard()
+ self.addControl(self.keyboard)
# get control ids
# self.control_id_button_action = 3000
View
71 resources/lib/qobuz/node/custom_search.py
@@ -0,0 +1,71 @@
+# Copyright 2011 Joachim Basmaison, Cyril Leclerc
+#
+# This file is part of xbmc-qobuz.
+#
+# xbmc-qobuz is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# xbmc-qobuz is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with xbmc-qobuz. If not, see <http://www.gnu.org/licenses/>.
+import sys
+import qobuz
+from debug import info, warn, error, debug
+from flag import NodeFlag
+from node import Node
+from product import Node_product
+from track import Node_track
+from artist import Node_artist
+from constants import Mode
+import pprint
+
+
+import xbmc, xbmcgui, xbmcplugin
+
+class QobuzSearchKeyboard(xbmcgui.WindowXML):
+ def __init__(self,*a,**ka):
+ super(QobuzSearchKeyboard, self).__init__(*a, **ka)
+
+ def onInit(self):
+ self.btnClose = xbmcgui.ControlButton(100, 250, 200, 50, 'Status', font='font14')
+ self.addControl(self.btnClose)
+
+class Node_custom_search(Node):
+
+ def __init__(self, parent = None, params = None):
+ super(Node_custom_search, self).__init__(parent, params)
+ self.type = NodeFlag.TYPE_NODE | NodeFlag.TYPE_CUSTOM_SEARCH
+ self.label = "xSearch (beta)"
+
+
+ def get_description(self):
+ return self.get_label()
+
+ def pre_build_down(self):
+# kb = QobuzSearchKeyboard()
+# kb.doModal()
+ xbmcplugin.endOfDirectory(handle = 0,
+ succeeded = False,
+ updateListing = False,
+ cacheToDisc = False)
+ from gui.dialog.search import Dialog
+ name = 'plugin.audio.qobuz-search.xml'
+ print 'name: ' + name
+ d = QobuzSearchKeyboard(name, qobuz.addon.getAddonInfo('path'), 'default')
+ d.doModal()
+ d.close()
+ del d
+
+ return False
+
+ def _build_down(self, xbmc_directory, lvl, flag):
+ pass
+
+
+
View
1  resources/lib/qobuz/node/flag.py
@@ -29,6 +29,7 @@ def __init__(self):
self.TYPE_ARTIST = 1024
self.TYPE_SIMILAR_ARTIST = 2048
self.TYPE_FAVORITES = 4096
+ self.TYPE_CUSTOM_SEARCH = 8192
def to_s(self, flag):
if flag & self.TYPE_TRACK: return "track"
View
3  resources/lib/qobuz/node/node.py
@@ -217,6 +217,9 @@ def filter(self,flag):
return False
return True
+ # When returning False we are not displaying directory content
+ def pre_build_down(self):
+ return True
'''
build_down:
This method fetch data from cache recursively and build our tree
View
3  resources/lib/qobuz/node/root.py
@@ -21,6 +21,7 @@
from search import Node_search
from favorites import Node_favorites
from purchases import Node_purchases
+from custom_search import Node_custom_search
import qobuz
'''
@@ -54,5 +55,7 @@ def _build_down(self, xbmc_directory, lvl, flag = None):
search = Node_search()
search.set_search_type('artists')
self.add_child(search)
+# search = Node_custom_search()
+# self.add_child(search)
return True
View
60 resources/lib/qobuz/node/virtual_playlist.py
@@ -1,60 +0,0 @@
-# Copyright 2011 Joachim Basmaison, Cyril Leclerc
-#
-# This file is part of xbmc-qobuz.
-#
-# xbmc-qobuz is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# xbmc-qobuz is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with xbmc-qobuz. If not, see <http://www.gnu.org/licenses/>.
-import pprint
-
-import qobuz
-from constants import *
-from flag import NodeFlag
-from node import node
-from debug import info
-'''
- NODE VIRTUAL PLAYLIST
-'''
-from data.virtual_playlist import cache_virtual_playlist
-from tag.playlist import TagPlaylist
-from tag.track import TagTrack
-from node_track import node_track
-
-class node_virtual_playlist(node):
-
- def __init__(self, parent = None, parameters = None):
- super(node_virtual_playlist, self).__init__(parent, parameters)
- self.type = NodeFlag.TYPE_NODE | NodeFlag.TYPE_VIRTUAL_PLAYLIST
-
- def _build_down(self, lvl, flag = None):
- o = cache_virtual_playlist()
- data = o.get_data()
- o.playlist.set_label('Poom')
- self.set_label(o.playlist.get_label())
- self.set_json(data)
- for track in data['tracks']:
- c = node_track()
- c.set_json(track)
- c.set_id(track['id'])
- c.setLabel(track['title'])
- c.set_url()
- self.add_child(c)
- return True
-
- def _get_xbmc_items(self, list, lvl, flag):
- for c in self.childs:
- tag = TagTrack(c.get_json())
- item = tag.getXbmcItem()
- list.append((item.getProperty('path'), item, False))
- return True
-
-
View
3  resources/lib/qobuz/player.py
@@ -65,9 +65,6 @@ def onPlaybackStarted(self):
print "PLAYBACK STARTED"
def play(self, id):
-# progress = Progress(True)
-# progress.create("Qobuz Player")
- debug(self, "Playing track: " + str(id))
node = Node_track()
node.set_id(id)
node.set_cache()
View
3  resources/lib/qobuz/renderer/irenderer.py
@@ -72,6 +72,9 @@ def set_root_node(self):
elif self.node_type & NodeFlag.TYPE_FAVORITES:
from node.favorites import Node_favorites
root = Node_favorites(None, qobuz.boot.params)
+ elif self.node_type & NodeFlag.TYPE_CUSTOM_SEARCH:
+ from node.custom_search import Node_custom_search
+ root = Node_custom_search(None, qobuz.boot.params)
else:
warn(self, "Cannot set root node!")
return False
View
10 resources/lib/qobuz/renderer/xbmc.py
@@ -39,10 +39,12 @@ def display(self):
if not self.set_root_node():
warn(self, "Cannot set root node (" + str(self.node_type) + ", " + str(self.node_id) + ")")
return False
- dir = Directory(self.root, qobuz.boot.handle, False)
- self.root.build_down(dir, self.depth, self.filter)
- dir.set_content(self.root.content_type)
- dir.end_of_directory()
+ buildDown = self.root.pre_build_down()
+ if buildDown:
+ dir = Directory(self.root, qobuz.boot.handle, False)
+ self.root.build_down(dir, self.depth, self.filter)
+ dir.set_content(self.root.content_type)
+ dir.end_of_directory()
return True
def scan(self):
View
2  resources/lib/qobuz/service/monitor.py
@@ -48,7 +48,7 @@ def onSettingsChanged(self):
qobuz.registry.delete(name='user')
qobuz.registry.delete(name='user-playlists')
qobuz.registry.delete(name='user-playlist-id')
- qobuz.registry.delete(name='user-playlist')
+ #qobuz.registry.delete(name='user-playlist') #@TODO Delete all user playlist (or not :p)
xbmc.executebuiltin('Container.Refresh')
boot = QobuzBootstrap(__addon__, 0)
View
141 resources/skins/Default/720p/plugin.audio.qobuz-search.xml
@@ -1,73 +1,90 @@
<window id="8569" type="dialog">
- <defaultcontrol always="false">2</defaultcontrol>
- <allowoverlay>yes</allowoverlay>
+ <defaultcontrol always="false">2</defaultcontrol>
+ <allowoverlay>yes</allowoverlay>
<visible>true</visible>
<coordinates>
<system>1</system>
-<!-- <posx>640</posx>
- <posy>360</posy> -->
+ <posx>200</posx>
+ <posy>200</posy>
</coordinates>
- <backgroundcolor>0x000000FF</backgroundcolor>
+
+
<controls>
- <!-- <control type="group"> -->
- <description>Search</description>
+<control type="group">
+ <backgroundcolor>0x000000EE</backgroundcolor>
+ <colordiffuse>0x000000FF</colordiffuse>
+<!-- <control type="visualisation" id ="3">
+ <description>My first visualisation control</description>
+ <posx>80</posx>
+ <posy>60</posy>
+ <width>250</width>
+ <height>200</height>
+ <visible>true</visible>
+</control> -->
+ <control type="label" id=1>
+ <posy>10</posy>
+ <height>25</height>
+ <label>Qobuz powered search</label>
+ </control>
+ <control type="radiobutton" id="2">
+ <description>Artist</description>
+ <type>radiobutton</type>
+ <visible>true</visible>
+ <label>Artist</label>
+ <align>left</align>
+ <aligny>center</aligny>
+ <!-- <textoffsetx>4</textoffsetx> <textoffsety>5</textoffsety> -->
+ <pulseonselect>false</pulseonselect>
+ <onfocus>-</onfocus>
+ <onunfocus>-</onunfocus>
+ <onup>2</onup>
+ <ondown>3</ondown>
+ <onleft>1</onleft>
+ <onright>1</onright>
+ <posy>10</posy>
+ <height>25</height>
+ <selected>True</selected>
+ </control>
+ <control type="radiobutton" id="3">
+ <description>Album</description>
+ <type>radiobutton</type>
+ <visible>true</visible>
+ <label>Artist</label>
+ <align>left</align>
+ <aligny>center</aligny>
+ <!-- <textoffsetx>4</textoffsetx> <textoffsety>5</textoffsety> -->
+ <pulseonselect>false</pulseonselect>
+ <onfocus>-</onfocus>
+ <onunfocus>-</onunfocus>
+ <onup>2</onup>
+ <ondown>3</ondown>
+ <onleft>1</onleft>
+ <onright>1</onright>
+ <posy>35</posy>
+ <height>25</height>
+ <selected>True</selected>
+ </control>
+ <control type="radiobutton" id="4">
+ <description>Track</description>
+ <type>radiobutton</type>
<visible>true</visible>
- <control type="label" id=1>
- <label>Qobuz powered search</label>
- </control>
- <control type="radiobutton" id="2">
- <description>Artist</description>
- <type>radiobutton</type>
- <visible>true</visible>
- <label>Artist</label>
- <align>left</align>
- <aligny>center</aligny>
-<!-- <textoffsetx>4</textoffsetx>
- <textoffsety>5</textoffsety> -->
- <pulseonselect>false</pulseonselect>
- <onfocus>-</onfocus>
- <onunfocus>-</onunfocus>
- <onup>2</onup>
- <ondown>3</ondown>
- <onleft>1</onleft>
- <onright>1</onright>
- </control>
- <control type="radiobutton" id="3">
- <description>Album</description>
- <type>radiobutton</type>
- <visible>true</visible>
- <label>Artist</label>
- <align>left</align>
- <aligny>center</aligny>
-<!-- <textoffsetx>4</textoffsetx>
- <textoffsety>5</textoffsety> -->
- <pulseonselect>false</pulseonselect>
- <onfocus>-</onfocus>
- <onunfocus>-</onunfocus>
- <onup>2</onup>
- <ondown>3</ondown>
- <onleft>1</onleft>
- <onright>1</onright>
- </control>
- <control type="radiobutton" id="3">
- <description>Track</description>
- <type>radiobutton</type>
- <visible>true</visible>
- <label>Artist</label>
- <align>left</align>
- <aligny>center</aligny>
-<!-- <textoffsetx>4</textoffsetx>
- <textoffsety>5</textoffsety> -->
- <pulseonselect>false</pulseonselect>
- <onfocus>-</onfocus>
- <onunfocus>-</onunfocus>
- <onup>2</onup>
- <ondown>3</ondown>
- <onleft>1</onleft>
- <onright>1</onright>
- </control>
+ <label>Track</label>
+ <align>left</align>
+ <aligny>center</aligny>
+ <!-- <textoffsetx>4</textoffsetx> <textoffsety>5</textoffsety> -->
+ <pulseonselect>false</pulseonselect>
+ <onfocus>-</onfocus>
+ <onunfocus>-</onunfocus>
+ <onup>2</onup>
+ <ondown>3</ondown>
+ <onleft>1</onleft>
+ <onright>1</onright>
+ <posy>60</posy>
+ <height>25</height>
+ <selected>True</selected>
+ </control>
- <!-- </control> -->
+ </control>
</controls>
</window>
Please sign in to comment.
Something went wrong with that request. Please try again.