From d403125757d1c286084f114a95531fcb66629cc8 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 14 Nov 2017 17:13:41 +0100 Subject: [PATCH] default download format --- pandora/app/config.py | 3 +++ pandora/config.pandora.jsonc | 1 + static/js/editor.js | 3 ++- static/js/utils.js | 6 +++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pandora/app/config.py b/pandora/app/config.py index 1f075955..c9435745 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -149,6 +149,9 @@ def load_config(init=False): key['autocompleteSort'] = get_by_id(default['itemKeys'], 'title')['autocompleteSort'] sys.stderr.write("adding default value to itemKeys.title.autocompleteSort:\n\t\"autocompleteSort\": %s,\n\n" % json.dumps(key['autocompleteSort'])) + if 'downloadFormat' not in config['video']: + config['video']['downloadFormat'] = default['video']['downloadFormat'] + old_formats = getattr(settings, 'CONFIG', {}).get('video', {}).get('formats', []) formats = config.get('video', {}).get('formats') if set(old_formats) != set(formats): diff --git a/pandora/config.pandora.jsonc b/pandora/config.pandora.jsonc index 55fab0aa..fded3f9d 100644 --- a/pandora/config.pandora.jsonc +++ b/pandora/config.pandora.jsonc @@ -1252,6 +1252,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "torrent": If true, video downloads are offered via BitTorrent */ "video": { + "downloadFormat": "webm", "formats": ["webm", "mp4"], "previewRatio": 1.3333333333, "resolutions": [240, 480], diff --git a/static/js/editor.js b/static/js/editor.js index 3aaeca42..db4c9dc0 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -167,7 +167,8 @@ pandora.ui.editor = function(data) { downloadselection: function(data) { document.location.href = '/' + ui.item + '/' + Ox.max(pandora.site.video.resolutions) - + 'p.webm?t=' + data['in'] + ',' + data.out; + + 'p.' + pandora.site.video.downloadFormat + + '?t=' + data['in'] + ',' + data.out; }, editannotation: function(data) { Ox.Log('', 'editAnnotation', data); diff --git a/static/js/utils.js b/static/js/utils.js index 522c5294..4852b669 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1301,7 +1301,11 @@ pandora.getDownloadLink = function(item, rightslevel) { pandora.hasCapability('canSeeItem', 'guest') < rightslevel) { torrent = false; } - return '/' + item + (torrent ? '/torrent/' : '/download/'); + url = '/' + item + (torrent ? '/torrent/' : '/download/'); + if (!torrent && pandora.site.video.downloadFormat) { + url += Ox.max(pandora.site.video.resolutions) + 'p.' + pandora.site.video.downloadFormat; + } + return url; }; pandora.getEditTooltip = function(title) {