Kodi Community Forum

Full Version: Complete album track list on home screen - best way?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
What the title says, basically. What's the best way, if there is a way, to fill a list control with the currently playing album while on the home screen?
I added the content manually. If there's a simpler way, I'm all up for it.

Code:
<content>
    <item>
        <label>$INFO[MusicPlayer.Offset(1).Artist]: $INFO[MusicPlayer.Offset(1).Title]</label>
        <property name="Number">1.</property>
        <onclick>Playlist.PlayOffset(1)</onclick>
        <visible>!String.IsEmpty(MusicPlayer.Offset(1).Title)</visible>
    </item>
    <item>
        <label>$INFO[MusicPlayer.Offset(2).Artist]: $INFO[MusicPlayer.Offset(2).Title]</label>
        <property name="Number">2.</property>
        <onclick>Playlist.PlayOffset(2)</onclick>
        <visible>!String.IsEmpty(MusicPlayer.Offset(2).Title)</visible>
    </item>
    ...
    ...
</content>
Hi ,

i also want something like that..
@Gade where do i put this code?
Put it inside a container (list, panel or whatever), and add as many items as you find suitable.
You can add a thumb, fanart etc. as well.
I do the same Gade but isn't that for the 'Next:' list rather than a full album list which djh is after?
You actually right Wink

Didn't think of that...


EDIT: See my possible solution below.
(2017-02-17, 12:49)Mike_Doc Wrote: [ -> ]I do the same Gade but isn't that for the 'Next:' list rather than a full album list which djh is after?

In A:Z I use a negative offset to get the previous tracks. I go twenty tracks either side.
With this code you can use ListItem.Property(TrackNumber) to get the position of the track in the playlist and the onclick will play that track.

Code:
<item>
    <label>$INFO[MusicPlayer.offset(-1).Title]</label>
    <label2>$INFO[MusicPlayer.offset(-1).Duration]</label2>
    <property name="TrackNumber">$INFO[MusicPlayer.offset(-1).PlaylistPosition]</property>
    <onclick>Playlist.PlayOffset(-1)</onclick>
    <visible>MusicPlayer.offset(-1).Exists</visible>
</item>
<item>
    <label>$INFO[MusicPlayer.offset(0).Title]</label>
    <label2>$INFO[MusicPlayer.offset(0).Duration]</label2>
    <property name="TrackNumber">$INFO[MusicPlayer.offset(0).PlaylistPosition]</property>
    <property name="IsPlaying">1</property>
    <onclick>Playlist.PlayOffset(0)</onclick>
    <visible>MusicPlayer.offset(0).Exists</visible>
</item>
<item>
    <label>$INFO[MusicPlayer.offset(1).Title]</label>
    <label2>$INFO[MusicPlayer.offset(1).Duration]</label2>
    <property name="TrackNumber">$INFO[MusicPlayer.offset(1).PlaylistPosition]</property>
    <onclick>Playlist.PlayOffset(1)</onclick>
    <visible>MusicPlayer.offset(1).Exists</visible>
</item>

Here's the full content code to save the effort (though the increment number plugin in sublimetext makes quick work of this...)
http://pastebin.com/raw/5hZKZ6Nd
I haven't tried this, but to display items only from the album currently playing:

Something like
Code:
<visible>!String.IsEmpty(MusicPlayer.Offset(1).Title) + String.IsEqual(MusicPlayer.Album,MusicPlayer.Offset(1).Album)</visible>

Code:
<visible>!String.IsEmpty(MusicPlayer.Offset(2).Title) + String.IsEqual(MusicPlayer.Album,MusicPlayer.Offset(2).Album)</visible>

And also use negative values
Code:
<visible>!String.IsEmpty(MusicPlayer.Offset(-2).Title) + String.IsEqual(MusicPlayer.Album,MusicPlayer.Offset(-2).Album)</visible>

Etc.


Example:
Code:
<item>
    <label>$INFO[MusicPlayer.Offset(2).Artist]: $INFO[MusicPlayer.Offset(2).Title]</label>
    <label2>$LOCALIZE[558]: $INFO[MusicPlayer.Album]</label2>
    <onclick>Playlist.PlayOffset(2)</onclick>
    <visible>!String.IsEmpty(MusicPlayer.Offset(2).Title) + String.IsEqual(MusicPlayer.Album,MusicPlayer.Offset(2).Album)</visible>
</item>
Wouldn't MusicPlayer.Position() be a better infolabel to use if you were trying to display the album tracklist?
(2017-02-17, 15:25)djh_ Wrote: [ -> ]Wouldn't MusicPlayer.Position() be a better infolabel to use if you were trying to display the album tracklist?

Yeah if you just wanted to display it. I wanted something clickable where you could switch to a different track in the playlist and the only command I could find to do that was Playlist.PlayOffset so needed the offset instead.
Or can't believe I didn't think of this before. Just use a list control filled with dynamic content

Code:
<content target="music">playlistmusic://</content>

EDIT: Although it seems like if you click the list it will play the song but clear the playlist (i.e. the playlist becomes only that song). Knew there must've been a reason I hadn't done this before. Although its a quick way to display the now playing tracklist....
Maybe you can fix that by adding an overriding onclick with PlayMedia?
(2017-02-17, 15:43)jurialmunkey Wrote: [ -> ]
(2017-02-17, 15:25)djh_ Wrote: [ -> ]Wouldn't MusicPlayer.Position() be a better infolabel to use if you were trying to display the album tracklist?

Yeah if you just wanted to display it. I wanted something clickable where you could switch to a different track in the playlist and the only command I could find to do that was Playlist.PlayOffset so needed the offset instead.

Ah, I see. Yeah, I need it to be clickable. I'll give your previous advice a try this evening.
This is for player...If you change into ListItem You can set dynamic list to regular widget or in list for Album
List is "clickable" Smile

Code:
            <control type="panel" id="777">
                <top>0</top>
                <width>540</width>
                <height>500</height>
                <onleft>149</onleft>
                <onright>149</onright>
                <orientation>vertical</orientation>
                <content sortby="track" sortorder="ascending">$INFO[Player.FolderPath]</content>
                <itemlayout height="32" width="540">
                    <control type="label">
                        <left>10</left>
                        <height>30</height>
                        <width>540</width>
                        <aligny>center</aligny>
                        <label>$INFO[ListItem.Label]</label>
                        <font>Font_button</font>
                        <visible>String.Contains(ListItem.Label,.mp3)</visible>
                    </control>
                </itemlayout>
                <focusedlayout height="32" width="540">
                    <control type="image">
                        <left>10</left>
                        <top>0</top>
                        <width>542</width>
                        <height>32</height>
                        <texture>settings_button_focus.png</texture>
                        <visible>String.Contains(ListItem.Label,.mp3)+Control.HasFocus(777)</visible>
                    </control>
                    <control type="label">
                        <left>10</left>
                        <height>30</height>
                        <width>540</width>
                        <aligny>center</aligny>
                        <label>$INFO[ListItem.Label]</label>
                        <font>Font_button</font>
                        <visible>String.Contains(ListItem.Label,.mp3)</visible>
                    </control>
                </focusedlayout>
                </control>

Isue in this list is Showing Art as label (All file in folder and can open) Sad
(2017-02-17, 15:47)jurialmunkey Wrote: [ -> ]Or can't believe I didn't think of this before. Just use a list control filled with dynamic content

Code:
<content target="music">playlistmusic://</content>

EDIT: Although it seems like if you click the list it will play the song but clear the playlist (i.e. the playlist becomes only that song). Knew there must've been a reason I hadn't done this before. Although its a quick way to display the now playing tracklist....

This works perfectly, to the point where I can even select tracks from the list. BUT... the playlist doesn't update if you change album: it still displays the original one. What am I doing wrong?

EDIT: Seems you have to wait for the next track to come along before the playlist updates.

EDIT: Nope, wait, not even that does it. Just seems to update itself after a while. Not very useful that way unless you can force it to refresh.
Pages: 1 2