Audio player widget, audio files set by ident or label. Play can be set by JSON.
Below is an Audio1 widget. Click the link to play the audio file.
This table lists the Responders called to produce this page:
skiwidgets,6102 | SubmitData | Sets up title and widget description |
skiwidgets,6104 | This page | links.Audio1 template |
This is a ShowCallData widget, which displays the contents of the skicall.call_data dictionary.
{}
Below is the Python file which populates this page.
import os from skipole import FailPage, GoTo, ValidateError, ServerError, ServeFile, PageData, SectionData # The Audio1 widget needs no setting up, since in this illustration it calls a file page # which links to a wav file in the static directory. So the function below only # sets the title and code in the page def index(skicall): "Called by a SubmitData responder, and sets up the page" # the title and widget decription is in section 'header' which contains a # HeadText widget with name 'title' and a TextBlockPara widget with name 'widgetdesc' # It also has a ButtonLink2 widget with name 'tomodule' headersection = SectionData('header') headersection['title', 'large_text'] = 'Audio1' # A textblock contains the widget description ref = "widgets.links.Audio1" headersection['widgetdesc','textblock_ref'] = ref headersection['widgetdesc','text_refnotfound'] = f'Textblock reference {ref} not found' # link to this widgets module page headersection['tomodule','button_text'] = "Module: links" headersection['tomodule','link_ident'] = skicall.makepath('links') skicall.update(headersection) # this code file contents is placed in section 'codefile' which contains a # PreText widget with name 'pretext' codesection = SectionData('codefile') code = os.path.realpath(__file__) with open(code) as f: codesection['pretext', 'pre_text'] = f.read() skicall.update(codesection)