From 90a36cfa17809bef6053b66a4389f73fca0e7c32 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 31 Dec 2011 02:17:40 +0530 Subject: [PATCH] use Ox.localStorage --- .../management/commands/import_streams.py | 1 + pandora/templates/index.html | 4 +-- static/js/pandora.js | 25 +++++++++---------- static/js/pandora/menu.js | 10 ++++---- vm/build.sh | 2 ++ 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/pandora/archive/management/commands/import_streams.py b/pandora/archive/management/commands/import_streams.py index 0abd0b72..9b4dbe09 100644 --- a/pandora/archive/management/commands/import_streams.py +++ b/pandora/archive/management/commands/import_streams.py @@ -47,6 +47,7 @@ class Command(BaseCommand): for s in models.Stream.objects.exclude(format=format, resolution=resolution).filter(source=None): s.source = models.Stream.objects.get(file=s.file, resolution=resolution, format=format) s.save() + print "update streams" for s in models.Stream.objects.filter(source=None): if not glob("%s*"%s.timeline_prefix): s.make_timeline() diff --git a/pandora/templates/index.html b/pandora/templates/index.html index b74d2751..e2d23ebf 100644 --- a/pandora/templates/index.html +++ b/pandora/templates/index.html @@ -10,8 +10,8 @@ diff --git a/static/js/pandora.js b/static/js/pandora.js index abe406e9..a747faf5 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -31,8 +31,9 @@ appPanel } catch(e) {} }; - var debug = localStorage && localStorage.pandoraDebug, - theme = localStorage && localStorage.OxTheme || 'modern'; + var debug = localStorage && localStorage['pandora.debug'], + theme = localStorage && localStorage['Ox.theme'] + && JSON.parse(localStorage['Ox.theme']) || 'modern'; loadImages(function(images) { loadScreen(images); @@ -143,7 +144,10 @@ appPanel } function loadPandora(browserSupported) { - window.pandora = Ox.App({url: '/api/'}).bindEvent({ + window.pandora = Ox.App({ + name: 'pandora', + url: '/api/', + }).bindEvent({ load: function(data) { data.browserSupported = browserSupported; Ox.extend(pandora, { @@ -152,11 +156,12 @@ appPanel }); loadPandoraFiles(function() { initPandora(data); - if (localStorage && localStorage.pandoraLocal) { + if (pandora.localStorage('local')) { + var url = pandora.localStorage('local'); window.pandora.local = Ox.API({ - 'url': localStorage.pandoraLocal + '/api/' + 'url': url + '/api/' }, function() { - pandora.site.site.videoprefix = localStorage.pandoraLocal; + pandora.site.site.videoprefix = url; }); } }); @@ -166,7 +171,7 @@ appPanel function loadPandoraFiles(callback) { var prefix = '/static/'; - if (localStorage && localStorage.pandoraDebug) { + if (localStorage && localStorage['pandora.debug']) { Ox.getJSON(prefix + 'json/pandora.json', function(files) { var promises = []; files.forEach(function(file) { @@ -268,12 +273,6 @@ appPanel videoFormat: Ox.UI.getVideoFormat(pandora.site.video.formats) }); - /* disabled - if (data.user.level == 'guest' && $.browser.mozilla && !localStorage.OxTheme) { - pandora.user.ui.theme = 'classic'; - } - */ - // set up url controller pandora.URL.init().parse(function() { diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index af3b00bb..38f99c6e 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -144,7 +144,7 @@ pandora.ui.mainMenu = function() { { id: 'clearcache', title: 'Clear Cache'}, { id: 'reloadapplication', title: 'Reload Application'}, { id: 'resetui', title: 'Reset UI Settings'}, - { id: 'debug', title: (localStorage.pandoraDebug?'Disable':'Enable')+' Debug Mode'}, + { id: 'debug', title: (pandora.localStorage('debug')?'Disable':'Enable')+' Debug Mode'}, { id: 'triggererror', title: 'Trigger JavaScript Error'}, ] } ] @@ -293,12 +293,12 @@ pandora.ui.mainMenu = function() { pandora.$ui.appPanel.reload(); }); } else if (data.id == 'debug') { - if(localStorage.pandoraDebug) { - delete localStorage.pandoraDebug; + if(pandora.localStorage('debug')) { + pandora.localStorage.delete('debug'); } else { - localStorage.pandoraDebug = 1; + pandora.localStorage('debug', true); } - that.setItemTitle('debug', (localStorage.pandoraDebug ? 'Disable' : 'Enable') + ' Debug Mode'); + that.setItemTitle('debug', (pandora.localStorage('debug') ? 'Disable' : 'Enable') + ' Debug Mode'); } else if (data.id == 'triggererror') { var e = error; } diff --git a/vm/build.sh b/vm/build.sh index facc8256..da5f13e2 100755 --- a/vm/build.sh +++ b/vm/build.sh @@ -32,6 +32,8 @@ sudo vmbuilder vbox ubuntu --suite=oneiric \ --addpkg python-numpy \ --addpkg python-psycopg2 \ --addpkg python-simplejson \ + --addpkg python-lxml \ + --addpkg python-html5lib \ --addpkg oxtimeline \ --addpkg oxframe \ --addpkg mkvtoolnix \