Merge pull request #152 from vexorian/20201004_dev
FF/REW channel tools
This commit is contained in:
commit
de73640753
@ -60,24 +60,7 @@ module.exports = function ($timeout, $location, dizquetv) {
|
||||
scope.showRotatedNote = false;
|
||||
} else {
|
||||
scope.beforeEditChannelNumber = scope.channel.number
|
||||
let t = Date.now();
|
||||
let originalStart = scope.channel.startTime.getTime();
|
||||
let n = scope.channel.programs.length;
|
||||
let totalDuration = scope.channel.duration;
|
||||
let m = (t - originalStart) % totalDuration;
|
||||
let x = 0;
|
||||
let runningProgram = -1;
|
||||
let offset = 0;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let d = scope.channel.programs[i].duration;
|
||||
if (x + d > m) {
|
||||
runningProgram = i
|
||||
offset = m - x;
|
||||
break;
|
||||
} else {
|
||||
x += d;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof(scope.channel.fillerRepeatCooldown) === 'undefined') {
|
||||
scope.channel.fillerRepeatCooldown = 30 * 60 * 1000;
|
||||
}
|
||||
@ -104,13 +87,40 @@ module.exports = function ($timeout, $location, dizquetv) {
|
||||
) {
|
||||
scope.channel.guideMinimumDurationSeconds = 5 * 60;
|
||||
}
|
||||
scope.channel.startTime = new Date(t - offset);
|
||||
// move runningProgram to index 0
|
||||
scope.channel.programs = scope.channel.programs.slice(runningProgram, this.length)
|
||||
.concat(scope.channel.programs.slice(0, runningProgram) );
|
||||
|
||||
adjustStartTimeToCurrentProgram();
|
||||
updateChannelDuration();
|
||||
setTimeout( () => { scope.showRotatedNote = true }, 1, 'funky');
|
||||
}
|
||||
|
||||
function adjustStartTimeToCurrentProgram() {
|
||||
let t = Date.now();
|
||||
let originalStart = scope.channel.startTime.getTime();
|
||||
let n = scope.channel.programs.length;
|
||||
let totalDuration = scope.channel.duration;
|
||||
let m = (t - originalStart) % totalDuration;
|
||||
let x = 0;
|
||||
let runningProgram = -1;
|
||||
let offset = 0;
|
||||
for (let i = 0; i < n; i++) {
|
||||
let d = scope.channel.programs[i].duration;
|
||||
if (x + d > m) {
|
||||
runningProgram = i
|
||||
offset = m - x;
|
||||
break;
|
||||
} else {
|
||||
x += d;
|
||||
}
|
||||
}
|
||||
// move runningProgram to index 0
|
||||
scope.channel.programs = scope.channel.programs.slice(runningProgram)
|
||||
.concat(scope.channel.programs.slice(0, runningProgram) );
|
||||
scope.channel.startTime = new Date(t - offset);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
let addMinuteVersionsOfFields = () => {
|
||||
//add the minutes versions of the cooldowns:
|
||||
scope.channel.fillerRepeatCooldownMinutes = scope.channel.fillerRepeatCooldown / 1000 / 60;
|
||||
@ -186,21 +196,6 @@ module.exports = function ($timeout, $location, dizquetv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let fixFillerCollection = (f) => {
|
||||
return {
|
||||
id: f.id,
|
||||
weight: f.weight,
|
||||
cooldown: f.cooldown * 60000,
|
||||
};
|
||||
}
|
||||
let unfixFillerCollection = (f) => {
|
||||
return {
|
||||
id: f.id,
|
||||
weight: f.weight,
|
||||
cooldown: Math.floor(f.cooldown / 60000),
|
||||
};
|
||||
}
|
||||
|
||||
scope.finishedOfflineEdit = (program) => {
|
||||
let editedProgram = scope.channel.programs[scope.selectedProgram];
|
||||
let duration = program.durationSeconds * 1000;
|
||||
@ -317,6 +312,19 @@ module.exports = function ($timeout, $location, dizquetv) {
|
||||
});
|
||||
updateChannelDuration()
|
||||
}
|
||||
scope.slideAllPrograms = (offset) => {
|
||||
let t0 = scope.channel.startTime.getTime();
|
||||
let t1 = t0 - offset;
|
||||
let t = (new Date()).getTime();
|
||||
let total = scope.channel.duration;
|
||||
while(t1 > t) {
|
||||
//TODO: Replace with division
|
||||
t1 -= total;
|
||||
}
|
||||
scope.channel.startTime = new Date(t1);
|
||||
adjustStartTimeToCurrentProgram();
|
||||
updateChannelDuration();
|
||||
}
|
||||
scope.removeDuplicates = () => {
|
||||
let tmpProgs = {}
|
||||
let progs = scope.channel.programs
|
||||
@ -1401,6 +1409,23 @@ module.exports = function ($timeout, $location, dizquetv) {
|
||||
}
|
||||
});
|
||||
|
||||
scope.slide = {
|
||||
value: -1,
|
||||
options: [
|
||||
{id:-1, description: "Time Amount" },
|
||||
{id: 1 * 60 * 1000, description: "1 minute" },
|
||||
{id: 10 * 60 * 1000, description: "10 minutes" },
|
||||
{id: 15 * 60 * 1000, description: "15 minutes" },
|
||||
{id: 30 * 60 * 1000, description: "30 minutes" },
|
||||
{id: 60 * 60 * 1000, description: "1 hour" },
|
||||
{id: 2 * 60 * 60 * 1000, description: "2 hours" },
|
||||
{id: 4 * 60 * 60 * 1000, description: "4 hours" },
|
||||
{id: 8 * 60 * 60 * 1000, description: "8 hours" },
|
||||
{id:12 * 60 * 60 * 1000, description: "12 hours" },
|
||||
{id:24 * 60 * 60 * 1000, description: "1 day" },
|
||||
{id: 7 * 24 * 60 * 60 * 1000, description: "1 week" },
|
||||
]
|
||||
}
|
||||
|
||||
scope.nightStartHours = [ { id: -1, description: "Start" } ];
|
||||
scope.nightEndHours = [ { id: -1, description: "End" } ];
|
||||
|
||||
@ -218,6 +218,30 @@
|
||||
<p ng-show='showHelp.check'>Like Random Shuffle, but tries to preserve the sequence of episodes for each TV show. If a TV show has multiple instances of its episodes, they are also cycled appropriately.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-6 col-lg-12" style="padding: 5px;" ng-show="hasPrograms()">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<input type="number" class="form-control form-control-sm" placeholder="Repeats" min="1" max="{{maxReplicas()}}" ng-model="replicaCount" style="width:5em">
|
||||
</div>
|
||||
<button ng-disabled="!(replicaCount >= 2)" class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="replicate(replicaCount)" title='Replicate' >
|
||||
<i class='fas fa-recycle'></i> Replicate
|
||||
</button>
|
||||
</div>
|
||||
<p ng-show='showHelp.check'>Makes multiple copies of the schedule and plays them in sequence. Normally this isn't necessary, because dizqueTV will always play the schedule back from the beginning when it finishes. But creating replicas is a useful intermediary step sometimes before applying other transformations. Note that because very large channels can be problematic, the number of replicas will be limited to avoid creating really large channels.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-6 col-lg-12" style="padding: 5px;" ng-show="hasPrograms()">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<input type="number" class="form-control form-control-sm" placeholder="Repeats" min="1" max="{{maxReplicas()}}" ng-model="randomReplicaCount" style="width:5em">
|
||||
</div>
|
||||
<button ng-disabled="!(randomReplicaCount >= 2)" class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="shuffleReplicate(randomReplicaCount)" title='Replicate & Shuffle' >
|
||||
<i class='fas fa-dice'></i> Replicate & Shuffle
|
||||
</button>
|
||||
</div>
|
||||
<p ng-show='showHelp.check'>Like "Replicate", it will make multiple copies of the programming. In addition it will shuffle the programs, but it will make sure not to have too small a distance between two identical programs.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-3 col-lg-6" style="padding: 5px;" ng-show="hasPrograms()" >
|
||||
<div class='input-group'>
|
||||
<button class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="sortShows()" title='Sort TV Shows' >
|
||||
@ -238,7 +262,6 @@
|
||||
<p ng-show='showHelp.check'>Sorts everything by its release date. This will only work correctly if the release dates in Plex are correct. In case any item does not have a release date specified, it will be moved to the bottom.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xl-3 col-lg-6" style="padding: 5px;" ng-show="hasPrograms()" >
|
||||
<div class="input-group">
|
||||
<button class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="equalizeShows()" title='Balance Shows' >
|
||||
@ -350,30 +373,6 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-6 col-lg-12" style="padding: 5px;" ng-show="hasPrograms()">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<input type="number" class="form-control form-control-sm" placeholder="Repeats" min="1" max="{{maxReplicas()}}" ng-model="replicaCount" style="width:5em">
|
||||
</div>
|
||||
<button ng-disabled="!(replicaCount >= 2)" class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="replicate(replicaCount)" title='Replicate' >
|
||||
<i class='fas fa-recycle'></i> Replicate
|
||||
</button>
|
||||
</div>
|
||||
<p ng-show='showHelp.check'>Makes multiple copies of the schedule and plays them in sequence. Normally this isn't necessary, because dizqueTV will always play the schedule back from the beginning when it finishes. But creating replicas is a useful intermediary step sometimes before applying other transformations. Note that because very large channels can be problematic, the number of replicas will be limited to avoid creating really large channels.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-6 col-lg-12" style="padding: 5px;" ng-show="hasPrograms()">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<input type="number" class="form-control form-control-sm" placeholder="Repeats" min="1" max="{{maxReplicas()}}" ng-model="randomReplicaCount" style="width:5em">
|
||||
</div>
|
||||
<button ng-disabled="!(randomReplicaCount >= 2)" class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="shuffleReplicate(randomReplicaCount)" title='Replicate & Shuffle' >
|
||||
<i class='fas fa-dice'></i> Replicate & Shuffle
|
||||
</button>
|
||||
</div>
|
||||
<p ng-show='showHelp.check'>Like "Replicate", it will make multiple copies of the programming. In addition it will shuffle the programs, but it will make sure not to have too small a distance between two identical programs.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-6 col-lg-12" style="padding: 5px;" >
|
||||
<div class='input-group'>
|
||||
<button class="btn btn-sm btn-warning form-control form-control-sm" type="button" ng-click="addRedirect()" title='Add Redirect...' >
|
||||
@ -401,6 +400,28 @@
|
||||
<p ng-show='showHelp.check'>Will redirect to another channel while between the selected hours.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-xl-12 col-lg-12" style="padding: 5px;" ng-show="hasPrograms()">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<button class='btn btn-sm btn-warning form-control' ng-click="slideAllPrograms(-slide.value)"
|
||||
ng-disabled="slide.value == -1"
|
||||
>
|
||||
<i class='fas fa-backward'></i> Rewind
|
||||
</button>
|
||||
</div>
|
||||
<select class="custom-select" ng-model="slide.value"
|
||||
ng-options="o.id as o.description for o in slide.options" ></select>
|
||||
<div class="input-group-append">
|
||||
<button class='btn btn-sm btn-warning form-control' ng-click="slideAllPrograms(slide.value)"
|
||||
ng-disabled="slide.value == -1"
|
||||
>
|
||||
<i class='fas fa-forward'></i> Fast-Forward
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p ng-show='showHelp.check'>Slides the whole schedule. The "Fast-Forward" button will advance the stream by the specified amount of time. The "Rewind" button does the opposite.</p>
|
||||
</div>
|
||||
|
||||
<div class="col-md-auto" style="padding: 5px;" ng-show="hasPrograms()">
|
||||
<div class='input-group'>
|
||||
<button class="btn btn-sm btn-danger form-control form-control-sm" type="button" ng-click="removeDuplicates()" title='Remove Duplicates' >
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user