default download format

This commit is contained in:
j 2017-11-14 17:13:41 +01:00
parent 5ce9d605f7
commit d403125757
4 changed files with 11 additions and 2 deletions

View file

@ -149,6 +149,9 @@ def load_config(init=False):
key['autocompleteSort'] = get_by_id(default['itemKeys'], 'title')['autocompleteSort'] 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'])) 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', []) old_formats = getattr(settings, 'CONFIG', {}).get('video', {}).get('formats', [])
formats = config.get('video', {}).get('formats') formats = config.get('video', {}).get('formats')
if set(old_formats) != set(formats): if set(old_formats) != set(formats):

View file

@ -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 "torrent": If true, video downloads are offered via BitTorrent
*/ */
"video": { "video": {
"downloadFormat": "webm",
"formats": ["webm", "mp4"], "formats": ["webm", "mp4"],
"previewRatio": 1.3333333333, "previewRatio": 1.3333333333,
"resolutions": [240, 480], "resolutions": [240, 480],

View file

@ -167,7 +167,8 @@ pandora.ui.editor = function(data) {
downloadselection: function(data) { downloadselection: function(data) {
document.location.href = '/' + ui.item document.location.href = '/' + ui.item
+ '/' + Ox.max(pandora.site.video.resolutions) + '/' + 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) { editannotation: function(data) {
Ox.Log('', 'editAnnotation', data); Ox.Log('', 'editAnnotation', data);

View file

@ -1301,7 +1301,11 @@ pandora.getDownloadLink = function(item, rightslevel) {
pandora.hasCapability('canSeeItem', 'guest') < rightslevel) { pandora.hasCapability('canSeeItem', 'guest') < rightslevel) {
torrent = false; 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) { pandora.getEditTooltip = function(title) {