From 9ce2fd228b822052930d53a19b9aded47b25e07a Mon Sep 17 00:00:00 2001 From: bkfox Date: Sun, 11 Feb 2018 23:47:22 +0100 Subject: [PATCH] make Vue track Track change --- aircox/management/commands/import_playlist.py | 9 ++++++--- aircox_cms/static/aircox_cms/js/player.js | 9 ++++++--- aircox_cms/templates/aircox_cms/vues/player.html | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/aircox/management/commands/import_playlist.py b/aircox/management/commands/import_playlist.py index 61f1e35..5870455 100755 --- a/aircox/management/commands/import_playlist.py +++ b/aircox/management/commands/import_playlist.py @@ -89,9 +89,12 @@ class Importer: tags = line.get('tags') if tags: track.tags.add(*tags.split(',')) - except: - logger.warning('an error occured for track {index}, it may not ' - 'have been saved'.format(index = index)) + except Exception as err: + logger.warning( + 'an error occured for track {index}, it may not ' + 'have been saved: {err}' + .format(index = index, err=err) + ) continue if save: diff --git a/aircox_cms/static/aircox_cms/js/player.js b/aircox_cms/static/aircox_cms/js/player.js index 7ef1b08..5ba384d 100644 --- a/aircox_cms/static/aircox_cms/js/player.js +++ b/aircox_cms/static/aircox_cms/js/player.js @@ -16,6 +16,11 @@ class Track { // If url and interval are given, use them to retrieve regularely // the track informations constructor(data) { + Object.assign(this, { + 'name': '', + 'detail_url': '', + }); + Object.assign(this, data); if(this.data_url) { @@ -62,7 +67,7 @@ class Track { } else data = { - title: data.title, + name: data.title, detail_url: data.url } Object.assign(self, data); @@ -102,8 +107,6 @@ var Sound = Vue.extend({ state: State.Stop, // current position in playing sound position: 0, - // url to the page related to the sound - detail_url: '', // estimated position when user mouse over progress bar user_seek: null, }; diff --git a/aircox_cms/templates/aircox_cms/vues/player.html b/aircox_cms/templates/aircox_cms/vues/player.html index aa9c097..11140dd 100644 --- a/aircox_cms/templates/aircox_cms/vues/player.html +++ b/aircox_cms/templates/aircox_cms/vues/player.html @@ -32,7 +32,7 @@

- [[ track.name ]] + [[ track.name ]]