diff --git a/pandora/0xdb.json b/pandora/0xdb.jsonc similarity index 92% rename from pandora/0xdb.json rename to pandora/0xdb.jsonc index 95c86218..fb6ae735 100644 --- a/pandora/0xdb.json +++ b/pandora/0xdb.jsonc @@ -1,11 +1,21 @@ +/* + Pan.do/ra Settings + + You can edit this file. +*/ { + /* + Capabilities are per user level. + They can either be general (true/false) + or related to items (max. item rights level) + */ "capabilities": { "canDeleteItems": {"admin": true}, "canEditItemIcons": {"staff": true, "admin": true}, "canPlayClips": {"guest": 1, "member": 2, "friend": 3, "staff": 4, "admin": 4}, "canPlayVideo": {"guest": 0, "member": 1, "friend": 3, "staff": 4, "admin": 4}, "canReloadMetadata": {"staff": true, "admin": true}, - "canSeeFiles": {"guest": -1, "member": -1, "friend": -1, "staff": 4, "admin": 4}, + "canSeeFiles": {"staff": true, "admin": true}, "canSeeItem": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4}, "canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true} }, @@ -493,6 +503,15 @@ "importMoviePosters": true, "importPosterFrames": true }, + "personalLists": [ + {"id": "favorites", "title": "Favorites"}, + {"id": "most_popular", "title": "Most Popular", "query": {}}, + {"id": "recently_viewed", "title": "Recently Viewed", "query": {}}, + {"id": "1960s", "title": "1960s", "query": {"conditions": [{"key": "year", "value": "196", "operator": "^"}], "operator": "&"}}, + {"id": "movies_with_full_video", "title": "Movies with Full Video", "query": {"conditions": [{"key": "canPlayVideo", "value": true, "operator": "="}], "operator": "&"}}, + {"id": "movies_with_clips", "title": "Movies with Clips", "query": {"conditions": [{"key": "canPlayClips", "value": true, "operator": "="}], "operator": "&"}}, + {"id": "no_tv_series", "title": "No TV Series", "query": {"conditions": [{"key": "isSeries", "value": false, "operator": "="}], "operator": "&"}} + ], "rightsLevel": {"member": 5, "staff": 4, "admin": 3}, "rightsLevels": [ {"name": "Public", "color": [0, 255, 0], "description": "Everyone can see and play."}, @@ -503,6 +522,12 @@ ], "sendReferrer": false, "site": { + "email": { + // E-mail address in contact form (to) + "contact": "0xdb@0xdb.org", + // E-mail address uses by the system (from) + "system": "0xdb@0xdb.org" + }, "id": "{{settings.SITEID}}", "name": "{{settings.SITENAME}}", "url": "{{settings.URL}}" @@ -524,28 +549,6 @@ ], "user": { "level": "guest", - "lists": { - "common": [ - {"id": "all", "title": "All Movies", "query": {}} - ], - "personal": [ - {"user": "foo", "name": "Favorites", "featured": false, "public": true}, - {"id": "favorites", "title": "Favorites", "public": true, "items": []}, - {"id": "most_popular", "title": "Most Popular", "query": {}}, - {"id": "recently_viewed", "title": "Recently Viewed", "query": {}}, - {"id": "1960s", "title": "1960s", "query": {"conditions": [{"key": "year", "value": "196", "operator": "^"}], "operator": "&"}}, - {"id": "movies_with_full_video", "title": "Movies with Full Video", "query": {"conditions": [{"key": "canPlayVideo", "value": true, "operator": ""}], "operator": "&"}}, - {"id": "movies_with_full_video", "title": "Movies with Clips", "query": {"conditions": [{"key": "canPlayClips", "value": true, "operator": ""}], "operator": "&"}} - ], - "favorite": [ - {"id": "rlx:watchme", "title": "rlx: watchme", "public": true, "items": [0, 1, 2, 3, 4]} - ], - "featured": [ - {"id": "situationist_film", "title": "Situationist Film", "query": {}}, - {"id": "timelines", "title": "Timelines", "items": [0, 1, 2, 3, 4, 5, 6, 7, 8]} - ] - }, - "notes": "", "preferences": {}, "ui": { "annotationsSize": 256, @@ -580,6 +583,7 @@ "mapSelection": "", "section": "items", "showAnnotations": true, + "showBrowser": true, "showControls": true, "showFlags": true, "showGroups": true, @@ -588,7 +592,6 @@ "showInfo": true, "showMapControls": false, "showMapLabels": false, - "showMovies": true, "showFolder": { "items": { "personal": true, @@ -609,9 +612,7 @@ "videoVolume": 1 }, "username": "", - "volumes": [ - {"name": "Movies A-Z", "path": "", "items": 1234} - ] + "volumes": [] }, "userLevels": ["guest", "member", "friend", "staff", "admin"], "video": { diff --git a/pandora/app/models.py b/pandora/app/models.py index d9f3ac40..77d0bc28 100644 --- a/pandora/app/models.py +++ b/pandora/app/models.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 from __future__ import division, with_statement + import os import sys import time @@ -8,7 +9,7 @@ import thread from django.db import models from django.conf import settings -from ox.utils import json +import ox.jsonc _win = (sys.platform == "win32") @@ -25,7 +26,7 @@ RUN_RELOADER = True def load_config(): with open(settings.SITE_CONFIG) as f: - config = json.load(f) + config = ox.jsonc.load(f) config['site']['id'] = settings.SITEID config['site']['name'] = settings.SITENAME diff --git a/pandora/padma.json b/pandora/padma.jsonc similarity index 100% rename from pandora/padma.json rename to pandora/padma.jsonc diff --git a/pandora/settings.py b/pandora/settings.py index 1274fd2a..084e48b3 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -25,7 +25,7 @@ ADMINS = ( #('admin', 'admin@example.com'), ) -DEFAULT_FROM_EMAIL='admin@' + URL.split('/')[0] +DEFAULT_FROM_EMAIL='system@' + URL.split('/')[0] #DEFAULT_FROM_EMAIL='admin@example.com' SERVER_EMAIL=DEFAULT_FROM_EMAIL @@ -165,21 +165,12 @@ LOGGING = { AUTH_PROFILE_MODULE = 'user.UserProfile' -#Video encoding settings -#available profiles: 96p, 240p, 360p, 480p, 720p, 1080p -SITE_CONFIG = join(PROJECT_ROOT, '0xdb.json') -DEFAULT_SORT = [{"key": "director", "operator": ""}] -DEFAULT_THEME = "classic" +SITE_CONFIG = join(PROJECT_ROOT, '0xdb.jsonc') TRACKER_URL="http://url2torrent.net:6970/announce" -TRANSMISSON_HOST = 'localhost' -TRANSMISSON_PORT = 9091 -TRANSMISSON_USER = 'transmission' -TRANSMISSON_PASSWORD = 'transmission' - #Movie related settings REVIEW_WHITELIST = { @@ -248,16 +239,3 @@ except NameError: except IOError: Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE) -from ox.utils import json -with open(SITE_CONFIG) as f: - CONFIG = json.load(f) - -CONFIG['site']['id'] = SITEID -CONFIG['site']['name'] = SITENAME -CONFIG['site']['sectionName'] = SITENAME -CONFIG['site']['url'] = URL - -CONFIG['keys'] = {} -for key in CONFIG['itemKeys']: - CONFIG['keys'][key['id']] = key - diff --git a/static/js/pandora/ui/Ox.FilesView.js b/static/js/pandora/ui/Ox.FilesView.js index ea7d154d..f5dbc01d 100644 --- a/static/js/pandora/ui/Ox.FilesView.js +++ b/static/js/pandora/ui/Ox.FilesView.js @@ -259,7 +259,7 @@ Ox.FilesView = function(options, self) { self.$checkbox = Ox.Checkbox({ checked: false, id: 'go', - title: 'Go to this movie after moving files', // fixme: wrong, can be 'Go to video' etc + title: 'Switch to this movie after moving files', // fixme: wrong, can be 'Go to video' etc width: 240 }); @@ -305,8 +305,8 @@ Ox.FilesView = function(options, self) { }); Ox.Request.clearCache(); // fixme: remove pandora.api.moveFiles(data, function(result) { - if(self.$checkbox.value()) { - pandora.URL.set(result.data.itemId); + if (self.$checkbox.value()) { + pandora.UI.set({item: result.data.itemId}); } else { Ox.print('moved', self.selected, result.data.itemId); self.$filesList.reloadList(); diff --git a/static/js/pandora/ui/browser.js b/static/js/pandora/ui/browser.js index 423a5ffa..5fcbaded 100644 --- a/static/js/pandora/ui/browser.js +++ b/static/js/pandora/ui/browser.js @@ -38,7 +38,6 @@ pandora.ui.browser = function() { toggle: function(data) { data.collapsed && pandora.$ui.list.gainFocus(); pandora.UI.set({showGroups: !data.collapsed}); - pandora.$ui.mainMenu.getItem('viewMenu_togglegroups').toggleTitle(); if (pandora.user.ui.listView == 'map') { pandora.$ui.map.resizeMap(); } else if (pandora.user.ui.listView == 'calendar') { @@ -101,7 +100,7 @@ pandora.ui.browser = function() { }); }, toggle: function(data) { - pandora.UI.set({showMovies: !data.collapsed}); + pandora.UI.set({showBrowser: !data.collapsed}); if (data.collapsed) { if (pandora.user.ui.itemView == 'timeline') { pandora.$ui.editor.gainFocus(); diff --git a/static/js/pandora/ui/contentPanel.js b/static/js/pandora/ui/contentPanel.js index 62cd6d20..66942ed5 100644 --- a/static/js/pandora/ui/contentPanel.js +++ b/static/js/pandora/ui/contentPanel.js @@ -16,11 +16,11 @@ pandora.ui.contentPanel = function() { } ] : [ { - collapsed: !pandora.user.ui.showMovies, + collapsed: !pandora.user.ui.showBrowser, collapsible: true, element: pandora.$ui.browser = pandora.ui.browser(), size: 112 + Ox.UI.SCROLLBAR_SIZE, - tooltip: pandora.site.itemName.plural.toLowerCase() + tooltip: pandora.site.itemName.singular.toLowerCase() + ' browser' }, { element: pandora.$ui.item = pandora.ui.item() @@ -39,6 +39,12 @@ pandora.ui.contentPanel = function() { }, pandora_itemview: function() { that.replaceElement(1, pandora.$ui.item = pandora.ui.item()); + }, + pandora_showbrowser: function(data) { + data.value == that.options('elements')[0].collapsed && that.toggle(0); + }, + pandora_showgroups: function(data) { + data.value == that.options('elements')[0].collapsed && that.toggle(0); } }); return that; diff --git a/static/js/pandora/ui/info.js b/static/js/pandora/ui/info.js index 91b769cd..27675ae9 100644 --- a/static/js/pandora/ui/info.js +++ b/static/js/pandora/ui/info.js @@ -9,7 +9,6 @@ pandora.ui.info = function() { .bindEvent({ toggle: function(data) { pandora.UI.set({showInfo: !data.collapsed}); - pandora.$ui.mainMenu.getItem('viewMenu_toggleinfo').toggleTitle(); pandora.resizeFolders(); }, pandora_find: function() { @@ -18,7 +17,10 @@ pandora.ui.info = function() { } }, pandora_item: updateInfo, - pandora_listselection: updateInfo + pandora_listselection: updateInfo, + pandora_showinfo: function(data) { + pandora.resizeFolders(); + } }); //pandora.$ui.leftPanel && resize(); diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index 9c4f2f8b..8cc57362 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -267,6 +267,9 @@ pandora.ui.item = function() { volume: function(data) { pandora.UI.set('volume', data.volume); }, + pandora_showannotations: function(data) { + pandora.$ui.player.options({showAnnotations: data.value}); + } })); } else if (pandora.user.ui.itemView == 'timeline') { @@ -360,6 +363,9 @@ pandora.ui.item = function() { Ox.print('done updateAnnotation', result); }); + }, + pandora_showannotations: function(data) { + pandora.$ui.editor.options({showAnnotations: data.value}); } })); that.bindEvent('resize', function(data) { diff --git a/static/js/pandora/ui/leftPanel.js b/static/js/pandora/ui/leftPanel.js index 98dc5b30..66fa12a3 100644 --- a/static/js/pandora/ui/leftPanel.js +++ b/static/js/pandora/ui/leftPanel.js @@ -45,12 +45,14 @@ pandora.ui.leftPanel = function() { }, toggle: function(data) { pandora.UI.set({showSidebar: !data.collapsed}); - pandora.$ui.mainMenu.getItem('viewMenu_togglelists').toggleTitle(); if (data.collapsed) { Ox.forEach(pandora.$ui.folderList, function($list) { $list.loseFocus(); }); } + }, + pandora_showinfo: function(data) { + data.value == that.options('elements')[1].collapsed && that.toggle(1); } }); return that; diff --git a/static/js/pandora/ui/mainPanel.js b/static/js/pandora/ui/mainPanel.js index b63e8568..314d6a01 100644 --- a/static/js/pandora/ui/mainPanel.js +++ b/static/js/pandora/ui/mainPanel.js @@ -9,7 +9,7 @@ pandora.ui.mainPanel = function() { resizable: true, resize: [192, 256, 320, 384], size: pandora.user.ui.sidebarSize, - tooltip: 'lists' + tooltip: 'sidebar' }, { element: pandora.$ui.rightPanel = pandora.ui.rightPanel() @@ -44,6 +44,9 @@ pandora.ui.mainPanel = function() { if (!data.value || !data.previousValue) { that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel()); } + }, + pandora_showsidebar: function(data) { + data.value == that.options('elements')[0].collapsed && that.toggle(0); } }); return that; diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index f9b18a39..7a33bde6 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -94,33 +94,11 @@ pandora.ui.mainMenu = function() { { id: 'resetgroups', title: 'Reset Groups' } ] }, {}, - { - id: 'togglelists', - title: Ox.map([pandora.user.ui.showSidebar? 'Hide': 'Show', - pandora.user.ui.showSidebar? 'Show': 'Hide' ], - function(t) { return t + ' Lists'; } ), - keyboard: 'shift l' - }, - { - id: 'toggleinfo', - title: Ox.map([pandora.user.ui.showInfo? 'Hide': 'Show', - pandora.user.ui.showInfo? 'Show': 'Hide' ], - function(t) { return t + ' Info'; } ), - keyboard: 'shift i' - }, - { - id: 'togglegroups', - title: Ox.map([pandora.user.ui.showGroups? 'Hide': 'Show', - pandora.user.ui.showGroups? 'Show': 'Hide' ], - function(t) { return t + ' Groups'; } ), - keyboard: 'shift g' - }, - { - id: 'movies', title: - 'Hide ' + pandora.site.itemName.plural, - disabled: true, - keyboard: 'shift m' - }, + { id: 'showsidebar', title: (ui.showSidebar ? 'Hide' : 'Show') + ' Sidebar', keyboard: 'shift s' }, + { id: 'showinfo', title: (ui.showInfo ? 'Hide' : 'Show') + ' Info', keyboard: 'shift i' }, + { id: 'showgroups', title: (ui.showGroups ? 'Hide' : 'Show') + ' Groups', disabled: !!ui.item, keyboard: 'shift g' }, + { id: 'showbrowser', title: (ui.showBrowser ? 'Hide' : 'Show') + ' ' + pandora.site.itemName.singular + ' Browser', disabled: !ui.item, keyboard: 'shift b' }, + { id: 'showannotations', title: (ui.showAnnotations ? 'Hide' : 'Show') + ' Annotations', disabled: !ui.item || ['timeline', 'video'].indexOf(ui.itemView) == -1, keyboard: 'shift a' }, {}, { id: 'theme', title: 'Theme', items: [ { group: 'settheme', min: 1, max: 1, items: [ @@ -238,12 +216,16 @@ pandora.ui.mainMenu = function() { pandora.ui.listDialog().open(); } else if (data.id == 'deletelist') { pandora.ui.deleteListDialog().open(); - } else if (data.id == 'stills') { - var id = pandora.user.ui.item || pandora.user.ui.listItem; - pandora.$ui.postersDialog = pandora.ui.framesDialog(id).open(); - } else if (data.id == 'posters') { - var id = pandora.user.ui.item || pandora.user.ui.listItem; - pandora.$ui.postersDialog = pandora.ui.postersDialog(id).open(); + } else if (data.id == 'showsidebar') { + pandora.UI.set({showSidebar: !ui.showSidebar}); + } else if (data.id == 'showinfo') { + pandora.UI.set({showInfo: !ui.showInfo}); + } else if (data.id == 'showgroups') { + pandora.UI.set({showGroups: !ui.showGroups}); + } else if (data.id == 'showbrowser') { + pandora.UI.set({showBrowser: !ui.showBrowser}); + } else if (data.id == 'showannotations') { + pandora.UI.set({showAnnotations: !ui.showAnnotations}); } else if (data.id == 'names') { pandora.$ui.namesDialog = pandora.ui.namesDialog().open(); } else if (data.id == 'titles') { @@ -267,15 +249,6 @@ pandora.ui.mainMenu = function() { }); } else if (data.id == 'clearcache') { Ox.Request.clearCache(); - } else if (data.id == 'togglegroups') { - that.getItem('viewMenu_togglegroups').toggleTitle(); - pandora.$ui.contentPanel.toggle(0); - } else if (data.id == 'toggleinfo') { - that.getItem('viewMenu_toggleinfo').toggleTitle(); - pandora.$ui.leftPanel.toggle(2); - } else if (data.id == 'togglelists') { - that.getItem('viewMenu_togglelists').toggleTitle(); - pandora.$ui.mainPanel.toggle(0); } }, pandora_find: function() { @@ -285,7 +258,20 @@ pandora.ui.mainMenu = function() { that[action]('editlist'); that[action]('duplicatelist'); that[action]('deletelist'); - that[pandora.user.ui.listSelection.length ? 'enableItem' : 'disableItem']('newlistfromselection'); + that[ui.listSelection.length ? 'enableItem' : 'disableItem']('newlistfromselection'); + }, + pandora_item: function(data) { + if (!!data.value != !!data.previousValue) { + that[data.value ? 'disableItem' : 'enableItem']('showgroups'); + that[data.value ? 'enableItem' : 'disableItem']('showbrowser'); + } + }, + pandora_itemview: function(data) { + var isVideoView = ['video', 'timeline'].indexOf(data.value) > 1, + wasVideoView = ['video', 'timeline'].indexOf(data.previousValue) > 1; + if (isVideoView != wasVideoView) { + that[isVideoView ? 'enableItem' : 'disableItem']('showannotations'); + } }, pandora_listselection: function(data) { that[data.value.length ? 'enableItem' : 'disableItem']('newlistfromselection'); @@ -295,6 +281,21 @@ pandora.ui.mainMenu = function() { if (pandora.isClipView() != pandora.isClipView(data.previousValue)) { that.replaceMenu('sortMenu', getSortMenu()); } + }, + pandora_showannotations: function(data) { + that.setItemTitle('showannotations', (data.value ? 'Hide' : 'Show') + ' Annotations'); + }, + pandora_showbrowser: function(data) { + that.setItemTitle('showbrowser', (data.value ? 'Hide' : 'Show') + ' ' + pandora.site.itemName.singular + ' Browser'); + }, + pandora_showgroups: function(data) { + that.setItemTitle('showgroups', (data.value ? 'Hide' : 'Show') + ' Groups'); + }, + pandora_showinfo: function(data) { + that.setItemTitle('showinfo', (data.value ? 'Hide' : 'Show') + ' Info'); + }, + pandora_showsidebar: function(data) { + that.setItemTitle('showsidebar', (data.value ? 'Hide' : 'Show') + ' Sidebar'); } }); diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 4d93984d..f682f9a2 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -396,10 +396,10 @@ pandora.enterFullscreen = function() { pandora.$ui.appPanel.size(0, 0); pandora.user.ui.showSidebar && pandora.$ui.mainPanel.size(0, 0); pandora.$ui.rightPanel.size(0, 0).size(2, 0); - !pandora.user.ui.showMovies && pandora.$ui.contentPanel.css({ + !pandora.user.ui.showBrowser && pandora.$ui.contentPanel.css({ top: (-112 - Ox.UI.SCROLLBAR_SIZE) + 'px' // fixme: rightPanel.size(0, 0) doesn't preserve negative top of browser }); - pandora.user.ui.showMovies && pandora.$ui.contentPanel.size(0, 0); + pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 0); pandora.$ui.player.options({ height: pandora.$document.height() - 2, width: pandora.$document.width() - 2 @@ -410,10 +410,10 @@ pandora.exitFullscreen = function() { pandora.$ui.appPanel.size(0, 20); pandora.user.ui.showSidebar && pandora.$ui.mainPanel.size(0, pandora.user.ui.sidebarSize); pandora.$ui.rightPanel.size(0, 24).size(2, 16); - !pandora.user.ui.showMovies && pandora.$ui.contentPanel.css({ + !pandora.user.ui.showBrowser && pandora.$ui.contentPanel.css({ top: 24 + (-112 - Ox.UI.SCROLLBAR_SIZE) + 'px' // fixme: rightPanel.size(0, 0) doesn't preserve negative top of browser }); - pandora.user.ui.showMovies && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE); + pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE); }; pandora.getFoldersHeight = function() {