pull/6/head
parent
684e4f4c80
commit
2813fccc78
@ -1,3 +1,3 @@
|
||||
<div class="text-center hint col-md-12">
|
||||
<span>You can also search by tvdbid using the tvdb: prefixes.</span>
|
||||
<span>You can also search by iTunes using the itunes: prefixes.</span>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="x-existing-folders">
|
||||
<div class="loading-folders x-loading-folders">
|
||||
Loading search results from TheTVDB for your series, this may take a few minutes.
|
||||
Loading search results from iTunes for your artists, this may take a few minutes.
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,124 @@
|
||||
var _ = require('underscore');
|
||||
var Backbone = require('backbone');
|
||||
var PageableCollection = require('backbone.pageable');
|
||||
var ArtistModel = require('./ArtistModel');
|
||||
var ApiData = require('../Shared/ApiData');
|
||||
var AsFilteredCollection = require('../Mixins/AsFilteredCollection');
|
||||
var AsSortedCollection = require('../Mixins/AsSortedCollection');
|
||||
var AsPersistedStateCollection = require('../Mixins/AsPersistedStateCollection');
|
||||
var moment = require('moment');
|
||||
require('../Mixins/backbone.signalr.mixin');
|
||||
|
||||
var Collection = PageableCollection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/artist',
|
||||
model : ArtistModel,
|
||||
tableName : 'artist',
|
||||
|
||||
state : {
|
||||
sortKey : 'sortTitle',
|
||||
order : -1,
|
||||
pageSize : 100000,
|
||||
secondarySortKey : 'sortTitle',
|
||||
secondarySortOrder : -1
|
||||
},
|
||||
|
||||
mode : 'client',
|
||||
|
||||
save : function() {
|
||||
var self = this;
|
||||
|
||||
var proxy = _.extend(new Backbone.Model(), {
|
||||
id : '',
|
||||
|
||||
url : self.url + '/editor',
|
||||
|
||||
toJSON : function() {
|
||||
return self.filter(function(model) {
|
||||
return model.edited;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.listenTo(proxy, 'sync', function(proxyModel, models) {
|
||||
this.add(models, { merge : true });
|
||||
this.trigger('save', this);
|
||||
});
|
||||
|
||||
return proxy.save();
|
||||
},
|
||||
|
||||
filterModes : {
|
||||
'all' : [
|
||||
null,
|
||||
null
|
||||
],
|
||||
'continuing' : [
|
||||
'status',
|
||||
'continuing'
|
||||
],
|
||||
'ended' : [
|
||||
'status',
|
||||
'ended'
|
||||
],
|
||||
'monitored' : [
|
||||
'monitored',
|
||||
true
|
||||
],
|
||||
'missing' : [
|
||||
null,
|
||||
null,
|
||||
function(model) { return model.get('episodeCount') !== model.get('episodeFileCount'); }
|
||||
]
|
||||
},
|
||||
|
||||
sortMappings : {
|
||||
title : {
|
||||
sortKey : 'sortTitle'
|
||||
},
|
||||
|
||||
artistName: {
|
||||
sortKey : 'artistName'
|
||||
},
|
||||
|
||||
nextAiring : {
|
||||
sortValue : function(model, attr, order) {
|
||||
var nextAiring = model.get(attr);
|
||||
|
||||
if (nextAiring) {
|
||||
return moment(nextAiring).unix();
|
||||
}
|
||||
|
||||
if (order === 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Number.MAX_VALUE;
|
||||
}
|
||||
},
|
||||
|
||||
percentOfEpisodes : {
|
||||
sortValue : function(model, attr) {
|
||||
var percentOfEpisodes = model.get(attr);
|
||||
var episodeCount = model.get('episodeCount');
|
||||
|
||||
return percentOfEpisodes + episodeCount / 1000000;
|
||||
}
|
||||
},
|
||||
|
||||
path : {
|
||||
sortValue : function(model) {
|
||||
var path = model.get('path');
|
||||
|
||||
return path.toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Collection = AsFilteredCollection.call(Collection);
|
||||
Collection = AsSortedCollection.call(Collection);
|
||||
Collection = AsPersistedStateCollection.call(Collection);
|
||||
|
||||
var data = ApiData.get('series'); // TOOD: Build backend for artist
|
||||
|
||||
module.exports = new Collection(data, { full : true }).bindSignalR();
|
@ -0,0 +1,37 @@
|
||||
var NzbDroneController = require('../Shared/NzbDroneController');
|
||||
var AppLayout = require('../AppLayout');
|
||||
var ArtistCollection = require('./ArtistCollection');
|
||||
var SeriesIndexLayout = require('./Index/SeriesIndexLayout');
|
||||
var SeriesDetailsLayout = require('../Series/Details/SeriesDetailsLayout');
|
||||
|
||||
module.exports = NzbDroneController.extend({
|
||||
_originalInit : NzbDroneController.prototype.initialize,
|
||||
|
||||
initialize : function() {
|
||||
this.route('', this.series);
|
||||
this.route('artist', this.series);
|
||||
this.route('artist/:query', this.seriesDetails);
|
||||
|
||||
this._originalInit.apply(this, arguments);
|
||||
},
|
||||
|
||||
artist : function() {
|
||||
this.setTitle('Lidarr');
|
||||
this.setArtistName('Lidarr');
|
||||
this.showMainRegion(new SeriesIndexLayout());
|
||||
},
|
||||
|
||||
seriesDetails : function(query) {
|
||||
var artists = ArtistCollection.where({ artistNameSlug : query });
|
||||
console.log('seriesDetails, artists: ', artists);
|
||||
if (artists.length !== 0) {
|
||||
var targetSeries = artists[0];
|
||||
console.log("[ArtistController] targetSeries: ", targetSeries);
|
||||
this.setTitle(targetSeries.get('title'));
|
||||
this.setArtistName(targetSeries.get('artistName'));
|
||||
this.showMainRegion(new SeriesDetailsLayout({ model : targetSeries }));
|
||||
} else {
|
||||
this.showNotFound();
|
||||
}
|
||||
}
|
||||
});
|
@ -0,0 +1,31 @@
|
||||
var Backbone = require('backbone');
|
||||
var _ = require('underscore');
|
||||
|
||||
module.exports = Backbone.Model.extend({
|
||||
urlRoot : window.NzbDrone.ApiRoot + '/artist',
|
||||
|
||||
defaults : {
|
||||
episodeFileCount : 0,
|
||||
episodeCount : 0,
|
||||
isExisting : false,
|
||||
status : 0
|
||||
},
|
||||
|
||||
setAlbumsMonitored : function(seasonNumber) {
|
||||
_.each(this.get('albums'), function(album) {
|
||||
if (season.seasonNumber === seasonNumber) {
|
||||
album.monitored = !album.monitored;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setAlbumPass : function(seasonNumber) {
|
||||
_.each(this.get('albums'), function(album) {
|
||||
if (album.seasonNumber >= seasonNumber) {
|
||||
album.monitored = true;
|
||||
} else {
|
||||
album.monitored = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Reference in new issue