Browse Source

More feedback on download button. fix #537

pull/584/head
Ruud 13 years ago
parent
commit
0c14334e23
  1. 18
      couchpotato/core/plugins/movie/static/movie.js
  2. 6
      couchpotato/core/plugins/release/main.py
  3. BIN
      couchpotato/static/images/icon.attention.png
  4. BIN
      couchpotato/static/images/icon.spinner.gif
  5. 4
      couchpotato/static/style/main.css

18
couchpotato/core/plugins/movie/static/movie.js

@ -365,7 +365,8 @@ var ReleaseAction = new Class({
} catch(e){} } catch(e){}
new Element('div', { new Element('div', {
'class': 'item '+status.identifier 'class': 'item '+status.identifier,
'id': 'release_'+release.id
}).adopt( }).adopt(
new Element('span.name', {'text': self.get(release, 'name'), 'title': self.get(release, 'name')}), new Element('span.name', {'text': self.get(release, 'name'), 'title': self.get(release, 'name')}),
new Element('span.status', {'text': status.identifier, 'class': 'release_status '+status.identifier}), new Element('span.status', {'text': status.identifier, 'class': 'release_status '+status.identifier}),
@ -382,7 +383,8 @@ var ReleaseAction = new Class({
'events': { 'events': {
'click': function(e){ 'click': function(e){
(e).preventDefault(); (e).preventDefault();
self.download(release); if(!this.hasClass('completed'))
self.download(release);
} }
} }
}), }),
@ -414,9 +416,21 @@ var ReleaseAction = new Class({
download: function(release){ download: function(release){
var self = this; var self = this;
var release_el = self.release_container.getElement('#release_'+release.id),
icon = release_el.getElement('.download.icon');
icon.addClass('spinner');
Api.request('release.download', { Api.request('release.download', {
'data': { 'data': {
'id': release.id 'id': release.id
},
'onComplete': function(json){
icon.removeClass('spinner')
if(json.success)
icon.addClass('completed');
else
icon.addClass('attention').set('title', 'Something went wrong when downloading, please check logs.');
} }
}); });
}, },

6
couchpotato/core/plugins/release/main.py

@ -146,16 +146,16 @@ class Release(Plugin):
provider = fireEvent('provider.belongs_to', item['url'], provider = item.get('provider'), single = True) provider = fireEvent('provider.belongs_to', item['url'], provider = item.get('provider'), single = True)
item['download'] = provider.download item['download'] = provider.download
fireEvent('searcher.download', data = item, movie = rel.movie.to_dict({ success = fireEvent('searcher.download', data = item, movie = rel.movie.to_dict({
'profile': {'types': {'quality': {}}}, 'profile': {'types': {'quality': {}}},
'releases': {'status': {}, 'quality': {}}, 'releases': {'status': {}, 'quality': {}},
'library': {'titles': {}, 'files':{}}, 'library': {'titles': {}, 'files':{}},
'files': {} 'files': {}
}), manual = True) }), manual = True, single = True)
#db.close() #db.close()
return jsonified({ return jsonified({
'success': True 'success': success
}) })
else: else:
log.error('Couldn\'t find release with id: %s', id) log.error('Couldn\'t find release with id: %s', id)

BIN
couchpotato/static/images/icon.attention.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
couchpotato/static/images/icon.spinner.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

4
couchpotato/static/style/main.css

@ -147,7 +147,7 @@ body > .spinner, .mask{
.icon.delete { background-image: url('../images/icon.delete.png'); } .icon.delete { background-image: url('../images/icon.delete.png'); }
.icon.download { background-image: url('../images/icon.download.png'); } .icon.download { background-image: url('../images/icon.download.png'); }
.icon.edit { background-image: url('../images/icon.edit.png'); } .icon.edit { background-image: url('../images/icon.edit.png'); }
.icon.check { background-image: url('../images/icon.check.png'); } .icon.completed { background-image: url('../images/icon.check.png'); }
.icon.folder { background-image: url('../images/icon.folder.png'); } .icon.folder { background-image: url('../images/icon.folder.png'); }
.icon.imdb { background-image: url('../images/icon.imdb.png'); } .icon.imdb { background-image: url('../images/icon.imdb.png'); }
.icon.refresh { background-image: url('../images/icon.refresh.png'); } .icon.refresh { background-image: url('../images/icon.refresh.png'); }
@ -155,6 +155,8 @@ body > .spinner, .mask{
.icon.files { background-image: url('../images/icon.files.png'); } .icon.files { background-image: url('../images/icon.files.png'); }
.icon.info { background-image: url('../images/icon.info.png'); } .icon.info { background-image: url('../images/icon.info.png'); }
.icon.trailer { background-image: url('../images/icon.trailer.png'); } .icon.trailer { background-image: url('../images/icon.trailer.png'); }
.icon.spinner { background-image: url('../images/icon.spinner.gif'); }
.icon.attention { background-image: url('../images/icon.attention.png'); }
/*** Navigation ***/ /*** Navigation ***/
.header { .header {

Loading…
Cancel
Save