Merge branch 'master' of github.com:nikolaik/oliver_screen

This commit is contained in:
nikolark committed 2011-06-14 09:32:44 +02:00
commit b28779bdd7
7 files changed
+49 -18

No files matched your search

-1
View File
@@ -3,4 +3,3 @@
*.swo
settings.py
oliver_screen.sqlite3
django.wsgi
+20 -9
View File
@@ -1,20 +1,31 @@
Requirements
============
* python-django
* python-pylast
* Django
* sudo apt-get install python-django
* mod\_wsgi
* sudo apt-get install libapache2-mod-wsgi
* sudo a2enmod wsgi # enable it in apache.
* pylast
* svn checkout http://pylast.googlecode.com/svn/trunk/ pylast-read-only
* cd pylast-read-only
* sudo python setup.py install
You will also need a LastFM account and a API account (http://www.last.fm/api/account).
Install with Apache
===================
* $ git clone git://github.com/nikolaik/oliver_screen.git
* Move and edit settings-sample.py to suit your needs.
* Make available static files under oliver_screen/oliver_screen/static by symlinking or setup a <Directory> and Alias in your Apache config.
* Set MEDIA_URL to the URL where static files are served.
* Set LASTFM_APIKEY and LASTFM_API_SECRET
* Make sure mod_wsgi is installed and enabled in Apache. First rename and edit django-sample.wsgi. Then setup a WSGIAlias in your apache config pointing to the .wsgi-file.
* $ python manage.py syncdb (creating an admin user)
* Get the code
* $ git clone git://github.com/nikolaik/oliver\_screen.git
* Make available static files under oliver\_screen/oliver\_screen/static by symlinking or setup a <Directory> and Alias in your Apache config.
* Then setup a WSGIScriptAlias in your apache config pointing to the full path of django.wsgi.
* sudo /etc/init.d/apache restart # load new Apache configuration settings
* Copy settings-sample.py to settings.py and edit to suit your needs.
* Set MEDIA\_URL to the URL where static files are served.
* Set LASTFM\_APIKEY and LASTFM\_API\_SECRET
* Create the database.
* $ python manage.py syncdb (creating an admin user)
* Make sure the files have correct permission (readable by www-data).
* If you created a sqlite database, make sure the file is writeable by www-data.
* Goto /admin and login with the admin user, then add a LastFMUser and make it active.
* Setup your music player (f.ex Spotify) to scrobble to that account Last.fm account.
* Goto / and you should be set :=)
@@ -1,9 +1,14 @@
import os
import sys
from os.path import dirname, join
def map_path(target_name=''):
'''Enables path names to be decided at runtime.'''
return join(dirname(__file__), target_name).replace('\\', '/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'oliver_screen.settings'
path = '/home/nikk/dev'
path = map_path("..")
if path not in sys.path:
sys.path.append(path)
import django.core.handlers.wsgi
File renamed without changes.
+1 -2
View File
@@ -75,8 +75,7 @@
/* The API calls this function when the player's state changes. */
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.ENDED) {
// Hide the player when the song ends
$("#player").hide();
/* Could do something on this state or others... */
}
}
</script>
@@ -1,12 +1,18 @@
{% if now_playing %}
{% if now_playing.video %}
<script type="text/javascript">
function other_video_playing() {
var now_playing_pattern = /{{ now_playing.video.videoId }}/;
return ! now_playing_pattern.test( ytplayer.getVideoUrl() );
}
function play() {
if(ytplayer) {
// show the player
$("#player").show();
// start the video (if not playing(1) and not buffering(3))
if( ytplayer.getPlayerState() != 1 && ytplayer.getPlayerState() != 3 ) {
// start the video (if we have'nt allready)
if( other_video_playing() ) {
// show the player
$("#player").show();
ytplayer.loadVideoById("{{ now_playing.video.videoId }}", {{ now_playing.video.start }}, "hd720");
}
}
@@ -14,12 +20,18 @@
play();
</script>
{% else %}
<script type="text/javascript">
$("#player").delay(1000).hide();
</script>
{% if now_playing.image %}
<img src="{{ now_playing.image}}" class="now_playing" /><br />
{% endif %}
{% endif %}
<img src="{{ MEDIA_URL}}spectrum-analyzer.gif" /> {{ now_playing.artist}} - {{ now_playing.title }} ♪♫<br />
{% else %}
<script type="text/javascript">
$("#player").delay(1000).hide();
</script>
<img src="{{ MEDIA_URL}}no_music_makes_me_sick_by_sakgaa.jpg" /><br />
:[
{% endif %}
+6 -1
View File
@@ -3,11 +3,16 @@ from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from os.path import dirname, join
def map_path(target_name):
'''Enables path names to be decided at runtime.'''
return join(dirname(__file__), target_name).replace('\\', '/')
urlpatterns = patterns('',
# static file serving for development (http://docs.djangoproject.com/en/dev/howto/static-files/)
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/home/nikk/dev/edb/oliver_screen/oliver_screen/static'}),
{'document_root': map_path('static')}),
(r'^admin/', include(admin.site.urls)),
(r'^tracks/', include('oliver_screen.tracks.urls')),
(r'^$', include('oliver_screen.main.urls')),