Button to sort fillers. Display show title (if any) in filler list. Sort movies by name in 'Sort Shows'

This commit is contained in:
vexorian 2021-09-21 21:28:36 -04:00
parent f18b853575
commit 6af399a689
3 changed files with 34 additions and 5 deletions

View File

@ -1,4 +1,4 @@
module.exports = function ($timeout) {
module.exports = function ($timeout, commonProgramTools, getShowData) {
return {
restrict: 'E',
templateUrl: 'templates/filler-config.html',
@ -92,13 +92,26 @@ module.exports = function ($timeout) {
id: scope.id,
} );
}
scope.getText = (clip) => {
let show = getShowData(clip);
if (show.hasShow && show.showId !== "movie." ) {
return show.showDisplayName + " - " + clip.title;
} else {
return clip.title;
}
}
scope.showList = () => {
return ! scope.showPlexLibrary;
}
scope.sortFillers = () => {
scope.sortFillersByLength = () => {
scope.content.sort( (a,b) => { return a.duration - b.duration } );
refreshContentIndexes();
}
scope.sortFillersCorrectly = () => {
scope.content = commonProgramTools.sortShows(scope.content);
refreshContentIndexes();
}
scope.fillerRemoveAllFiller = () => {
scope.content = [];
refreshContentIndexes();

View File

@ -37,16 +37,23 @@
<div ng-show="showTools">
<div class="row">
<div class="input-group col-md-3" style="padding: 5px;">
<button class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="sortFillers()">
<button class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="sortFillersCorrectly()">
<i class='fa fa-sort-alpha-down'></i> Sort Clips
</button>
</div>
<div class="input-group col-md-3" style="padding: 5px;">
<button class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="sortFillersByLength()">
<i class='fa fa-sort-amount-down-alt'></i> Sort Lengths
</button>
</div>
<div class="input-group col-md-3" style="padding: 5px;">
<button class="btn btn-sm btn-danger form-control form-control-sm" type="button" ng-click="fillerRemoveDuplicates()">
<i class='fa fa-trash-alt'></i> Remove Duplicates
</button>
</div>
<div class="input-group col-md-6" style="padding: 5px;">
<div class="input-group col-md-3" style="padding: 5px;">
<button class="btn btn-sm btn-danger form-control form-control-sm" type="button" ng-click="fillerRemoveAllFiller()">
<i class='fa fa-trash-alt'></i> Remove All Filler
</button>
@ -79,7 +86,7 @@
</div>
<div ng-style="programSquareStyle(x, false)" ></div>
<div class="title" >
{{x.title}}
{{ getText(x) }}
</div>
<div class="flex-pull-right">
<button class="btn btn-sm btn-link" ng-click="contentSplice(x.$index,1)">

View File

@ -30,6 +30,15 @@ module.exports = function (getShowData) {
})
newProgs = newProgs.concat(shows[keys[i]])
}
movies.sort( (a,b) => {
if (a.title === b.title) {
return 0;
} else if (a.title < b.title) {
return -1;
} else {
return 1;
}
} );
return newProgs.concat(movies);
}