Mercurial > code > home > repos > light9
changeset 1335:3843f6bd0460
music time fetcher
Ignore-this: c490ec8c59c3f1c5c0c8f7ebd08e0e2c
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sat, 04 Jun 2016 20:43:31 +0000 |
parents | 8406a9fbeb9d |
children | 2d77dc9436c3 |
files | light9/web/light9-music.coffee light9/web/light9-music.html light9/web/timeline-elements.html |
diffstat | 3 files changed, 42 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/light9/web/light9-music.coffee Sat Jun 04 20:43:31 2016 +0000 @@ -0,0 +1,29 @@ +log = console.log + +# port of light9/curvecalc/musicaccess.py +Polymer + is: "light9-music", + properties: + status: { type: String, notify: true } + duration: { type: Number, notify: true } + playing: { type: Boolean, notify: true } + song: { type: String, notify: true } + t: { type: Number, notify: true } + ready: -> + @$.getTime.addEventListener('response', @onResponse.bind(@)) + @$.getTime.addEventListener 'error', (e) => + req = @$.getTime.lastRequest + @status = "GET "+req.url+ " -> " + req.status + " " + req.statusText + setTimeout(@poll.bind(@), 2000) + @poll() + poll: -> + @$.getTime.generateRequest() + @status = "poll" + onResponse: -> + @status = "ok" + setTimeout(@poll.bind(@), 1000) + r = @$.getTime.lastResponse + @duration = r.duration + @playing = r.playing + @song = r.song + @t = r.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/light9/web/light9-music.html Sat Jun 04 20:43:31 2016 +0000 @@ -0,0 +1,11 @@ +<link rel="import" href="/lib/polymer/polymer.html"> +<link rel="import" href="/lib/iron-ajax/iron-ajax.html"> + +<!-- remote control of ascoltami --> +<dom-module id="light9-music"> + <template> + <iron-ajax id="getTime" url="/ascoltami/time"></iron-ajax> + <span>[[status]]</span> + </template> + <script src="light9-music.js"></script> +</dom-module>
--- a/light9/web/timeline-elements.html Sat Jun 04 09:27:38 2016 +0000 +++ b/light9/web/timeline-elements.html Sat Jun 04 20:43:31 2016 +0000 @@ -2,6 +2,7 @@ <link rel="import" href="light9-timeline-audio.html"> <link rel="import" href="/lib/iron-resizable-behavior/iron-resizable-behavior.html"> <link rel="import" href="rdfdb-synced-graph.html"> +<link rel="import" href="light9-music.html"> <!-- Whole editor- include this on your page. @@ -37,6 +38,7 @@ </style> <div> <rdfdb-synced-graph graph="{{graph}}"></rdfdb-synced-graph> + <light9-music></light9-music> timeline editor: song [uri] <button>unlink</button> <label><input type="checkbox"> follow player song choice</label> </div>