feat: Implement scheduling functionality for playlist synchronization
- Added a new scheduler module using APScheduler to manage scheduled sync jobs. - Introduced cron expression validation and job scheduling based on user-defined settings. - Enhanced frontend to support schedule settings, including cron, daily, and weekly modes. - Updated API service to handle fetching and saving schedule settings. - Modified StrategySelector component to include schedule management UI. - Added new types for schedule settings and modes in the frontend. - Updated requirements to include APScheduler for scheduling capabilities.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Playlist, ServerType, ApiResponse, PlexServerConnection, PlexConnectionSettings, PlexLibrary, RegexReplacement, SyncStrategy } from '../types';
|
||||
import { Playlist, ServerType, ApiResponse, PlexServerConnection, PlexConnectionSettings, PlexLibrary, RegexReplacement, SyncStrategy, ScheduleSettings } from '../types';
|
||||
|
||||
const API_BASE = import.meta.env.VITE_API_BASE_URL || '';
|
||||
|
||||
@@ -97,6 +97,20 @@ export const apiService = {
|
||||
return handleResponse(response);
|
||||
},
|
||||
|
||||
async getScheduleSettings(): Promise<ApiResponse<ScheduleSettings & { nextRun?: string }>> {
|
||||
const response = await fetch(`${API_BASE}/api/schedule`);
|
||||
return handleResponse(response);
|
||||
},
|
||||
|
||||
async saveScheduleSettings(settings: ScheduleSettings): Promise<ApiResponse<null>> {
|
||||
const response = await fetch(`${API_BASE}/api/schedule`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(settings),
|
||||
});
|
||||
return handleResponse(response);
|
||||
},
|
||||
|
||||
async getPlaylists(serverType: ServerType, signal?: AbortSignal, localPath?: string): Promise<ApiResponse<Playlist[]>> {
|
||||
const params = new URLSearchParams({ server: serverType.toLowerCase() });
|
||||
if (serverType === ServerType.LOCAL && localPath) {
|
||||
|
||||
Reference in New Issue
Block a user