Files tab is now present. (#245)
* Adding file info tab. Not finished yet. * Adding more media info options. * Deleting files now works. Fixes #127 * Fix button for modifying episode files. * Get Media Info when running DiskScanService.pull/247/head
parent
5daece0ed4
commit
29586667cb
@ -0,0 +1,15 @@
|
||||
var NzbDroneCell = require('./NzbDroneCell');
|
||||
|
||||
module.exports = NzbDroneCell.extend({
|
||||
className : 'file-title-cell',
|
||||
|
||||
render : function() {
|
||||
this.$el.empty();
|
||||
|
||||
var title = this.model.get('relativePath');
|
||||
this.$el.html(title);
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
var NzbDroneCell = require('./NzbDroneCell');
|
||||
|
||||
module.exports = NzbDroneCell.extend({
|
||||
className : 'release-title-cell',
|
||||
|
||||
render : function() {
|
||||
this.$el.empty();
|
||||
|
||||
var info = this.model.get('mediaInfo');
|
||||
if (info) {
|
||||
var runtime = info.runTime;
|
||||
if (runtime) {
|
||||
runtime = runtime.split(".")[0];
|
||||
}
|
||||
var video = "{0} ({1}x{2}) ({3})".format(info.videoCodec, info.width, info.height, runtime);
|
||||
var audio = "{0} ({1})".format(info.audioFormat, info.audioLanguages);
|
||||
this.$el.html(video + " " + audio);
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
{{#if_gt proper compare="1"}}
|
||||
<span class="badge badge-info" title="PROPER">{{quality.name}}</span>
|
||||
{{else}}
|
||||
<span class="badge">{{quality.name}}</span>
|
||||
{{/if_gt}}
|
||||
<span class="badge" title="{{#if hardcodedSubs}}Warning: {{hardcodedSubs}}{{/if}}">{{quality.name}}</span>
|
||||
{{/if_gt}}
|
||||
|
@ -0,0 +1,26 @@
|
||||
var vent = require('vent');
|
||||
var Backgrid = require('backgrid');
|
||||
|
||||
module.exports = Backgrid.Cell.extend({
|
||||
className : 'delete-episode-file-cell',
|
||||
|
||||
events : {
|
||||
'click' : '_onClick'
|
||||
},
|
||||
|
||||
render : function() {
|
||||
this.$el.empty();
|
||||
this.$el.html('<i class="icon-sonarr-delete" title="Delete movie file from disk"></i>');
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_onClick : function() {
|
||||
var self = this;
|
||||
if (window.confirm('Are you sure you want to delete \'{0}\' from disk?'.format(this.model.get('relativePath')))) {
|
||||
this.model.destroy().done(function() {
|
||||
vent.trigger(vent.Events.MovieFileDeleted, { movieFile : self.model });
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
var Backbone = require('backbone');
|
||||
|
||||
module.exports = Backbone.Model.extend({});
|
@ -0,0 +1,30 @@
|
||||
var PagableCollection = require('backbone.pageable');
|
||||
var FileModel = require('./FileModel');
|
||||
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
|
||||
|
||||
var Collection = PagableCollection.extend({
|
||||
url : window.NzbDrone.ApiRoot + "/moviefile",
|
||||
model : FileModel,
|
||||
|
||||
state : {
|
||||
pageSize : 2000,
|
||||
sortKey : 'title',
|
||||
order : -1
|
||||
},
|
||||
|
||||
mode : 'client',
|
||||
|
||||
sortMappings : {
|
||||
'quality' : {
|
||||
sortKey : "qualityWeight"
|
||||
},
|
||||
"edition" : {
|
||||
sortKey : "edition"
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
Collection = AsSortedCollection.call(Collection);
|
||||
|
||||
module.exports = Collection;
|
@ -0,0 +1,107 @@
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var Backgrid = require('backgrid');
|
||||
//var ButtonsView = require('./ButtonsView');
|
||||
//var ManualSearchLayout = require('./ManualLayout');
|
||||
var FilesCollection = require('./FilesCollection');
|
||||
var CommandController = require('../../Commands/CommandController');
|
||||
var LoadingView = require('../../Shared/LoadingView');
|
||||
var NoResultsView = require('./NoFilesView');
|
||||
var FileModel = require("./FileModel");
|
||||
var FileTitleCell = require('../../Cells/FileTitleCell');
|
||||
var FileSizeCell = require('../../Cells/FileSizeCell');
|
||||
var QualityCell = require('../../Cells/QualityCell');
|
||||
var MediaInfoCell = require('../../Cells/MediaInfoCell');
|
||||
var ApprovalStatusCell = require('../../Cells/ApprovalStatusCell');
|
||||
var DownloadReportCell = require('../../Release/DownloadReportCell');
|
||||
var AgeCell = require('../../Release/AgeCell');
|
||||
var ProtocolCell = require('../../Release/ProtocolCell');
|
||||
var PeersCell = require('../../Release/PeersCell');
|
||||
var EditionCell = require('../../Cells/EditionCell');
|
||||
var DeleteFileCell = require("./DeleteFileCell");
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Movies/Files/FilesLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
main : '#movie-files-region',
|
||||
grid : "#movie-files-grid"
|
||||
},
|
||||
|
||||
events : {
|
||||
'click .x-search-auto' : '_searchAuto',
|
||||
'click .x-search-manual' : '_searchManual',
|
||||
'click .x-search-back' : '_showButtons'
|
||||
},
|
||||
|
||||
columns : [
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
cell : FileTitleCell
|
||||
},
|
||||
{
|
||||
name : "mediaInfo",
|
||||
label : "Media Info",
|
||||
cell : MediaInfoCell
|
||||
},
|
||||
{
|
||||
name : 'edition',
|
||||
label : 'Edition',
|
||||
cell : EditionCell,
|
||||
title : "Edition",
|
||||
},
|
||||
{
|
||||
name : 'size',
|
||||
label : 'Size',
|
||||
cell : FileSizeCell
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label : 'Quality',
|
||||
cell : QualityCell,
|
||||
},
|
||||
{
|
||||
name : "delete",
|
||||
label : "",
|
||||
cell : DeleteFileCell,
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
initialize : function(movie) {
|
||||
this.filesCollection = new FilesCollection();
|
||||
var file = movie.model.get("movieFile");
|
||||
this.filesCollection.add(file);
|
||||
//this.listenTo(this.releaseCollection, 'sync', this._showSearchResults);
|
||||
},
|
||||
|
||||
onShow : function() {
|
||||
this.grid.show(new Backgrid.Grid({
|
||||
row : Backgrid.Row,
|
||||
columns : this.columns,
|
||||
collection : this.filesCollection,
|
||||
className : 'table table-hover'
|
||||
}));
|
||||
},
|
||||
|
||||
_showMainView : function() {
|
||||
this.main.show(this.mainView);
|
||||
},
|
||||
|
||||
_showButtons : function() {
|
||||
this._showMainView();
|
||||
},
|
||||
|
||||
_showSearchResults : function() {
|
||||
if (this.releaseCollection.length === 0) {
|
||||
this.mainView = new NoResultsView();
|
||||
}
|
||||
|
||||
else {
|
||||
//this.mainView = new ManualSearchLayout({ collection : this.releaseCollection });
|
||||
}
|
||||
|
||||
this._showMainView();
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
<div id="movie-files-region"><div id="movie-files-grid" class="table-responsive"></div></div>
|
@ -0,0 +1,5 @@
|
||||
var Marionette = require('marionette');
|
||||
|
||||
module.exports = Marionette.ItemView.extend({
|
||||
template : 'Movies/Files/NoFilesViewTemplate'
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
<p class="text-warning">
|
||||
No files for this movie.
|
||||
</p>
|
Loading…
Reference in new issue