The branch, eden-pre has been updated
via 6299876e78bb2a977429a118e97cc3e1f14f41ee (commit)
from daf82719340fb79ebe7dcdd4a5f7e9550b2b903e (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=6299876e78bb2a977429a118e97cc3e1f14f41ee
commit 6299876e78bb2a977429a118e97cc3e1f14f41ee
Author: amet <[email protected]>
Date: Sat Oct 15 00:23:52 2011 +0400
[script.mpdc] -v 2.0.5
- fixed: unable to start/connect on appletv boxes
- fixed: handling backspace keys
- added: server outputs are listed, can be enabled/disabled
- added: volume control buttons - for cases when volUP/volDOWN do not work
(appletv)
diff --git a/script.mpdc/addon.xml b/script.mpdc/addon.xml
index fed59d5..a778afa 100644
--- a/script.mpdc/addon.xml
+++ b/script.mpdc/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.mpdc"
name="MPD Client"
- version="2.0.4"
+ version="2.0.5"
provider-name="lzoubek">
<requires>
<import addon="xbmc.python" version="2.0"/>
diff --git a/script.mpdc/changelog.txt b/script.mpdc/changelog.txt
index 1e33089..f375276 100644
--- a/script.mpdc/changelog.txt
+++ b/script.mpdc/changelog.txt
@@ -1,3 +1,8 @@
+[B]2.0.5[/B]
+- fixed: unable to start/connect on appletv boxes
+- fixed: handling backspace keys
+- added: server outputs are listed, can be enabled/disabled
+- added: volume control buttons - for cases when volUP/volDOWN do not work
(appletv)
[B]2.0.4[/B]
- released for eden
[B]1.0.4[/B]
diff --git a/script.mpdc/default.py b/script.mpdc/default.py
index f6e38bb..c5a7e79 100644
--- a/script.mpdc/default.py
+++ b/script.mpdc/default.py
@@ -23,12 +23,12 @@ import xbmc,xbmcaddon,xbmcgui,xbmcplugin
__scriptid__ = 'script.mpdc'
__addon__ = xbmcaddon.Addon(id=__scriptid__)
SERVER_LIST = 120
-ACTION_CLOSE = [9,10]
+ACTION_CLOSE = [9,10,92]
STATUS = 100
SETTINGS = 101
sys.path.append( os.path.join ( __addon__.getAddonInfo('path'),
'resources','lib') )
-import gui,xbmpc,dialog
-
+import gui,xbmpc
+import mpdcdialog as dialog
STATUS_ON='on'
STATUS_OFF='off'
STR_CONNECTING=__addon__.getLocalizedString(30007)
diff --git a/script.mpdc/resources/lib/gui.py b/script.mpdc/resources/lib/gui.py
index 840d1ff..26d3f7c 100644
--- a/script.mpdc/resources/lib/gui.py
+++ b/script.mpdc/resources/lib/gui.py
@@ -20,7 +20,8 @@
# */
import sys,os,time,re,traceback,threading
import xbmc,xbmcaddon,xbmcgui,xbmcplugin
-import pmpd,xbmpc,dialog,albumart,playercontrols
+import pmpd,xbmpc,albumart,playercontrols
+import mpdcdialog as dialog
__scriptid__ = 'script.mpdc'
__addon__ = xbmcaddon.Addon(id=__scriptid__)
__scriptname__ = __addon__.getAddonInfo('name')
@@ -40,7 +41,8 @@ ACTIONS = dict({
'107':'self._action_mousemove()',
'117':'self._context_menu()',
'88':'self._volume(88)',
- '89':'self._volume(89)'
+ '89':'self._volume(89)',
+ '92':'self._action_back()'
})
CLICK_ACTIONS = dict({
'1401':'self._playlist_contextmenu()',
@@ -48,7 +50,10 @@ CLICK_ACTIONS = dict({
'1301':'self._update_artist_browser(artist_item=self.getControl(1301).getSelectedItem())',
'1201':'self._update_file_browser(browser_item=self.getControl(1201).getSelectedItem())',
'2000':'self._playback_click()',
- '3000':'self._player_control_click()'
+ '2502':'self._volume(89)',
+ '2503':'self._volume(88)',
+ '3000':'self._player_control_click()',
+ '3101':'self._toggle_output()'
})
PLAYER_CONTROL_ACTIONS = dict({
'repeat0':'self.client.repeat(1)',
@@ -59,6 +64,7 @@ PLAYER_CONTROL_ACTIONS = dict({
'consume1':'self.client.consume(0)',
'single0':'self.client.single(1)',
'single1':'self.client.single(0)',
+ 'outputs0':'self._show_outputs()'
})
PLAYBACK_ACTIONS={
'pause':'self.client.play()',
@@ -71,7 +77,8 @@ ACTION_VOLUME_UP=88
ACTION_VOLUME_DOWN=89
# control IDs
TAB_CONTROL=1000
-VOLUME = 2001
+VOLUME_GROUP = 2500
+VOLUME_STATUS = 2501
CURRENT_PLAYLIST = 1101
FILE_BROWSER = 1201
PROFILE=101
@@ -87,6 +94,8 @@ SONG_INFO_ALBUM=994
SONG_INFO_ALBUM_IMAGE=995
PLAYBACK=2000
PLAYER_CONTROL=3000
+OUTPUTS_SETTING=3100
+OUTPUTS_LIST=3101
#String IDs
STR_STOPPED=__addon__.getLocalizedString(30003)
STR_PAUSED=__addon__.getLocalizedString(30004)
@@ -153,7 +162,7 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
self.is_play_stream = False
if self.addon.getSetting(self.profile_id+'_play_stream') ==
'true':
self.is_play_stream = True
- art_dir = os.path.join(
self.addon.getAddonInfo('profile'),'albums' )
+ art_dir = xbmc.translatePath(os.path.join(
self.addon.getAddonInfo('profile'),'albums'))
if not os.path.exists(art_dir):
os.makedirs(art_dir)
fetcher_setting = self.addon.getSetting('fetch-albums')
@@ -171,13 +180,15 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
def onFocus (self,controlId ):
self.controlId=controlId
if controlId == PLAYLIST_BROWSER:
- self._update_playlist_details()
+ return self._update_playlist_details()
+ if controlId == PLAYER_CONTROL:
+ return
self.getControl(OUTPUTS_SETTING).setVisible(False)
def onInit (self ):
+ self.getControl(OUTPUTS_SETTING).setVisible(False)
self.getControl(SONG_INFO_ALBUM_IMAGE).setVisible(self.album_fetch_enabled)
self.getControl( PROFILE ).setLabel(self.profile_name)
self.controls.init_playback_controls(self.getControl(PLAYBACK))
-
self.controls.init_player_controls(self.getControl(PLAYER_CONTROL))
self._connect()
def _connect(self):
@@ -198,11 +209,14 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
return
print 'Connected'
try:
+ status = self.client.status()
+
self.controls.init_player_controls(self.getControl(PLAYER_CONTROL),status)
self._status_notify(self.mpd_host+':'+self.mpd_port,STR_CONNECTED)
+ self._create_outputs()
p.update(25,STR_GETTING_QUEUE)
self._force_settings()
self._handle_changes(self.client,['mixer','playlist','player','options'])
-
self._handle_time_changes(self.client,self.client.status())
+ self._handle_time_changes(self.client,status)
p.update(50,STR_GETTING_PLAYLISTS)
self._update_file_browser()
self._update_playlist_browser(self.client)
@@ -288,6 +302,34 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
def _is_stream(self,name):
return name.startswith('http')
+ def _create_outputs(self):
+ try:
+ self.getControl(OUTPUTS_LIST).reset()
+ for output in self.client.outputs():
+ item =
xbmcgui.ListItem(label=output['outputname'])
+
item.setProperty('outputenabled',output['outputenabled'])
+ item.setProperty('outputid',output['outputid'])
+ if output['outputenabled'] == '1':
+
item.setIconImage('radiobutton-focus.png')
+ else:
+
item.setIconImage('radiobutton-nofocus.png')
+ self.getControl(OUTPUTS_LIST).addItem(item)
+ except:
+ traceback.print_exc()
+
+ def _show_outputs(self):
+ self.getControl(OUTPUTS_SETTING).setVisible(True)
+ self.setFocus(self.getControl(OUTPUTS_LIST))
+
+ def _toggle_output(self):
+ item = self.getControl(OUTPUTS_LIST).getSelectedItem()
+ if not item == None:
+ outputid = item.getProperty('outputid')
+ if item.getProperty('outputenabled') == '1':
+ self.client.disableoutput(outputid)
+ else:
+ self.client.enableoutput(outputid)
+
def _update_song_info(self,current, status):
self.getControl(SONG_INFO_GROUP).setVisible(self.time_polling)
self._update_song_item(current)
@@ -325,13 +367,13 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
client = self.client
if artist_item==None:
self.getControl(ARTIST_BROWSER).reset()
- artists = self.client.list('artist')
- artists.sort()
+ #artists = self.client.list('artist')
+ #artists.sort()
listitem = xbmcgui.ListItem(label='..')
listitem.setIconImage('DefaultFolderBack.png')
listitem.setProperty('type','')
self.getControl(ARTIST_BROWSER).addItem(listitem)
- for item in artists:
+ for item in self.client.list('artist'):
if not item=='':
listitem = xbmcgui.ListItem(label=item)
listitem.setProperty('artist',item)
@@ -402,13 +444,18 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
volume = volume - 5
elif action == ACTION_VOLUME_UP:
volume = volume + 5
- if volume >=0 or volume <=100:
+ if volume >=0 and volume <=100:
self.client.setvol(volume)
def _update_playlist_browser(self,client):
pos = self.getControl(PLAYLIST_BROWSER).getSelectedPosition()
self.getControl(PLAYLIST_BROWSER).reset()
- self.playlists = client.listplaylists()
+ self.playlists = []
+ try:
+ self.playlists = client.listplaylists()
+ except:
+ #in case server does not support this command
+ pass
for item in self.playlists:
item['data'] = client.listplaylistinfo(item['playlist'])
time = 0
@@ -521,12 +568,12 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
def _update_volume(self,state):
if state['volume']=='-1':
- self.getControl(VOLUME).setVisible(False)
+ self.getControl(VOLUME_GROUP).setVisible(False)
self._can_volume=False
else:
self._can_volume=True
- self.getControl(VOLUME).setVisible(True)
- self.getControl(VOLUME).setPercent(int(state['volume']))
+ self.getControl(VOLUME_GROUP).setVisible(True)
+
self.getControl(VOLUME_STATUS).setPercent(int(state['volume']))
def _update_player_controls(self,current,state):
self.controls.update_playback_controls(self.getControl(PLAYBACK),state)
@@ -560,6 +607,8 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
self._update_artist_browser(client=poller_client)
if change == 'playlist':
self._update_current_queue(client=poller_client)
+ if change == 'output':
+ self._create_outputs()
# print 'Changes handled'
def _format_time(self,time):
@@ -923,6 +972,7 @@ class GUI ( xbmcgui.WindowXMLDialog ) :
self.client.seekid(seekid,0)
def onAction(self, action):
+ # print 'Action id=%s buttonCode=%s amount1=%s amount2=%s' %
(action.getId(),action.getButtonCode(),action.getAmount1(),action.getAmount2())
if str(action.getId()) in ACTIONS:
command = ACTIONS[str(action.getId())]
# print 'action: '+command
diff --git a/script.mpdc/resources/lib/playercontrols.py
b/script.mpdc/resources/lib/playercontrols.py
index f0114ec..049ca79 100644
--- a/script.mpdc/resources/lib/playercontrols.py
+++ b/script.mpdc/resources/lib/playercontrols.py
@@ -17,7 +17,8 @@ ctrls = {
'single1':['SingleOnNF.png','SingleOnFO.png'],
'consume':['ConsumeOffNF.png','ConsumeOffFO.png'],
'consume0':['ConsumeOffNF.png','ConsumeOffFO.png'],
- 'consume1':['ConsumeOnNF.png','ConsumeOnFO.png']
+ 'consume1':['ConsumeOnNF.png','ConsumeOnFO.png'],
+ 'outputs':['OSDAudioNF.png','OSDAudioFO.png']
},
'PM3.HD': {
'prev':['PlayerControls-PrevNF.png','PlayerControls-PrevFO.png'],
@@ -58,6 +59,9 @@ ctrls = {
'consume1':['player-repeatall-nofocus.png','player-repeatall-focus.png']
}
}
+
+pl_ctrl_types = ['random','repeat','single','consume']
+
class Controls(object):
def __init__(self,theme):
self._theme=theme
@@ -81,9 +85,13 @@ class Controls(object):
ctr
def init_playback_controls(self,listview):
listview.addItems([self._create_control('prev'),self._create_control('stop'),self._create_control('pause'),self._create_control('next')])
- def init_player_controls(self,listview):
-
listview.addItems([self._create_control('random'),self._create_control('repeat'),self._create_control('single'),self._create_control('consume')])
-
+
+ def init_player_controls(self,listview,status):
+ for key in pl_ctrl_types:
+ if key in status:
+ listview.addItem(self._create_control(key))
+ listview.addItem(self._create_control('outputs'))
+
def update_playback_controls(self,listview,status):
item = listview.getListItem(2)
state = status['state']
@@ -100,10 +108,11 @@ class Controls(object):
for i in range(0,listview.size()):
item = listview.getListItem(i)
name = item.getProperty('label')
- img = self._get_image(name+status[name])
- item.setProperty('state',status[name])
- item.setIconImage(img[0])
- item.setThumbnailImage(img[1])
+ if name in pl_ctrl_types:
+ img = self._get_image(name+status[name])
+ item.setProperty('state',status[name])
+ item.setIconImage(img[0])
+ item.setThumbnailImage(img[1])
diff --git a/script.mpdc/resources/lib/xbmpc.py
b/script.mpdc/resources/lib/xbmpc.py
index fa398d9..586a3af 100644
--- a/script.mpdc/resources/lib/xbmpc.py
+++ b/script.mpdc/resources/lib/xbmpc.py
@@ -361,10 +361,12 @@ class MPDClient(object):
return sock
def _connect_tcp(self, host, port):
- try:
- flags = socket.AI_ADDRCONFIG
- except AttributeError:
- flags = 0
+ flags = 0
+ # fix for AppleTV v2 devices
+ #try:
+ # flags = socket.AI_ADDRCONFIG
+ #except AttributeError:
+ # flags = 0
msg = "getaddrinfo returns an empty list"
for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
socket.SOCK_STREAM, socket.IPPROTO_TCP,
diff --git a/script.mpdc/resources/skins/Confluence/720p/mpd-client-main.xml
b/script.mpdc/resources/skins/Confluence/720p/mpd-client-main.xml
index 4e3c297..b9e2f06 100644
--- a/script.mpdc/resources/skins/Confluence/720p/mpd-client-main.xml
+++ b/script.mpdc/resources/skins/Confluence/720p/mpd-client-main.xml
@@ -193,7 +193,7 @@
</control>
<control type="group" id="600">
- <posx>1050</posx>
+ <posx>1034</posx>
<posy>25</posy>
<description>player control group</description>
<control type="list" id="2000">
@@ -234,26 +234,52 @@
<visible>Control.HasFocus(2000)</visible>
</control>
</focusedlayout>
- </control>
- <control type="progress" id="2001">
- <posx>0</posx>
- <posy>55</posy>
- <height>16</height>
- <width>200</width>
</control>
+ <control type="group" id="2500">
+ <posx>0</posx>
+ <posy>0</posy>
+ <control type="progress" id="2501">
+ <posx>16</posx>
+ <posy>55</posy>
+ <height>16</height>
+ <width>168</width>
+ </control>
+ <control type="button" id="2502">
+ <posx>-16</posx>
+ <posy>48</posy>
+ <height>32</height>
+ <width>32</width>
+ <onup>2000</onup>
+ <ondown>3000</ondown>
+ <onright>2503</onright>
+ <texturefocus>volume-downFO.png</texturefocus>
+
<texturenofocus>volume-downNF.png</texturenofocus>
+ </control>
+ <control type="button" id="2503">
+ <posx>184</posx>
+ <posy>48</posy>
+ <height>32</height>
+ <width>32</width>
+ <onup>2000</onup>
+ <ondown>3000</ondown>
+ <onleft>2502</onleft>
+ <texturefocus>volume-upFO.png</texturefocus>
+ <texturenofocus>volume-upNF.png</texturenofocus>
+ </control>
</control>
+ </control>
<control type="group" id="7000">
- <posx>1050</posx>
+ <posx>1010</posx>
<posy>150</posy>
<description>playing control group</description>
<control type="list" id="3000">
<posx>0</posx>
<posy>0</posy>
- <width>200</width>
+ <width>250</width>
<height>50</height>
<ondown>1000</ondown>
- <onup>2000</onup>
+ <onup>2500</onup>
<onleft>1000</onleft>
<viewtype>wrap</viewtype>
<orientation>horizontal</orientation>
@@ -261,34 +287,107 @@
<scrolltime>200</scrolltime>
<itemlayout width="50" height="50">
<control type="image">
- <posx>0</posx>
- <posy>0</posy>
- <width>48</width>
- <height>48</height>
- <info>ListItem.ActualIcon</info>
- </control>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>48</width>
+ <height>48</height>
+ <info>ListItem.ActualIcon</info>
+ </control>
</itemlayout>
<focusedlayout width="50" height="50">
- <control type="image">
- <posx>0</posx>
- <posy>0</posy>
- <width>48</width>
- <height>48</height>
- <info>ListItem.ActualIcon</info>
- </control>
- <control type="image">
- <posx>0</posx>
- <posy>0</posy>
- <width>48</width>
- <height>48</height>
- <info>ListItem.Thumb</info>
-
<visible>Control.HasFocus(3000)</visible>
- </control>
- </focusedlayout>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>48</width>
+ <height>48</height>
+ <info>ListItem.ActualIcon</info>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>48</width>
+ <height>48</height>
+ <info>ListItem.Thumb</info>
+
<visible>Control.HasFocus(3000)</visible>
+ </control>
+ </focusedlayout>
</control>
-
</control>
+ <control type="group" id="3100">
+ <posx>900</posx>
+ <posy>200</posy>
+ <description>backgrounds</description>
+ <visible>Control.HasFocus(3101)</visible>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>360</width>
+ <height>310</height>
+ <texture border="40">ContentPanel.png</texture>
+ </control>
+ <control type="list" id="3101">
+ <posx>10</posx>
+ <posy>10</posy>
+ <onup>3000</onup>
+ <onleft>3000</onleft>
+ <onright>3000</onright>
+ <width>350</width>
+ <height>300</height>
+ <focusposition>0</focusposition>
+ <scrolltime>200</scrolltime>
+ <itemlayout width="350" height="50">
+ <control type="image">
+ <posx>0</posx>
+ <posy>7</posy>
+ <width>32</width>
+ <height>32</height>
+ <info>ListItem.ActualIcon</info>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>350</width>
+ <height>48</height>
+
<texture>MenuItemNF.png</texture>
+ </control>
+ <control type="label">
+ <posx>35</posx>
+ <posy>0</posy>
+ <width>310</width>
+ <height>50</height>
+ <textcolor>white</textcolor>
+ <aligny>center</aligny>
+ <info>ListItem.Label</info>
+ </control>
+ </itemlayout>
+ <focusedlayout width="350" height="50">
+ <control type="image">
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>350</width>
+ <height>48</height>
+
<texture>MenuItemFO.png</texture>
+ </control>
+ <control type="image">
+ <posx>0</posx>
+ <posy>7</posy>
+ <width>32</width>
+ <height>32</height>
+ <info>ListItem.ActualIcon</info>
+ </control>
+ <control type="label">
+ <posx>35</posx>
+ <posy>0</posy>
+ <width>310</width>
+ <height>50</height>
+ <textcolor>white</textcolor>
+ <aligny>center</aligny>
+ <info>ListItem.Label</info>
+ </control>
+ </focusedlayout>
+ </control>
+ </control>
<control type="group" id="1099">
<posx>10</posx>
<posy>200</posy>
-----------------------------------------------------------------------
Summary of changes:
script.mpdc/addon.xml | 2 +-
script.mpdc/changelog.txt | 5 +
script.mpdc/default.py | 6 +-
script.mpdc/resources/lib/gui.py | 82 ++++++++--
.../resources/lib/{dialog.py => mpdcdialog.py} | 0
script.mpdc/resources/lib/playercontrols.py | 25 ++-
script.mpdc/resources/lib/xbmpc.py | 10 +-
.../skins/Confluence/720p/mpd-client-main.xml | 165 ++++++++++++++++----
.../skins/Confluence/media/OSDAudioFO.png | Bin 0 -> 5688 bytes
.../skins/Confluence/media/OSDAudioNF.png | Bin 0 -> 1087 bytes
.../skins/Confluence/media/volume-downFO.png | Bin 3356 -> 4519 bytes
.../skins/Confluence/media/volume-downNF.png | Bin 0 -> 883 bytes
.../skins/Confluence/media/volume-upFO.png | Bin 3436 -> 4526 bytes
.../skins/Confluence/media/volume-upNF.png | Bin 0 -> 878 bytes
14 files changed, 230 insertions(+), 65 deletions(-)
rename script.mpdc/resources/lib/{dialog.py => mpdcdialog.py} (100%)
create mode 100644 script.mpdc/resources/skins/Confluence/media/OSDAudioFO.png
create mode 100644 script.mpdc/resources/skins/Confluence/media/OSDAudioNF.png
copy script.cdartmanager/resources/skins/Default/media/default-scroll-down.png
=> script.mpdc/resources/skins/Confluence/media/volume-downFO.png (59%)
create mode 100644
script.mpdc/resources/skins/Confluence/media/volume-downNF.png
copy
script.cdartmanager/resources/skins/Default/media/default-scroll-down-focus.png
=> script.mpdc/resources/skins/Confluence/media/volume-upFO.png (59%)
create mode 100644 script.mpdc/resources/skins/Confluence/media/volume-upNF.png
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons