mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-22 03:03:19 +03:00
Added timezone information to tasks so that recurring tasks will use the timezone from the user
This commit is contained in:
@@ -2589,6 +2589,8 @@ components:
|
|||||||
type: number
|
type: number
|
||||||
timestamp:
|
timestamp:
|
||||||
type: number
|
type: number
|
||||||
|
tz:
|
||||||
|
type: string
|
||||||
DBBackup:
|
DBBackup:
|
||||||
required:
|
required:
|
||||||
- name
|
- name
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function scheduleJob(task_key, schedule) {
|
|||||||
const dayOfWeek = schedule['data']['dayOfWeek'] != null ? schedule['data']['dayOfWeek'] : null;
|
const dayOfWeek = schedule['data']['dayOfWeek'] != null ? schedule['data']['dayOfWeek'] : null;
|
||||||
const hour = schedule['data']['hour'] != null ? schedule['data']['hour'] : null;
|
const hour = schedule['data']['hour'] != null ? schedule['data']['hour'] : null;
|
||||||
const minute = schedule['data']['minute'] != null ? schedule['data']['minute'] : null;
|
const minute = schedule['data']['minute'] != null ? schedule['data']['minute'] : null;
|
||||||
converted_schedule = new scheduler.RecurrenceRule(null, null, null, dayOfWeek, hour, minute);
|
converted_schedule = new scheduler.RecurrenceRule(null, null, null, dayOfWeek, hour, minute, undefined, schedule['data']['tz'] ? schedule['data']['tz'] : undefined);
|
||||||
} else {
|
} else {
|
||||||
logger.error(`Failed to schedule job '${task_key}' as the type '${schedule['type']}' is invalid.`)
|
logger.error(`Failed to schedule job '${task_key}' as the type '${schedule['type']}' is invalid.`)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ dayOfWeek?: Array<number>;
|
|||||||
hour?: number;
|
hour?: number;
|
||||||
minute?: number;
|
minute?: number;
|
||||||
timestamp?: number;
|
timestamp?: number;
|
||||||
|
tz?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@
|
|||||||
<mat-cell *matCellDef="let element">
|
<mat-cell *matCellDef="let element">
|
||||||
<span *ngIf="element.running || element.confirming"><mat-spinner matTooltip="Busy" i18n-matTooltip="Busy" [diameter]="25"></mat-spinner></span>
|
<span *ngIf="element.running || element.confirming"><mat-spinner matTooltip="Busy" i18n-matTooltip="Busy" [diameter]="25"></mat-spinner></span>
|
||||||
<span *ngIf="!(element.running || element.confirming) && element.schedule" style="display: flex">
|
<span *ngIf="!(element.running || element.confirming) && element.schedule" style="display: flex">
|
||||||
<ng-container i18n="Scheduled">Scheduled for</ng-container>
|
<ng-container i18n="Scheduled">Scheduled for</ng-container>
|
||||||
{{element.next_invocation | date: 'short'}}<mat-icon style="font-size: 16px; display: inline-flex; align-items: center; padding-left: 5px;" *ngIf="element.schedule.type === 'recurring'">repeat</mat-icon>
|
{{element.next_invocation | date: 'short'}}<mat-icon style="font-size: 16px; display: inline-flex; align-items: center; padding-left: 5px; padding-bottom: 6px;" *ngIf="element.schedule.type === 'recurring'">repeat</mat-icon>
|
||||||
</span>
|
</span>
|
||||||
<span *ngIf="!(element.running || element.confirming) && !element.schedule">
|
<span *ngIf="!(element.running || element.confirming) && !element.schedule">
|
||||||
<ng-container i18n="Not scheduled">Not scheduled</ng-container>
|
<ng-container i18n="Not scheduled">Not scheduled</ng-container>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Time</mat-label>
|
<mat-label>Time</mat-label>
|
||||||
<input type="time" matInput [(ngModel)]="time" [disabled]="!enabled">
|
<input type="time" matInput [(ngModel)]="time" [disabled]="!enabled">
|
||||||
|
<mat-hint *ngIf="Intl?.DateTimeFormat().resolvedOptions().timeZone">{{Intl.DateTimeFormat().resolvedOptions().timeZone}}</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ export class UpdateTaskScheduleDialogComponent implements OnInit {
|
|||||||
days_of_week = [];
|
days_of_week = [];
|
||||||
interval = 'daily';
|
interval = 'daily';
|
||||||
time = null;
|
time = null;
|
||||||
date = null;
|
date: Date = null;
|
||||||
today = new Date();
|
today = new Date();
|
||||||
|
Intl = Intl;
|
||||||
|
|
||||||
constructor(@Inject(MAT_DIALOG_DATA) public data: {task: Task}, private dialogRef: MatDialogRef<UpdateTaskScheduleDialogComponent>, private postsService: PostsService) {
|
constructor(@Inject(MAT_DIALOG_DATA) public data: {task: Task}, private dialogRef: MatDialogRef<UpdateTaskScheduleDialogComponent>, private postsService: PostsService) {
|
||||||
this.processTask(this.data.task);
|
this.processTask(this.data.task);
|
||||||
@@ -66,6 +67,8 @@ export class UpdateTaskScheduleDialogComponent implements OnInit {
|
|||||||
|
|
||||||
if (!this.time) {
|
if (!this.time) {
|
||||||
// needs time!
|
// needs time!
|
||||||
|
this.postsService.openSnackBar($localize`You must input a time!`);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hours = parseInt(this.time.split(':')[0]);
|
const hours = parseInt(this.time.split(':')[0]);
|
||||||
@@ -81,6 +84,7 @@ export class UpdateTaskScheduleDialogComponent implements OnInit {
|
|||||||
this.date.setHours(hours, minutes);
|
this.date.setHours(hours, minutes);
|
||||||
schedule['data'] = {timestamp: this.date.getTime()};
|
schedule['data'] = {timestamp: this.date.getTime()};
|
||||||
}
|
}
|
||||||
|
schedule['data']['tz'] = this.Intl?.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
this.dialogRef.close(schedule);
|
this.dialogRef.close(schedule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user