View Full Version : Button Translator and LCD additions
PsyberOne
2006-02-09, 10:18
this is mostly to see if these are even realistic for making an official feature request. i'm trying to build a 1-din xbmc controller and display and would like to be able to access a few extra features through a button as opposed to scrolling through the menu.
add actionstring in buttontranslator for randomize,repeat,repeat1
else if (straction.equals("random")) waction = action_random
else if (straction.equals("repeat")) waction = action_repeat
else if (straction.equals("repeatone")) waction = action_repeat_one
add windowstring for playlists (music & movie) not "now playing" but playlist directory
else if (strwindow.equals("mymusicplaylistdir")) wwindowid = window_music_playlist_dir
else if (strwindow.equals("myvideoplaylistdir")) wwindowid = window_video_playlist_dir
add lcd ?tag? to display rand rep rep-1, normal not selected, inverse selected
<music>
<line>$info[musicplayer.title] - $info[musicplayer.artist]</line>
<line>$info[musicplayer.album]</line>
<line>$info[lcd.playicon] $info[player.time]/$info[player.duration]</line>
<line>| $info[musicplayer.random] | $info[musicplayer.repeat] | $info[musicplayer.repeatone] |</line>
</music>
<video>
<line>$info[videoplayer.title]</line>
<line>$info[lcd.playicon] $info[player.time]/$info[player.duration]</line>
<line>$info[lcd.progressbar]</line>
<line>| $info[videoplayer.random] | $info[videoplayer.repeat] | $info[videoplayer.repeatone] |</line>
</video>
those playlist functions could be exposed but it'll be tricky. there are actually four different playlists (music, music_temp, video, video_temp). the music and video playlists reflect the contents of the appropiate now paying windows. the _temp ones are internal *temporary* playlists that are created when you "play" a folder. as soon as you play something else, those playlists are cleared.
the kink is that each of these has seperate options. this is so you can have music in random, and video normal. and yes, the _temp ones have these options as well, but they are typically not exposed. (the exception is the shuffle button in music library. it affects the music_temp playlist.)
so care will need to be taken when exposing these functions to buttons. the simple thing to do would be to allow those functions affect the currently playing playlist, regardless of which one it may be. thoughts?
you cant simply add window strings for the playlists folders. they are not windows, they are only locations. however, they can be virtual windows. this would require changes to the activatewindow code, but its possible. music acts as a virtual window which opens the last music view (files or library).
and lastly, those info items can certainly be added to xbmc. it would be easiest to just let them reference the options for the currently playing playlist of that type (either the normal one or the _temp one). what would you want to be the actual text thats displayed for each of them?
PsyberOne
2006-02-09, 23:26
first off thanks for the quick response.
the easy part, for the lcd i'm trying to stick to 4 char. so rand rep(space) & rep1, that will allow for ~1/2in buttons under each one.
as far as making the rand, rep, rep1 global keys it would be easier for my application but how much extra work would that be ?
the now playing/temp playlist, the easiest way i can think is to set the keybindings that from library -> temp, playlist -> music, the trick would be jumping to the temp after pressing play (for nav purposes)
pm me and i'll e-mail you the sketch (svg) of what i'm working on
re: adding new playlist actions...
these actions should affect whatever the current playlist is regardless of what it is. they are toggles so, repeated presses will just enable then disable the option. (i'd then want to remove the shuffle button from the music library as it was a hack to begin with.)
the operation will likely be this... if the current playlist is a _temp type, they will be temporary changes. if the current playlist is the standard playlist (ie, the now playing window), then they will persist as if you changed them from the window itself.
re: new playlist info items:
i took a look at the current info items, and the existing "musicplayer.playlistlength" and "musicplayer.playlistposition" work for whatever playlist (music or music_temp) is currently playing so i would want to model after this.
ironically, there isnt a matching "videoplayer.playlistposition" and "videoplayer.playlistlength" so i'll add those first for completeness.
the random/repeat/repeatone info items are more geared towards being visbility conditions since they are already booleans. this would then allow something like this to be done in a skin:
<control>
<description>video repeat all icon</description>
<visible>videoplayer.playlistrepeat</visible>
<texture>repeat_all_icon.png</texture>
</control>
re: opening the playlist location as if its a window...
i verified that this can be accomplished today in a somewhat convoluted fashion. you need to add a share that points to the playlist location like this (music example):
<bookmark>
<name>saved playlists</name>
<path>$musicplaylists</path>
</bookmark>
you can then use this in the skin or in keymap.xml to open the saved playlists folder: xbmc.activatewindow(mymusicfiles,saved playlists)
(for video, just use $videoplaylists as the path in a video bookmark.)
to avoid having to define a bookmark, i think it would be best if each window accepted "$playlists" and opened to the correct folder, like this:
xbmc.activatewindow(mymusicfiles,$playlists)
xbmc.activatewindow(myvideos,$playlists)
PsyberOne
2006-02-11, 10:23
here's the concept so far.
http://img152.imageshack.us/img152/9461/customxbmcdash5cb.png
the one concern i have is that once i select an [album,artist,playlist,etc.] that it goes to the playlist after selecting for nav. purposes, so that using the full screen button flips between the "now playing" and viz. without having to add a now playing button.
i also want to thank you for all your involvment and work, this went from an idea i was kicking around to something i can actually do. :d as soon as i start work (month or so after the code is in) on this i'll be posting pic's somewhere of the process and progress.
semi-related question, how well does software dts/dolby decoding work, i can find any head units that can take an optical or coax in.
i started working on it, and actions are the wrong way to go. it'll use the xbmc.playercontrol() command for consistency. there will be three commands, matching the controls in now playing windows.
xbmc.playercontrol(random)
xbmc.playercontrol(repeat)
xbmc.playercontrol(repeatone)
how they affect the current playlist will remain as i described earlier. the advantage of using functions is these controls can be implemented in both the skin and in the keymap. i'd like to add them to playercontrols.xml skin file but i'm not much of a skinner, so if you could do that for me when its available it'll be great.
last night i added info labels of videoplayer.playlistlength and videoplayer.playlistposition, but now i think there should be a new playlist category of items since they report on all playlists types. i'll leave in the existing ones for backward compatibility, but add these things which will report on whatever the current playlist is:
conditionals:
playlist.israndom
playlist.isrepeat
playlist.isrepeatone
info labels:
playlist.random
playlist.repeat
playlist.repeatone
playlist.length
playlist.position
the conditionals allow what i described before. you can have the condition display an icon like a cd player does. i'm just not sure what text the playlist.random, playlist.repeat, and playlist.repeatone items should return. the easiest way around this is to have them return a string from strings.xml. that way you can change it to whatever you like.
** edit **
i forgot to mention that i also already implemented the way to jump to the saved playlists location using the special $playlists destination in activatewindow. in this case, a matching share is not required.
PsyberOne
2006-02-12, 06:53
i realize this isn't the proper format, but i'm just laying it out to see what buttons need to do what, the stuff in bold is the new stuff, just making sute i've got it right
scroll up{q} [global -> pageup,music -> skipnext,movies -> skipnext]
scroll down{z} [global -> pagedown,music -> skipprevious,movies -> skipprevious]
up{w} [global -> up,music -> bigstepforward,movies -> bigstepforward]
down{x} [global -> down,music -> bigstepback,movies -> big stepback]
left{a} [music -> stepback,movies -> stepback,mymusiclibrary -> parentdir]
right{d} [music -> stepforward,movies -> stepforward]
select{s} [global -> select,music -> queue]
play/pause{e} [global -> play,music -> pause,movies -> pause]
stop{c} [global -> stop]
full screen{n} [music -> fullscreen,movies -> fullscreen]
music{y} [global -> xbmc.activatewindow(mymusic)]
movies{h} [global -> xbmc.activatewindow(mymovies)]
playlist{k} [music -> xbmc.activatewindow(mymusic,$playlists),movies -> xbmc.activatewindow(mymovies,$playlists)]
library{l} [music -> xbmc.activatewindow(mymusiclibrary),movies -> xbmc.activatewindow(mymoviestitle)]
random{m} [global -> xbmc.playercontrol(random)]
repeat{,} [global -> xbmc.playercontrol(repeat)]
repeat one{.} [global -> xbmc.playercontrol(repeatone)]
(*)now playing [music -> playlist,movies -> playlist]
<music>
<line>$info[musicplayer.title] - $info[musicplayer.artist]</line>
<line>$info[musicplayer.album]</line>
<line>$info[lcd.playicon] $info[player.time]/$info[player.duration]</line>
<line> $info[playlist.random] $info[playlist.repeat] $info[playlist.repeatone] |</line>
</music>
<video>
<line>$info[videoplayer.title]</line>
<line>$info[lcd.playicon] $info[player.time]/$info[player.duration]</line>
<line>$info[lcd.progressbar]</line>
<line> $info[playlist.random] $info[playlist.repeat] $info[playlist.repeatone] |</line>
</video>
are playlist.length and playlist.position for time [0:25/2:12] or actual playlist spot [112/4568]
also i'm not that good with skins, but i'm checking with my release group to see if anyone can make the changes
i'm not sure what you're trying to do exactly. nor do i know what you mean by "music->" and "movies->" in those examples. i assume you're refering to the visualisation and fullscreenvideo windows respectively?
player.time and player.duration provide the current time and the total time of the item which would be 0:25/2:12 from your example.
playlist.position and playlist.length (same for the musicplayer and videoplayer specific ones) provide the index of the currently playing item, and the total number of items in the playlist which would be 112/4568 from your example.
PsyberOne
2006-02-12, 17:41
the music and movies are just to i can keep everything straight so i can write the .xml file, it's just a guide for me. the real question is are the commands sound, i want to make sure i can start testing this as soon as the code is in. again i want to thank you for all your help, and sorry for the confusion.
edit: is there any way to have a button do more than one action i.e. <s>play,xbmc.activatewindow(mymusic,$playlist_temp)</s>
jmarshall
2006-02-12, 22:58
my opinion:
the conditionals sound fine, though it'd be kinda nice if we could have a 3 way conditional for the repeat (off, repeat all, repeat one) but as that's not doable with the skin stuff at the moment a separate repeatone will suffice.
as for the info labels, why not combine the repeat ones? (playlist.repeat)
grabbing from strings.xml sounds the best way to do it:
repeat off
repeat one
repeat all
sound fine to me, though ofcourse we only really need "off", "one" and "all" as the repeat string is already available. this keeps it nice and short for the lcd as well.
random is easy enough as well. just off and on is all you need, as some may want to label this as "shuffle" instead.
cheers,
jonathan
i thought of combining them at first but when i checked the now playing window, i found they were implemented as seperate buttons and i wanted to keep the functionality similar. this allows both repeat and repeat one to be selected at the same time.
maybe this first needs to be changed so that the repeat options are mutually exclusive and theres a single button which cycle between off -> one -> all and back around. then the player command could work similiarly.
though, the conditionals will still need to be seperate so that a different icon could be shown based on what type of repeat is enabled.
though, regardless of how the "repeat" option works, i guess it could be done as a single playlist.repeat info item since repeat one overrides repeat all.
the playlist info labels were added. they require some new strings for "off", "random", "one", "all".
** edit **
the new playercontrols were added, but i changed my mind and went back to just two controls as it made more sense:
xbmc.playercontrol(random) = enables/disables randomize
xbmc.playercontrol(repeat) = cycles thru off->all->one->off
last step is to code up the conditionals. i'm rethinking them at the moment. the repeat options add some complexity. because technically, both can be enabled at the same time. the new playercontrol prevents this but the now playing window does not. i may first change the now playing window so that there's a single repeat button which cycles similarly. this should make repeat and repeatone mutually exclusive.
finished. i consolidate the repeat and repeat one buttons in the now playing window into a single button which cycles through the three repeat options. and i added the new visibility conditions.
sorry about this but i changed the strings to allow complete flexibility. now, the strings are not shared so they can be changed without anything in the gui being affected. here's the new string layout, with the default values now in cvs:
used by playlist.random
590: random enabled text, "random"
591: random disabled text, "off"
used by playlist.repeat
592: repeat one text, "one"
593: repeat all text, "all"
594: repeat disabled text, "off"
used by the new repeat button in the now playing windows:
595: repeat disabled text, "repeat off"
596: repeat one text, "repeat one"
597: repeat all text, "repeat all"
lastly, here's a little something you can throw into project mayhem iii/pal/musicvisualisation.xml as a test:
<control>
<description>playlist</description>
<type>label</type>
<id>1</id>
<width>200</width>
<posx>660</posx>
<posy>460</posy>
<label>$info[playlist.random] / $info[playlist.repeat]</label>
<visible>player.showinfo</visible>
<animation effect="fade" time="1000">visiblechange</animation>
<align>right</align>
<font>font10</font>
</control>
<control>
<description>playlist</description>
<type>label</type>
<id>1</id>
<width>200</width>
<posx>660</posx>
<posy>480</posy>
<visible>playlist.israndom</visible>
<label>random: on</label>
<visible>player.showinfo</visible>
<animation effect="fade" time="1000">visiblechange</animation>
<align>right</align>
<font>font10</font>
</control>
<control>
<description>playlist</description>
<type>label</type>
<id>1</id>
<width>200</width>
<posx>660</posx>
<posy>480</posy>
<visible>!playlist.israndom</visible>
<label>random: off</label>
<visible>player.showinfo</visible>
<animation effect="fade" time="1000">visiblechange</animation>
<align>right</align>
<font>font10</font>
</control>
<control>
<description>playlist</description>
<type>label</type>
<id>1</id>
<width>200</width>
<posx>660</posx>
<posy>500</posy>
<visible>playlist.isrepeat</visible>
<label>repeat: all</label>
<visible>player.showinfo</visible>
<animation effect="fade" time="1000">visiblechange</animation>
<align>right</align>
<font>font10</font>
</control>
<control>
<description>playlist</description>
<type>label</type>
<id>1</id>
<width>200</width>
<posx>660</posx>
<posy>500</posy>
<visible>playlist.isrepeatone</visible>
<label>repeat: one</label>
<visible>player.showinfo</visible>
<animation effect="fade" time="1000">visiblechange</animation>
<align>right</align>
<font>font10</font>
</control>
<control>
<description>playlist</description>
<type>label</type>
<id>1</id>
<width>200</width>
<posx>660</posx>
<posy>500</posy>
<visible>!playlist.isrepeat + !playlist.isrepeatone</visible>
<label>repeat: off</label>
<visible>player.showinfo</visible>
<animation effect="fade" time="1000">visiblechange</animation>
<align>right</align>
<font>font10</font>
</control>
PsyberOne
2006-02-15, 00:26
you guys are awesome, i never thought this would get done so fast. i'll test it out when my group releases on friday. i have one last thing and i'll leave you alone, i promise. is there any way to have a button do more than one action i.e. <s>play,xbmc.activatewindow(mymusic,$playlist_temp)</s>
just to reiterate you kick ass!
no, you can only assign a single action to a skin button, or a controller button. and fyi, "xbmc.activatewindow(mymusic,$playlist_temp)" is not a valid action (unless you happen to have a share names $playlist_temp).
there's one thing i just noticed which i still need to rectify. xbmc has four different playlists, and this code affects whatever the "current" playlist is. two of these four playlists are temporary playlists and unfortunately their random and repeat flags are not cleared on re-creation. they should be as they are meant to be internal playlists. i'll hopefully get this minor issue sorted out in a day or two. the worst case scenario is i'm disallow these new actions from affecting the temporary playlists, and can only affect the true playlists (ie, the now playing windows.)
that last little annoyance was corrected. whenever the temp playlists are cleared, so are their options. they return to a virgin state just as if you reloaded xbmc.
PsyberOne
2006-02-21, 09:22
i know i said i wasn't going to bother you anymore but i just started using the new xbmc with all the changes and so far it's awesome.
3 things though-
1: for the random info lable would it be possible to make the random off lable with built in spaces (__off_)
2: is it possible to right justify lables on the lcd
3: everytime i fastforward/rewind etc it jumps from the video/music display to the navigation display is it possible to disable that.
once again the changes rule, i've started building the controller and hopefully will have a prototype within a few weeks
jmarshall
2006-02-21, 09:56
1. lcd.xml should be read with spaces left as is, so you should just be able to do __$info(whatever the info label is for the random off)_ and it should be fine.
2. see 1 - you know the width, so right align should be doable using the same method.
3. sure, this'd be reasonably easy to detect. it currently switches to navigation view based on capplication::getidletime(). what you'd need to do is do a similar function that ignores the actions ffwd and rewd.
cheers,
jonathan
PsyberOne
2006-02-21, 22:24
i guess i should clarify a little bit. for the random it has 2 lables random and off the random takes up 6char and off only 3 so it shifts the display depending on whether its on or off, i am trying to set these up to corrospond to buttons underneath and the shifting test is bad for business. and a similar issue with the right justification, specifically i'm trying to put the playlist.position and playlist.length on the last row all the way to the right unfortunatly the playlists vary from 20 to 300 to 5000 so manual spacing wont work very well for this. again these are very minor issues but i'm a style freak.
you could try modify the string id to add the spaces you need, but i'm not sure if xml will honor the whitespace.