From 06a9336f8ec31aafe0ef7c9a82598dfda4d9c821 Mon Sep 17 00:00:00 2001 From: Nikolai Kristiansen Date: Thu, 19 May 2011 03:53:35 +0200 Subject: [PATCH] Videos can now be added. Still missing caching of current track and passing of the start-argument to integrate properly --- oliver_screen/initial-data.json | 1 + .../{falling_pieces.js => falling-pieces.js} | 0 .../static/{eq.gif => spectrum-analyzer.gif} | Bin oliver_screen/static/yt.html | 17 ++++++------- .../templates/public/now_playing.html | 4 +-- oliver_screen/tracks/admin.py | 8 +++++- oliver_screen/tracks/models.py | 23 +++++++++++++----- oliver_screen/tracks/views.py | 14 +++++++++-- 8 files changed, 46 insertions(+), 21 deletions(-) create mode 100644 oliver_screen/initial-data.json rename oliver_screen/static/{falling_pieces.js => falling-pieces.js} (100%) rename oliver_screen/static/{eq.gif => spectrum-analyzer.gif} (100%) diff --git a/oliver_screen/initial-data.json b/oliver_screen/initial-data.json new file mode 100644 index 0000000..3ec4c33 --- /dev/null +++ b/oliver_screen/initial-data.json @@ -0,0 +1 @@ +[{"pk": 1, "model": "tracks.lastfmuser", "fields": {"active": true, "name": "kakdns"}}, {"pk": 1, "model": "tracks.youtubevideo", "fields": {"active": true, "start": 0, "artist": "Nero", "videoId": "bE47er6qnqg", "title": "Me & You - Original Mix"}}] diff --git a/oliver_screen/static/falling_pieces.js b/oliver_screen/static/falling-pieces.js similarity index 100% rename from oliver_screen/static/falling_pieces.js rename to oliver_screen/static/falling-pieces.js diff --git a/oliver_screen/static/eq.gif b/oliver_screen/static/spectrum-analyzer.gif similarity index 100% rename from oliver_screen/static/eq.gif rename to oliver_screen/static/spectrum-analyzer.gif diff --git a/oliver_screen/static/yt.html b/oliver_screen/static/yt.html index d01a901..d815fc5 100644 --- a/oliver_screen/static/yt.html +++ b/oliver_screen/static/yt.html @@ -15,11 +15,12 @@ var player; function onYouTubePlayerAPIReady() { player = new YT.Player('player', { - height: '390', - width: '640', - videoId: 'u1zgFlCw8Aw', - controls: 0, - border: 0, + height: '600', + width: '1066', + videoId: 'bE47er6qnqg', + playerVars: { + controls: 0 + }, events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange @@ -30,19 +31,15 @@ // 4. The API will call this function when the video player is ready. function onPlayerReady(event) { event.target.playVideo(); + // stop timer } // 5. The API calls this function when the player's state changes. // The function indicates that when playing a video (state=1), - // the player should play for six seconds and then stop. function onPlayerStateChange(event) { if (event.data == YT.PlayerState.ENDED) { // restart timer } - } - function stopVideo() { - player.stopVideo(); - } diff --git a/oliver_screen/templates/public/now_playing.html b/oliver_screen/templates/public/now_playing.html index c988d3f..cd47069 100644 --- a/oliver_screen/templates/public/now_playing.html +++ b/oliver_screen/templates/public/now_playing.html @@ -1,12 +1,12 @@ {% if now_playing %} {% if now_playing.video %} -