mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
signalr-episodes
This commit is contained in:
parent
6a10382e7b
commit
b6693a20a9
6 changed files with 44 additions and 12 deletions
|
@ -1,8 +1,10 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'underscore',
|
||||
'backbone',
|
||||
'signalR'
|
||||
], function () {
|
||||
], function (_, Backbone) {
|
||||
|
||||
_.extend(Backbone.Collection.prototype, {
|
||||
bindSignalR: function () {
|
||||
|
@ -13,14 +15,14 @@ define(
|
|||
|
||||
var model = new collection.model(options.resource, {parse: true});
|
||||
collection.add(model, {merge: true});
|
||||
console.log(options.action + ": %O", options.resource);
|
||||
console.log(options.action + ': {0}}'.format(options.resource));
|
||||
};
|
||||
|
||||
require(
|
||||
[
|
||||
'app'
|
||||
], function (app) {
|
||||
collection.listenTo(app.vent, 'server:' + collection.url.replace('/api/', ''), processMessage)
|
||||
collection.listenTo(app.vent, 'server:' + collection.url.replace('/api/', ''), processMessage);
|
||||
});
|
||||
|
||||
return this;
|
||||
|
@ -28,7 +30,6 @@ define(
|
|||
|
||||
unbindSignalR: function () {
|
||||
|
||||
|
||||
}});
|
||||
});
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ define(
|
|||
this.seasons.show(new LoadingView());
|
||||
|
||||
this.seasonCollection = new SeasonCollection(this.model.get('seasons'));
|
||||
this.episodeCollection = new EpisodeCollection({ seriesId: this.model.id });
|
||||
this.episodeCollection = new EpisodeCollection({ seriesId: this.model.id }).bindSignalR();
|
||||
this.episodeFileCollection = new EpisodeFileCollection({ seriesId: this.model.id });
|
||||
|
||||
$.when(this.episodeCollection.fetch(), this.episodeFileCollection.fetch()).done(function () {
|
||||
|
|
|
@ -24,7 +24,7 @@ define(
|
|||
}
|
||||
};
|
||||
|
||||
this.signalRconnection = $.connection("/signalr");
|
||||
this.signalRconnection = $.connection('/signalr');
|
||||
|
||||
this.signalRconnection.stateChanged(function (change) {
|
||||
console.debug('SignalR: [{0}]'.format(getStatus(change.newState)));
|
||||
|
@ -36,7 +36,7 @@ define(
|
|||
'app'
|
||||
], function (app) {
|
||||
app.vent.trigger('server:' + message.name, message.body);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
this.signalRconnection.start({ transport:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue