/** * ----------------------------------------------------------------------------- * @package smartVISU * @author Martin Gleiß * @copyright 2012 - 2015 * @license GPL [http://www.gnu.de] * ----------------------------------------------------------------------------- */ /** * Plays a soundfile * * @param {id=} unique id for this widget (optional) * @param {item(bool,num)} the item which triggers playing Notice: The item sets the value to null after playing. * @param {text} the url of the soundfile * @param {value=1} the value which triggers playing (optional, default 1) * @param {text=mpeg} filetype of the soundfile (optional, default 'mpeg' for mp3) * * @author Niko Will, Stefan Widmer * @info Thanks to Mike Koenig for publishing the sample file under Creative Commons Attribution 3.0 on http://soundbible.com/ */ {% macro audio(id, item, file, value, filetype) %} {% endmacro %} /** * Displays an image witch is been reloaded after a given time * * @param {id=} unique id for this widget * @param {text} the path/url or item to the image. For squeezebox create an item with the following value: 'http://IP:PORT/music/current/cover.jpg?player=MACADDRESS'. Furthermore, make sure to list your SV server address/IP in the LMS Server setting Advanced/Security/CORS accepted hosts. * @param {text(none,corner,corner-bottom,fill)=none} the mode: 'none', 'corner', 'corner-bottom', 'fill' (optional, default 'none') (optional) * @param {text=10i} the reload-time in duration-format or defined as an item that retriggers a refresh (optional, default '10i') * @param {image=} the path/url to a default image that is shown on error and startup * @param {text(true,false)=false} set to 'true' in order to load the image by php script, e.g. if image URL contains credentials (optional, default = 'false') * * @see misc/fundamentals#Duration-Format */ {% macro image(id, src, mode, refresh, default_img, localize) %} {% if default_img is empty or (default_img is not empty and not isfile(default_img)) %}{% set default_img = 'pages/base/pics/trans.png' %}{% endif %} multimedia.image {% endmacro %} /** * Standard Multimedia Player * * @param {id} unique id for this widget * @param {item(bool,num)} the item for play/pause * @param {item(bool,num)=} the item for stopping the music (optional) * @param {item(bool,num)=} the item for fast forward and rewind (optional) * @param {item(bool,num)} the item for next an previous playlist title * @param {item(num)=} the item for the position (optional) * @param {item(num)=} the item for the volume (optional) * @param {item(bool,num)=} the item to mute the music (optional) * @param {item(str)=} the item for the song title (optional) * @param {item(str)=} the item for the song artist (optional) * @param {item(bool,num)=} the item for repeat (optional) * @param {item(bool,num)=} the item to load the default playlist (optional) * * @author Axel Otterstätter */ {% macro music(id, item_play, item_stop, item_ff, item_next, item_pos, item_vol, item_mute, item_title, item_artist, item_repeat, item_playlist) %} {% import "@widgets/basic.html" as basic %} {% set uid = uid(page, id) %}
{% if item_vol %}
scale {{ basic.slider(id~'vol', item_vol, 0, 100, 5, 'bottomup') }}
{% endif %}
{% if item_mute %} {{ basic.stateswitch('', item_mute, '', 1, 'audio_volume_mute.svg', 'Mute') }} {% endif %} {% if item_repeat %} {{ basic.stateswitch('', item_repeat, '', '', 'audio_repeat.svg') }} {% endif %} {% if item_playlist %} {{ basic.stateswitch('', item_playlist, '', 1, 'audio_playlist.svg', 'Default Playlist') }} {% endif %}
{% if item_artist %}{{ basic.print('', item_artist) }}   {% endif %} {% if item_title %}{{ basic.print('', item_title) }}{% endif %}
{% if item_pos %}
 
{{ basic.slider(id~'pos', item_pos, 0, 100, 1) }}
{% endif %}
{{ basic.stateswitch('', item_next, '', 0, 'control_arrow_left.svg', 'back') }} {% if item_ff %} {{ basic.stateswitch('', item_ff, '', 0, 'audio_rew.svg', 'rev') }} {% endif %} {{ basic.stateswitch('', item_play, '', '', ['audio_play.svg', 'audio_pause.svg']) }} {% if item_stop %} {{ basic.stateswitch('', item_stop, '', 1, 'audio_stop.svg', 'stop') }} {% endif %} {% if item_ff %} {{ basic.stateswitch('', item_ff, '', 1, 'audio_ff.svg', 'fwd') }} {% endif %} {{ basic.stateswitch('', item_next, '', 1, 'control_arrow_right.svg', 'next') }}
{% endmacro %} /** * A widget to display a slideshow, controlled by items/items * * @param {id=} unique id for this widget (optional) * @param {text} a directory where the pictures are located * @param {value=4} delay between the slides in sec (optional, default: 4 sec) * @param {item(bool,num)=} item to switch to the next slide (optional) * @param {item(bool,num)=} item to switch to the previous slide (optional) (if this is same as item_next: 0 triggers previous, any value greater than 0 triggers next, negative values are ignored) * @param {item(bool,num)=} item to stop the animation (optional) * @param {item(bool,num)=} item to start the animation (optional) (if this is same as item_stop: 0 stops, any value greater than 0 starts, negative values are ignored) * @param {value=0} Show the pictures in reverse order; possible values are 1 or 0 (optional, default 0) * @param {value=0} Show controls; possible values are 1 or 0 (optional, default 0) (they just take effect on the slideshow and do not send anything to backend) * @param {duration=1d} duration until directory content is refreshed in standard duration format (optional, default='1d') * * @author Alex ???, Stefan Widmer, Wolfram v. Hülsen * * @info based on cycle2 jquery-plugin: (c) 2012 M. Alsup; Dual licensed: MIT/GPL * @link http://jquery.malsup.com/cycle2 */ {% macro slideshow(id, dir, delay, item_next, item_prev, item_stop, item_start, reverse, controls, refresh) %} {% set uid = uid(page, id) %} {% if controls %}
prev stop resume next
{% endif %} {% endmacro %} /** * Displays a tv- or radio- station button * * @param {id} unique id for this widget * @param {item(bool,num,str)} an item * @param {image} an icon (e. g. located in pics/station) * @param {text=1} value to send if the button is pressed (optional, default 1) * @param {type=mini} type: 'mini', 'midi' (optional, default: mini) */ {% macro station(id, item, pic, val, type) %} {% import "@widgets/basic.html" as basic %} {% set uid = uid(page, id) %}
{{ basic.stateswitch(id, item, type|default('mini'), val, pic) }}
{% endmacro %} /** * Displays a slider to show and control the current time of a media file. Slider continues to run every second even if time value is not updated by item * * @param {id=} unique id for this widget * @param {item(num)} an item providing the current time of a media file * @param {item(bool)} an item providing info whether song is playing or not (value has to be true or false) * @param {item(num)} an item providing the duration of the same media file * @param {value=5} step in % between updates (optional, default 5) * @param {text(input,handle,both,none)=input} how should the value be shown; possible options: 'input', 'handle', 'both', 'none' (optional, default 'input') */ {% macro timeslider(id, time, play, duration, step, value_display) %} {% endmacro %} /** * A button changing from play to pause and vice versa to control a music/video player * Using the following logic: * current state: play. Click -> pause. Longclick -> stop * current state: pause. Click -> play. Longclick -> stop * current state: stop. Click -> play. * * @param {id=} unique id for this widget (optional) * @param {item(bool,num)} an item for the play command * @param {item(bool,num)} an item for the pause command * @param {item(bool,num)} an item for the stop command * * @author Onkel Andy, Wolfram v. Hülsen (icon display modification) */ {% macro playpause(id, item_play, item_pause, item_stop) %} {% import "@widgets/basic.html" as basic %} {{ basic.icon('audio_stop', 'icon0') }} {% endmacro %}