
# for all pages
player_id|[% myClientState.id %]
webroot|[% webroot %]
[%- FOREACH thisItem = playlist_items %]
	[%- IF thisItem.currentsong %][% previous = thisItem.num - 1 %][% current = thisItem.num %][% next = thisItem.num + 1 %][% LAST %][% END -%]
[%- END -%]
[%- FOREACH thisItem = playlist_items -%]
	[%- IF thisItem.num == previous %]
previoussong|([% "PREV" | string %]) [% thisItem.title %]
	[%- ELSIF thisItem.num == current %]
currentsong|[% thisItem.title %]
currentsongnum|[% thisItem.num %]
	[%- ELSIF thisItem.num == next %]
nextsong|([% "NEXT" | string %]) [% thisItem.title %]
	[%- END %]
	[%- LAST IF thisItem.num > next -%]
[%- END -%]

[%- IF page == 'home' %]
# special vars from home.html
[%- IF additionalLinks.plugins %]
[%- FOREACH link = additionalLinks.plugins %]
[% link.key | string | replace('\s+', '_') %]|[% link.value %]
[%- END -%]
[% END %]
album_count|[% album_count %]
artist_count|[% artist_count %]
song_count|[% song_count %]
playercount|[% playercount %]
[%- END -%]

[%- IF page == 'artwork' %]
# ajaxed artwork browser
start|[% start %]
[%- IF browse_items %][% FOREACH myItem = browse_items %]
[% thisItem = loop.index -%]
# album info for [% thisItem %]
coverthumb_[% thisItem %]|[% myItem.coverThumb %]
album_[% thisItem %]|[% myItem.item %]
albumid_[% thisItem %]|[% myItem.album %]
artist_[% thisItem %]|[% myItem.artist.name %]
[%- IF loop.last %]
last|[% thisItem %]
[%- END %]
[% END %][%- END %]
[%- END -%]

[% IF page == 'playlist' %]
# playlist page only
playlistsize|[% IF myClientState %][% myClientState.playlist.size %][% END %]
[%- FOREACH myItem = playlist_items -%]
[%- IF loop.first %]
first_item|[% myItem.num %]
[%- ELSIF loop.last %]
last_item|[% myItem.num %]
[%- END %]
item_[% myItem.num %]|[% myItem.item %]
title_[% myItem.num %]|[% myItem.title %]
[% IF NOT light %]
artist_[% myItem.num %]|[% PROCESS artistsAsHTML.html itemobj = myItem.itemobj %]
album_[% myItem.num %]|[% myItem.album.title %]
artistid_[% myItem.num %]|[% myItem.itemobj.artist.id %]
albumid_[% myItem.num %]|[% myItem.itemobj.album.id %]
coverthumb_[% myItem.num %]|[% myItem.coverThumb %]
includeAlbum_[% myItem.num %]|[% myItem.includeAlbum %]
includeArtist_[% myItem.num %]|[% myItem.includeArtist %]
nextsongind_[% myItem.num %]|[% myItem.nextsongind %]
odd_[% myItem.num %]|[% myItem.odd %]
[%- END %]
[%- END %]
[% END %]

[% IF page == 'status' %]
# status page only
songtitle|[% itemobj.title %]
[% IF itemobj.isRemoteURL %]streamtitle|[% songtitle %][% END %]
artist|[% itemobj.artist.name %]
album|[% itemobj.album.title %]
genre|[% itemobj.genre.name %]
songtitleid|[% itemobj.id %]
[% IF NOT light %]
artistid|[% itemobj.artist.id %]
albumid|[% itemobj.album.id %]
genreid|[% itemobj.genre.id %]
artisthtml|[% PROCESS artistsAsHTML.html noby=1 %]
artisttext|[% PROCESS artistsAsText.html noby=1 %]
[% END %]

# mm:ss length of song
duration|[% itemobj.duration %]
# mm:ss elapsed
[%- IF songtime == 0 %]
elapsed|0:00
[%- ELSE %]
[%- USE date %]
elapsed|[% date.format(songtime, '%M:%S') %]
[% END %]

[%# USE Dumper; Dumper.dump(itemobj) %]
# length of song
durationseconds|[% durationseconds %]
# elapsed time 
songtime|[% songtime %]
# time remaining 
refresh|[% refresh %]

volume|[% volume %]
mute|[% mute %]

# repeat settings: 0 = no repeat, 1 = repeat song, 2 = repeat playlist 
repeat|[% repeat %]

# shuffle settings: 0 = no shuffle, 1 = shuffle song, 2 = shuffle album 
shuffle|[% shuffle %]

# player on or off
mode|[% mode %]

# status of player: 0 = stopped, 1 = playing, 2 = paused 
playmode|[% IF modestop %]0[% ELSIF modeplay %]1[% ELSIF modepause %]2[% END %]

# status of player in text
playtextmode|
[%- IF modeplay -%][% "PLAYING" | string %]
[%- ELSIF modepause -%][% "PAUSED_ON" | string %]
[%- ELSIF modestop -%][% "STOPPED_ON" | string %]
[% END %]

# length of playlist
songcount|[% songcount %]

# where this track sits on that playlist
thissongnum|[% currentsong %]

player_name|[% player_name %]

# path to cover art 
coverartpath|
[%- IF coverThumb -%][% coverThumb %]
[%- ELSIF itemobj.isRemoteURL -%][% webroot %]html/images/radio.png
[%- ELSE -%][% webroot %]html/images/cover.png
[% END %]

# href for album href
[% strippedURL = albumHRef.replace('href="','') %]
[% strippedURL = strippedURL.replace('"','') %]
albumhref|[% strippedURL %]
[% END %]

