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:
+49
@@ -14,9 +14,14 @@ from app.utils.local_playlist import load_local_playlist, scan_local_playlists
|
|||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
from app.utils.playlist_merge import SyncMode, TEST_PLAYLIST_DIR, sync_all_playlists
|
from app.utils.playlist_merge import SyncMode, TEST_PLAYLIST_DIR, sync_all_playlists
|
||||||
from app.utils.plex_client import plex_client
|
from app.utils.plex_client import plex_client
|
||||||
|
from app.utils.scheduler import start_scheduler, update_scheduler_job, get_next_run_time, validate_cron_expression
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
@app.on_event("startup")
|
||||||
|
async def startup_event():
|
||||||
|
start_scheduler()
|
||||||
|
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=["*"],
|
allow_origins=["*"],
|
||||||
@@ -107,6 +112,50 @@ class ConnectRequest(BaseModel):
|
|||||||
library_name: str | None = None
|
library_name: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class ScheduleSettings(BaseModel):
|
||||||
|
mode: str
|
||||||
|
cronExpression: str
|
||||||
|
dailyTime: str
|
||||||
|
weeklyDays: list[int]
|
||||||
|
weeklyTime: str
|
||||||
|
autoWatch: bool
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/api/schedule")
|
||||||
|
async def get_schedule():
|
||||||
|
next_run = get_next_run_time()
|
||||||
|
next_run_str = next_run.strftime("%Y-%m-%d %H:%M:%S") if next_run else None
|
||||||
|
|
||||||
|
return {
|
||||||
|
"mode": server_config.schedule_mode,
|
||||||
|
"cronExpression": server_config.schedule_cron,
|
||||||
|
"dailyTime": server_config.schedule_daily_time,
|
||||||
|
"weeklyDays": server_config.schedule_weekly_days,
|
||||||
|
"weeklyTime": server_config.schedule_weekly_time,
|
||||||
|
"autoWatch": server_config.schedule_auto_watch,
|
||||||
|
"nextRun": next_run_str
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@app.put("/api/schedule")
|
||||||
|
async def save_schedule(settings: ScheduleSettings):
|
||||||
|
# Validate Cron if mode is CRON
|
||||||
|
if settings.mode == "CRON" and settings.cronExpression.strip():
|
||||||
|
if not validate_cron_expression(settings.cronExpression):
|
||||||
|
raise HTTPException(status_code=400, detail="Invalid Cron expression format")
|
||||||
|
|
||||||
|
server_config.set_schedule(
|
||||||
|
mode=settings.mode,
|
||||||
|
cron=settings.cronExpression,
|
||||||
|
daily_time=settings.dailyTime,
|
||||||
|
weekly_days=settings.weeklyDays,
|
||||||
|
weekly_time=settings.weeklyTime,
|
||||||
|
auto_watch=settings.autoWatch
|
||||||
|
)
|
||||||
|
update_scheduler_job()
|
||||||
|
return {"status": "success", "message": "Schedule updated"}
|
||||||
|
|
||||||
|
|
||||||
class ConnectResponse(BaseModel):
|
class ConnectResponse(BaseModel):
|
||||||
token: str
|
token: str
|
||||||
serverInfo: dict
|
serverInfo: dict
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ class ServerConfig:
|
|||||||
self.sync_mode = DEFAULT_SYNC_MODE
|
self.sync_mode = DEFAULT_SYNC_MODE
|
||||||
self.local_path = "playlist"
|
self.local_path = "playlist"
|
||||||
self.path_rules: list[dict[str, str]] = []
|
self.path_rules: list[dict[str, str]] = []
|
||||||
|
self.schedule_mode = "DISABLED"
|
||||||
|
self.schedule_cron = ""
|
||||||
|
self.schedule_daily_time = "02:00"
|
||||||
|
self.schedule_weekly_days = [0]
|
||||||
|
self.schedule_weekly_time = "03:00"
|
||||||
|
self.schedule_auto_watch = False
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
def load(self) -> None:
|
def load(self) -> None:
|
||||||
@@ -49,6 +55,12 @@ class ServerConfig:
|
|||||||
self.sync_mode = config.get("sync_mode", DEFAULT_SYNC_MODE)
|
self.sync_mode = config.get("sync_mode", DEFAULT_SYNC_MODE)
|
||||||
self.local_path = config.get("local_path", "playlist")
|
self.local_path = config.get("local_path", "playlist")
|
||||||
self.path_rules = config.get("path_rules", []) or []
|
self.path_rules = config.get("path_rules", []) or []
|
||||||
|
self.schedule_mode = config.get("schedule_mode", "DISABLED")
|
||||||
|
self.schedule_cron = config.get("schedule_cron", "")
|
||||||
|
self.schedule_daily_time = config.get("schedule_daily_time", "02:00")
|
||||||
|
self.schedule_weekly_days = config.get("schedule_weekly_days", [0])
|
||||||
|
self.schedule_weekly_time = config.get("schedule_weekly_time", "03:00")
|
||||||
|
self.schedule_auto_watch = config.get("schedule_auto_watch", False)
|
||||||
logger.info(f"Server config loaded: {self.__dict__}")
|
logger.info(f"Server config loaded: {self.__dict__}")
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
@@ -63,6 +75,12 @@ class ServerConfig:
|
|||||||
"sync_mode": self.sync_mode,
|
"sync_mode": self.sync_mode,
|
||||||
"local_path": self.local_path,
|
"local_path": self.local_path,
|
||||||
"path_rules": self.path_rules,
|
"path_rules": self.path_rules,
|
||||||
|
"schedule_mode": self.schedule_mode,
|
||||||
|
"schedule_cron": self.schedule_cron,
|
||||||
|
"schedule_daily_time": self.schedule_daily_time,
|
||||||
|
"schedule_weekly_days": self.schedule_weekly_days,
|
||||||
|
"schedule_weekly_time": self.schedule_weekly_time,
|
||||||
|
"schedule_auto_watch": self.schedule_auto_watch,
|
||||||
}
|
}
|
||||||
with open(CONFIG_PATH, "w", encoding="utf-8") as f:
|
with open(CONFIG_PATH, "w", encoding="utf-8") as f:
|
||||||
json.dump(config, f, indent=4, ensure_ascii=False)
|
json.dump(config, f, indent=4, ensure_ascii=False)
|
||||||
@@ -102,6 +120,23 @@ class ServerConfig:
|
|||||||
def set_path_rules(self, path_rules: list[dict[str, str]]) -> None:
|
def set_path_rules(self, path_rules: list[dict[str, str]]) -> None:
|
||||||
self.path_rules = path_rules or []
|
self.path_rules = path_rules or []
|
||||||
|
|
||||||
|
def set_schedule(
|
||||||
|
self,
|
||||||
|
mode: str,
|
||||||
|
cron: str,
|
||||||
|
daily_time: str,
|
||||||
|
weekly_days: list[int],
|
||||||
|
weekly_time: str,
|
||||||
|
auto_watch: bool,
|
||||||
|
) -> None:
|
||||||
|
self.schedule_mode = mode
|
||||||
|
self.schedule_cron = cron
|
||||||
|
self.schedule_daily_time = daily_time
|
||||||
|
self.schedule_weekly_days = weekly_days
|
||||||
|
self.schedule_weekly_time = weekly_time
|
||||||
|
self.schedule_auto_watch = auto_watch
|
||||||
|
self.save()
|
||||||
|
|
||||||
def set_and_save_config(
|
def set_and_save_config(
|
||||||
self,
|
self,
|
||||||
theme: str = None,
|
theme: str = None,
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
|
from apscheduler.triggers.cron import CronTrigger
|
||||||
|
from app.utils.config import server_config
|
||||||
|
from app.utils.logger import logger
|
||||||
|
from app.utils.playlist_merge import sync_all_playlists, SyncMode
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
scheduler = BackgroundScheduler()
|
||||||
|
|
||||||
|
def validate_cron_expression(expression: str) -> bool:
|
||||||
|
try:
|
||||||
|
parts = expression.split()
|
||||||
|
if len(parts) != 5:
|
||||||
|
return False
|
||||||
|
# Try to create a trigger to validate
|
||||||
|
CronTrigger(
|
||||||
|
minute=parts[0],
|
||||||
|
hour=parts[1],
|
||||||
|
day=parts[2],
|
||||||
|
month=parts[3],
|
||||||
|
day_of_week=parts[4]
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def job_function():
|
||||||
|
logger.info("Executing scheduled sync job...")
|
||||||
|
try:
|
||||||
|
# Re-read config to ensure latest values
|
||||||
|
server_config.load()
|
||||||
|
|
||||||
|
mode_str = server_config.sync_mode
|
||||||
|
regex_rules = server_config.path_rules
|
||||||
|
local_path = server_config.local_path
|
||||||
|
|
||||||
|
asyncio.run(sync_all_playlists(
|
||||||
|
sync_mode=SyncMode(mode_str),
|
||||||
|
path_rules=regex_rules,
|
||||||
|
local_dir=local_path
|
||||||
|
))
|
||||||
|
|
||||||
|
logger.info("Scheduled sync job completed.")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Scheduled sync job failed: {e}")
|
||||||
|
|
||||||
|
def start_scheduler():
|
||||||
|
if not scheduler.running:
|
||||||
|
scheduler.start()
|
||||||
|
logger.info("Scheduler started.")
|
||||||
|
update_scheduler_job()
|
||||||
|
|
||||||
|
def update_scheduler_job():
|
||||||
|
scheduler.remove_all_jobs()
|
||||||
|
|
||||||
|
# Reload config to get latest schedule settings
|
||||||
|
server_config.load()
|
||||||
|
mode = server_config.schedule_mode
|
||||||
|
|
||||||
|
if mode == "DISABLED":
|
||||||
|
logger.info("Schedule is disabled.")
|
||||||
|
return
|
||||||
|
|
||||||
|
trigger = None
|
||||||
|
|
||||||
|
if mode == "CRON":
|
||||||
|
cron_exp = server_config.schedule_cron
|
||||||
|
if cron_exp:
|
||||||
|
try:
|
||||||
|
# 5 parts: minute hour day month day_of_week
|
||||||
|
parts = cron_exp.split()
|
||||||
|
if len(parts) == 5:
|
||||||
|
trigger = CronTrigger(
|
||||||
|
minute=parts[0],
|
||||||
|
hour=parts[1],
|
||||||
|
day=parts[2],
|
||||||
|
month=parts[3],
|
||||||
|
day_of_week=parts[4]
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Invalid cron expression: {cron_exp}, error: {e}")
|
||||||
|
|
||||||
|
elif mode == "DAILY":
|
||||||
|
time_str = server_config.schedule_daily_time
|
||||||
|
try:
|
||||||
|
hour, minute = map(int, time_str.split(':'))
|
||||||
|
trigger = CronTrigger(hour=hour, minute=minute)
|
||||||
|
except ValueError:
|
||||||
|
logger.error(f"Invalid daily time: {time_str}")
|
||||||
|
|
||||||
|
elif mode == "WEEKLY":
|
||||||
|
days = server_config.schedule_weekly_days # list of ints 0-6 (Sun-Sat)
|
||||||
|
time_str = server_config.schedule_weekly_time
|
||||||
|
|
||||||
|
# Frontend: 0(Sun), 1(Mon)... 6(Sat)
|
||||||
|
# APScheduler: 0(Mon)... 6(Sun)
|
||||||
|
|
||||||
|
aps_days = []
|
||||||
|
for d in days:
|
||||||
|
if d == 0: aps_days.append(6)
|
||||||
|
else: aps_days.append(d - 1)
|
||||||
|
|
||||||
|
days_str = ",".join(map(str, aps_days))
|
||||||
|
|
||||||
|
try:
|
||||||
|
hour, minute = map(int, time_str.split(':'))
|
||||||
|
trigger = CronTrigger(day_of_week=days_str, hour=hour, minute=minute)
|
||||||
|
except ValueError:
|
||||||
|
logger.error(f"Invalid weekly time: {time_str}")
|
||||||
|
|
||||||
|
if trigger:
|
||||||
|
scheduler.add_job(job_function, trigger)
|
||||||
|
logger.info(f"Added scheduled job with mode {mode} and trigger {trigger}")
|
||||||
|
else:
|
||||||
|
logger.warning(f"Failed to create trigger for mode {mode}")
|
||||||
|
|
||||||
|
def get_next_run_time():
|
||||||
|
jobs = scheduler.get_jobs()
|
||||||
|
if not jobs:
|
||||||
|
return None
|
||||||
|
# Assuming only one job
|
||||||
|
job = jobs[0]
|
||||||
|
return job.next_run_time
|
||||||
+1
-1
@@ -5,7 +5,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8888:8080"
|
- "8888:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- path_to_your_playlist:/app/playlist
|
- /D/WorkSpace/Python/PlexPlaylistSync/playlist:/app/playlist
|
||||||
environment:
|
environment:
|
||||||
- PYTHONUNBUFFERED=1
|
- PYTHONUNBUFFERED=1
|
||||||
- PYTHONDONTWRITEBYTECODE=1
|
- PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|||||||
+92
-16
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
||||||
import { Playlist, ServerType, SyncStrategy, PlexServerConnection, RegexReplacement, PlexConnectionSettings, SyncState } from './types';
|
import { Playlist, ServerType, SyncStrategy, PlexServerConnection, RegexReplacement, PlexConnectionSettings, SyncState, ScheduleSettings, ScheduleMode } from './types';
|
||||||
import { apiService } from './services/api';
|
import { apiService } from './services/api';
|
||||||
import {
|
import {
|
||||||
STRIPE_BASE_SPEED,
|
STRIPE_BASE_SPEED,
|
||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
import ServerPanel from './components/ServerPanel';
|
import ServerPanel from './components/ServerPanel';
|
||||||
import StrategySelector from './components/StrategySelector';
|
import StrategySelector from './components/StrategySelector';
|
||||||
import ConnectionModal from './components/ConnectionModal';
|
import ConnectionModal from './components/ConnectionModal';
|
||||||
import { ArrowLeftRight, ShieldCheck, X, Server, ServerOff } from 'lucide-react';
|
import { ArrowLeftRight, ShieldCheck, X, Server, ServerOff, Clock } from 'lucide-react';
|
||||||
|
|
||||||
interface Toast {
|
interface Toast {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -142,6 +142,17 @@ const App: React.FC = () => {
|
|||||||
// Regex State
|
// Regex State
|
||||||
const [regexReplacements, setRegexReplacements] = useState<RegexReplacement[]>([]);
|
const [regexReplacements, setRegexReplacements] = useState<RegexReplacement[]>([]);
|
||||||
|
|
||||||
|
// Schedule State
|
||||||
|
const [scheduleSettings, setScheduleSettings] = useState<ScheduleSettings>({
|
||||||
|
mode: ScheduleMode.DISABLED,
|
||||||
|
cronExpression: '',
|
||||||
|
dailyTime: '02:00',
|
||||||
|
weeklyDays: [0], // Sunday
|
||||||
|
weeklyTime: '03:00',
|
||||||
|
autoWatch: false
|
||||||
|
});
|
||||||
|
const [nextRunTime, setNextRunTime] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
// Toast Notification System
|
// Toast Notification System
|
||||||
const [toasts, setToasts] = useState<Toast[]>([]);
|
const [toasts, setToasts] = useState<Toast[]>([]);
|
||||||
const timeoutsRef = useRef<{[key: number]: ReturnType<typeof setTimeout>}>({});
|
const timeoutsRef = useRef<{[key: number]: ReturnType<typeof setTimeout>}>({});
|
||||||
@@ -219,6 +230,35 @@ const App: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const loadSchedule = useCallback(async () => {
|
||||||
|
const result = await apiService.getScheduleSettings();
|
||||||
|
if (result.status === 'success') {
|
||||||
|
setScheduleSettings(result.data);
|
||||||
|
setNextRunTime(result.data.nextRun);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Handle Schedule Save
|
||||||
|
const handleSaveSchedule = async (settings: ScheduleSettings): Promise<boolean> => {
|
||||||
|
const result = await apiService.saveScheduleSettings(settings);
|
||||||
|
|
||||||
|
if (result.status === 'success') {
|
||||||
|
setScheduleSettings(settings);
|
||||||
|
// Refresh schedule info to get next run time
|
||||||
|
loadSchedule();
|
||||||
|
|
||||||
|
if (settings.mode === ScheduleMode.DISABLED) {
|
||||||
|
addToast("Scheduled tasks disabled.");
|
||||||
|
} else {
|
||||||
|
addToast("Scheduled task updated successfully.");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
addToast(result.message || "Failed to update schedule.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Fetch Local Playlists
|
// Fetch Local Playlists
|
||||||
const refreshLocal = useCallback(async () => {
|
const refreshLocal = useCallback(async () => {
|
||||||
if (localAbortRef.current) localAbortRef.current.abort();
|
if (localAbortRef.current) localAbortRef.current.abort();
|
||||||
@@ -280,7 +320,8 @@ const App: React.FC = () => {
|
|||||||
// Load persisted configuration
|
// Load persisted configuration
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}, [loadSettings]);
|
loadSchedule();
|
||||||
|
}, [loadSettings, loadSchedule]);
|
||||||
|
|
||||||
// Initial Load
|
// Initial Load
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -367,6 +408,25 @@ const App: React.FC = () => {
|
|||||||
|
|
||||||
const isConnected = cloudServerInfo?.isConnected;
|
const isConnected = cloudServerInfo?.isConnected;
|
||||||
|
|
||||||
|
const getScheduleDisplayInfo = () => {
|
||||||
|
if (scheduleSettings.mode === ScheduleMode.DISABLED) {
|
||||||
|
return { label: 'Auto-Sync', value: 'Disabled', active: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
let label = 'Schedule';
|
||||||
|
if (scheduleSettings.mode === ScheduleMode.CRON) label = 'Cron Schedule';
|
||||||
|
else if (scheduleSettings.mode === ScheduleMode.DAILY) label = 'Daily Schedule';
|
||||||
|
else if (scheduleSettings.mode === ScheduleMode.WEEKLY) label = 'Weekly Schedule';
|
||||||
|
|
||||||
|
return {
|
||||||
|
label,
|
||||||
|
value: nextRunTime ? `Next: ${nextRunTime}` : 'Calculating...',
|
||||||
|
active: true
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const scheduleInfo = getScheduleDisplayInfo();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex flex-col bg-gray-900 text-gray-100 font-sans overflow-hidden bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-gray-800 via-gray-900 to-black">
|
<div className="min-h-screen flex flex-col bg-gray-900 text-gray-100 font-sans overflow-hidden bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-gray-800 via-gray-900 to-black">
|
||||||
|
|
||||||
@@ -438,18 +498,32 @@ const App: React.FC = () => {
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Connection Status Button */}
|
{/* Normal Toolbar Right */}
|
||||||
<button
|
<div className="flex items-center gap-4">
|
||||||
onClick={() => setIsConnectionModalOpen(true)}
|
{/* Schedule Info */}
|
||||||
className={`flex items-center justify-center w-9 h-9 rounded-full border transition-all duration-300 hover:scale-105 active:scale-95 shadow-md ${
|
<div className="flex flex-col items-end mr-2 md:mr-0 hidden md:flex">
|
||||||
isConnected
|
<span className="text-[10px] uppercase font-bold text-gray-500 tracking-wider">
|
||||||
? "bg-green-500/10 border-green-500/50 text-green-400 hover:bg-green-500/20 hover:shadow-green-500/20"
|
{scheduleInfo.label}
|
||||||
: "bg-red-500/10 border-red-500/50 text-red-400 hover:bg-red-500/20 hover:shadow-red-500/20"
|
</span>
|
||||||
}`}
|
<div className={`text-xs font-mono flex items-center gap-1.5 ${scheduleInfo.active ? 'text-plex-orange' : 'text-gray-600'}`}>
|
||||||
title={isConnected ? "Connected to Plex" : "Disconnected"}
|
{scheduleInfo.active && <Clock size={12} />}
|
||||||
>
|
<span>{scheduleInfo.value}</span>
|
||||||
{isConnected ? <Server size={18} /> : <ServerOff size={18} />}
|
</div>
|
||||||
</button>
|
</div>
|
||||||
|
|
||||||
|
{/* Connection Status Button */}
|
||||||
|
<button
|
||||||
|
onClick={() => setIsConnectionModalOpen(true)}
|
||||||
|
className={`flex items-center justify-center w-9 h-9 rounded-full border transition-all duration-300 hover:scale-105 active:scale-95 shadow-md ${
|
||||||
|
isConnected
|
||||||
|
? "bg-green-500/10 border-green-500/50 text-green-400 hover:bg-green-500/20 hover:shadow-green-500/20"
|
||||||
|
: "bg-red-500/10 border-red-500/50 text-red-400 hover:bg-red-500/20 hover:shadow-red-500/20"
|
||||||
|
}`}
|
||||||
|
title={isConnected ? "Connected to Plex" : "Disconnected"}
|
||||||
|
>
|
||||||
|
{isConnected ? <Server size={18} /> : <ServerOff size={18} />}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="absolute inset-0 flex items-center justify-center pointer-events-none z-10">
|
<div className="absolute inset-0 flex items-center justify-center pointer-events-none z-10">
|
||||||
@@ -515,11 +589,13 @@ const App: React.FC = () => {
|
|||||||
/* Desktop Positioning: Center Horizontally, Anchored Top */
|
/* Desktop Positioning: Center Horizontally, Anchored Top */
|
||||||
md:top-[64px] md:right-auto md:left-1/2 md:transform md:-translate-x-1/2 md:-translate-y-1/2"
|
md:top-[64px] md:right-auto md:left-1/2 md:transform md:-translate-x-1/2 md:-translate-y-1/2"
|
||||||
>
|
>
|
||||||
<StrategySelector
|
<StrategySelector
|
||||||
currentStrategy={currentStrategy}
|
currentStrategy={currentStrategy}
|
||||||
onSelect={handleStrategyChange}
|
onSelect={handleStrategyChange}
|
||||||
savedRegexReplacements={regexReplacements}
|
savedRegexReplacements={regexReplacements}
|
||||||
onSaveRegex={handleSaveRegex}
|
onSaveRegex={handleSaveRegex}
|
||||||
|
savedSchedule={scheduleSettings}
|
||||||
|
onSaveSchedule={handleSaveSchedule}
|
||||||
syncState={syncState}
|
syncState={syncState}
|
||||||
onSync={handleSyncTrigger}
|
onSync={handleSyncTrigger}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
import React, { useState, useRef, useEffect } from 'react';
|
import React, { useState, useRef, useEffect } from 'react';
|
||||||
import { SyncStrategy, RegexReplacement, SyncState } from '../types';
|
import { SyncStrategy, RegexReplacement, SyncState, ScheduleSettings, ScheduleMode } from '../types';
|
||||||
import {
|
import {
|
||||||
ArrowRightCircle,
|
ArrowRightCircle,
|
||||||
ArrowLeftCircle,
|
ArrowLeftCircle,
|
||||||
GitMerge,
|
GitMerge,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
Check,
|
Check,
|
||||||
HelpCircle,
|
HelpCircle,
|
||||||
@@ -12,8 +11,13 @@ import {
|
|||||||
Trash2,
|
Trash2,
|
||||||
Save,
|
Save,
|
||||||
RotateCcw,
|
RotateCcw,
|
||||||
|
Zap,
|
||||||
Loader2,
|
Loader2,
|
||||||
Zap
|
Calendar,
|
||||||
|
Clock,
|
||||||
|
Repeat,
|
||||||
|
CheckSquare,
|
||||||
|
Square
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
|
||||||
interface StrategyOption {
|
interface StrategyOption {
|
||||||
@@ -55,20 +59,26 @@ const STRATEGIES: StrategyOption[] = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const WEEK_DAYS = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
|
||||||
|
|
||||||
interface StrategySelectorProps {
|
interface StrategySelectorProps {
|
||||||
currentStrategy: SyncStrategy;
|
currentStrategy: SyncStrategy;
|
||||||
onSelect: (strategy: SyncStrategy, label: string) => void;
|
onSelect: (strategy: SyncStrategy, label: string) => void;
|
||||||
savedRegexReplacements: RegexReplacement[];
|
savedRegexReplacements: RegexReplacement[];
|
||||||
onSaveRegex: (replacements: RegexReplacement[]) => void;
|
onSaveRegex: (replacements: RegexReplacement[]) => void;
|
||||||
|
savedSchedule: ScheduleSettings;
|
||||||
|
onSaveSchedule: (settings: ScheduleSettings) => Promise<boolean>;
|
||||||
syncState: SyncState;
|
syncState: SyncState;
|
||||||
onSync: () => void;
|
onSync: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StrategySelector: React.FC<StrategySelectorProps> = ({
|
const StrategySelector: React.FC<StrategySelectorProps> = ({
|
||||||
currentStrategy,
|
currentStrategy,
|
||||||
onSelect,
|
onSelect,
|
||||||
savedRegexReplacements,
|
savedRegexReplacements,
|
||||||
onSaveRegex,
|
onSaveRegex,
|
||||||
|
savedSchedule,
|
||||||
|
onSaveSchedule,
|
||||||
syncState,
|
syncState,
|
||||||
onSync
|
onSync
|
||||||
}) => {
|
}) => {
|
||||||
@@ -77,23 +87,47 @@ const StrategySelector: React.FC<StrategySelectorProps> = ({
|
|||||||
|
|
||||||
// Local state for regex editing
|
// Local state for regex editing
|
||||||
const [localReplacements, setLocalReplacements] = useState<RegexReplacement[]>([]);
|
const [localReplacements, setLocalReplacements] = useState<RegexReplacement[]>([]);
|
||||||
const [isDirty, setIsDirty] = useState(false);
|
const [isRegexDirty, setIsRegexDirty] = useState(false);
|
||||||
|
|
||||||
|
// Local state for Schedule editing
|
||||||
|
const [localSchedule, setLocalSchedule] = useState<ScheduleSettings>(savedSchedule);
|
||||||
|
const [isScheduleDirty, setIsScheduleDirty] = useState(false);
|
||||||
|
|
||||||
|
// UI State for Schedule Tabs
|
||||||
|
// We initialize active tab based on the saved mode. If DISABLED, default to CRON.
|
||||||
|
const [activeTab, setActiveTab] = useState<ScheduleMode>(
|
||||||
|
savedSchedule.mode === ScheduleMode.DISABLED ? ScheduleMode.CRON : savedSchedule.mode
|
||||||
|
);
|
||||||
|
|
||||||
const isSyncing = syncState === SyncState.SYNCING;
|
const isSyncing = syncState === SyncState.SYNCING;
|
||||||
const isLocked = isSyncing || syncState === SyncState.SUCCESS;
|
const isLocked = isSyncing || syncState === SyncState.SUCCESS;
|
||||||
|
|
||||||
// Initialize local state when prop updates (only if not dirty, or initially)
|
// Initialize local state when prop updates
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLocalReplacements(JSON.parse(JSON.stringify(savedRegexReplacements)));
|
setLocalReplacements(JSON.parse(JSON.stringify(savedRegexReplacements)));
|
||||||
setIsDirty(false);
|
setIsRegexDirty(false);
|
||||||
}, [savedRegexReplacements]);
|
}, [savedRegexReplacements]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLocalSchedule(JSON.parse(JSON.stringify(savedSchedule)));
|
||||||
|
// If the saved mode is not disabled, ensure we show that tab.
|
||||||
|
if (savedSchedule.mode !== ScheduleMode.DISABLED) {
|
||||||
|
setActiveTab(savedSchedule.mode);
|
||||||
|
}
|
||||||
|
setIsScheduleDirty(false);
|
||||||
|
}, [savedSchedule]);
|
||||||
|
|
||||||
// Check dirty state whenever local changes
|
// Check dirty state whenever local changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isDifferent = JSON.stringify(localReplacements) !== JSON.stringify(savedRegexReplacements);
|
const isDifferent = JSON.stringify(localReplacements) !== JSON.stringify(savedRegexReplacements);
|
||||||
setIsDirty(isDifferent);
|
setIsRegexDirty(isDifferent);
|
||||||
}, [localReplacements, savedRegexReplacements]);
|
}, [localReplacements, savedRegexReplacements]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const isDifferent = JSON.stringify(localSchedule) !== JSON.stringify(savedSchedule);
|
||||||
|
setIsScheduleDirty(isDifferent);
|
||||||
|
}, [localSchedule, savedSchedule]);
|
||||||
|
|
||||||
const selectedOption = STRATEGIES.find(s => s.value === currentStrategy) || STRATEGIES[0];
|
const selectedOption = STRATEGIES.find(s => s.value === currentStrategy) || STRATEGIES[0];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -111,40 +145,112 @@ const StrategySelector: React.FC<StrategySelectorProps> = ({
|
|||||||
onSelect(strategy.value, strategy.label);
|
onSelect(strategy.value, strategy.label);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Regex Handlers
|
// --- Regex Handlers ---
|
||||||
const handleAddRegex = () => {
|
const handleAddRegex = () => {
|
||||||
|
if (isLocked) return;
|
||||||
const newId = Date.now().toString();
|
const newId = Date.now().toString();
|
||||||
setLocalReplacements(prev => [...prev, { id: newId, pattern: '', replacement: '' }]);
|
setLocalReplacements(prev => [...prev, { id: newId, pattern: '', replacement: '' }]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteRegex = (id: string) => {
|
const handleDeleteRegex = (id: string) => {
|
||||||
|
if (isLocked) return;
|
||||||
setLocalReplacements(prev => prev.filter(r => r.id !== id));
|
setLocalReplacements(prev => prev.filter(r => r.id !== id));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateRegex = (id: string, field: 'pattern' | 'replacement', value: string) => {
|
const handleUpdateRegex = (id: string, field: 'pattern' | 'replacement', value: string) => {
|
||||||
|
if (isLocked) return;
|
||||||
setLocalReplacements(prev => prev.map(r =>
|
setLocalReplacements(prev => prev.map(r =>
|
||||||
r.id === id ? { ...r, [field]: value } : r
|
r.id === id ? { ...r, [field]: value } : r
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReset = () => {
|
const handleResetRegex = () => {
|
||||||
|
if (isLocked) return;
|
||||||
setLocalReplacements(JSON.parse(JSON.stringify(savedRegexReplacements)));
|
setLocalReplacements(JSON.parse(JSON.stringify(savedRegexReplacements)));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSaveRegex = () => {
|
||||||
|
if (isLocked) return;
|
||||||
const validReplacements = localReplacements.filter(r => r.pattern.trim() !== '');
|
const validReplacements = localReplacements.filter(r => r.pattern.trim() !== '');
|
||||||
setLocalReplacements(validReplacements);
|
setLocalReplacements(validReplacements);
|
||||||
onSaveRegex(validReplacements);
|
onSaveRegex(validReplacements);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// --- Schedule Handlers ---
|
||||||
|
const handleUpdateSchedule = (field: keyof ScheduleSettings, value: any) => {
|
||||||
|
if (isLocked) return;
|
||||||
|
setLocalSchedule(prev => ({ ...prev, [field]: value }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleWeekDay = (dayIndex: number) => {
|
||||||
|
if (isLocked) return;
|
||||||
|
const currentDays = localSchedule.weeklyDays;
|
||||||
|
const newDays = currentDays.includes(dayIndex)
|
||||||
|
? currentDays.filter(d => d !== dayIndex)
|
||||||
|
: [...currentDays, dayIndex].sort();
|
||||||
|
handleUpdateSchedule('weeklyDays', newDays);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleResetSchedule = () => {
|
||||||
|
if (isLocked) return;
|
||||||
|
setLocalSchedule(JSON.parse(JSON.stringify(savedSchedule)));
|
||||||
|
if (savedSchedule.mode !== ScheduleMode.DISABLED) {
|
||||||
|
setActiveTab(savedSchedule.mode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSaveScheduleClick = async () => {
|
||||||
|
if (isLocked) return;
|
||||||
|
|
||||||
|
let settingsToSave = { ...localSchedule };
|
||||||
|
|
||||||
|
// Logic to determine mode based on active Tab and checkbox state
|
||||||
|
if (activeTab === ScheduleMode.CRON) {
|
||||||
|
if (settingsToSave.cronExpression.trim() !== '') {
|
||||||
|
settingsToSave.mode = ScheduleMode.CRON;
|
||||||
|
} else {
|
||||||
|
// Empty cron -> disabled
|
||||||
|
settingsToSave.mode = ScheduleMode.DISABLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For Daily/Weekly, enforce: Save commits what is seen in the active tab.
|
||||||
|
if (activeTab !== ScheduleMode.CRON) {
|
||||||
|
// If the mode matches the active tab, it's enabled. Otherwise disabled.
|
||||||
|
if (localSchedule.mode !== activeTab) {
|
||||||
|
settingsToSave.mode = ScheduleMode.DISABLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call API
|
||||||
|
const success = await onSaveSchedule(settingsToSave);
|
||||||
|
if (success) {
|
||||||
|
setLocalSchedule(settingsToSave);
|
||||||
|
setIsScheduleDirty(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleSyncClick = () => {
|
const handleSyncClick = () => {
|
||||||
if (isLocked || isDirty) return;
|
if (isLocked) return;
|
||||||
onSync();
|
onSync();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper to toggle enable/disable for current active tab (Daily/Weekly)
|
||||||
|
const toggleScheduleEnable = (targetMode: ScheduleMode) => {
|
||||||
|
if (isLocked) return;
|
||||||
|
if (localSchedule.mode === targetMode) {
|
||||||
|
handleUpdateSchedule('mode', ScheduleMode.DISABLED);
|
||||||
|
} else {
|
||||||
|
handleUpdateSchedule('mode', targetMode);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// If syncing or locked, apply grayscale filter to content sections
|
||||||
|
const contentClass = isLocked ? "opacity-50 pointer-events-none grayscale transition-all" : "transition-all";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`relative group ${isLocked ? 'opacity-80' : ''}`} ref={dropdownRef}>
|
<div className="relative group" ref={dropdownRef}>
|
||||||
{/* Trigger Button - Added Ring to create visual 'cutout' over panels */}
|
{/* Trigger Button */}
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
className="flex items-center justify-center w-12 h-12 rounded-full bg-gray-800/90 border border-gray-600 hover:border-plex-orange text-gray-300 hover:text-white hover:bg-gray-700/80 transition-all shadow-2xl hover:shadow-plex-orange/30 ring-[6px] md:ring-8 ring-gray-900 backdrop-blur-sm active:scale-95"
|
className="flex items-center justify-center w-12 h-12 rounded-full bg-gray-800/90 border border-gray-600 hover:border-plex-orange text-gray-300 hover:text-white hover:bg-gray-700/80 transition-all shadow-2xl hover:shadow-plex-orange/30 ring-[6px] md:ring-8 ring-gray-900 backdrop-blur-sm active:scale-95"
|
||||||
@@ -156,7 +262,7 @@ const StrategySelector: React.FC<StrategySelectorProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* Dropdown Menu - Persistent Mount for State Preservation */}
|
{/* Dropdown Menu */}
|
||||||
<div
|
<div
|
||||||
className={`absolute
|
className={`absolute
|
||||||
top-14
|
top-14
|
||||||
@@ -165,159 +271,322 @@ const StrategySelector: React.FC<StrategySelectorProps> = ({
|
|||||||
/* Desktop: Center alignment */
|
/* Desktop: Center alignment */
|
||||||
md:left-1/2 md:right-auto md:origin-top md:-translate-x-1/2
|
md:left-1/2 md:right-auto md:origin-top md:-translate-x-1/2
|
||||||
|
|
||||||
w-80 md:w-[30rem] bg-gray-800/95 border border-white/10 rounded-xl shadow-2xl z-50 overflow-hidden backdrop-blur-xl
|
w-80 md:w-[32rem] bg-gray-800/95 border border-white/10 rounded-xl shadow-2xl z-50 overflow-hidden backdrop-blur-xl
|
||||||
transition-all duration-200 ease-out
|
transition-all duration-200 ease-out
|
||||||
${isOpen ? 'opacity-100 scale-100 visible translate-y-0' : 'opacity-0 scale-95 invisible pointer-events-none -translate-y-2'}`}
|
${isOpen ? 'opacity-100 scale-100 visible translate-y-0' : 'opacity-0 scale-95 invisible pointer-events-none -translate-y-2'}`}
|
||||||
>
|
>
|
||||||
{/* Section 1: Sync Strategy */}
|
<div className={`flex flex-col max-h-[75vh] md:max-h-[85vh] overflow-y-auto custom-scrollbar ${contentClass}`}>
|
||||||
<div className="px-4 py-3 bg-black/20 border-b border-white/5">
|
|
||||||
<h3 className="text-[10px] font-bold text-gray-500 uppercase tracking-widest mb-2">Sync Strategy</h3>
|
{/* Section 1: Sync Strategy */}
|
||||||
<div className="space-y-1">
|
<div className="px-4 py-3 bg-black/20 border-b border-white/5 flex-none">
|
||||||
{STRATEGIES.map((strategy) => (
|
<h3 className="text-[10px] font-bold text-gray-500 uppercase tracking-widest mb-2">Sync Strategy</h3>
|
||||||
<div
|
<div className="space-y-1">
|
||||||
key={strategy.value}
|
{STRATEGIES.map((strategy) => (
|
||||||
onClick={() => handleSelect(strategy)}
|
<div
|
||||||
className={`group flex items-center justify-between p-2 rounded-lg cursor-pointer transition-all border ${
|
key={strategy.value}
|
||||||
currentStrategy === strategy.value
|
onClick={() => handleSelect(strategy)}
|
||||||
? 'bg-white/10 border-white/10 shadow-sm'
|
className={`group flex items-center justify-between p-2 rounded-lg cursor-pointer transition-all border ${
|
||||||
: 'hover:bg-white/5 border-transparent'
|
currentStrategy === strategy.value
|
||||||
}`}
|
? 'bg-white/10 border-white/10 shadow-sm'
|
||||||
>
|
: 'hover:bg-white/5 border-transparent'
|
||||||
<div className="flex items-center space-x-3 overflow-hidden">
|
}`}
|
||||||
<strategy.icon size={18} className={strategy.color} />
|
>
|
||||||
<span className={`text-sm font-medium truncate ${currentStrategy === strategy.value ? 'text-white' : 'text-gray-300 group-hover:text-white'}`}>
|
<div className="flex items-center space-x-3 overflow-hidden">
|
||||||
{strategy.label}
|
<strategy.icon size={18} className={strategy.color} />
|
||||||
</span>
|
<span className={`text-sm font-medium truncate ${currentStrategy === strategy.value ? 'text-white' : 'text-gray-300 group-hover:text-white'}`}>
|
||||||
|
{strategy.label}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<div className="relative group/tooltip">
|
||||||
|
<HelpCircle size={14} className="text-gray-600 hover:text-gray-400 transition-colors" />
|
||||||
|
<div className="absolute right-0 bottom-full mb-2 w-48 p-2.5 bg-gray-900 text-xs text-gray-300 rounded-lg shadow-xl border border-gray-700 pointer-events-none opacity-0 group-hover/tooltip:opacity-100 transition-opacity z-50">
|
||||||
|
{strategy.description}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{currentStrategy === strategy.value && (
|
||||||
|
<Check size={14} className="text-plex-orange" strokeWidth={3} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
))}
|
||||||
<div className="flex items-center space-x-2">
|
</div>
|
||||||
<div className="relative group/tooltip">
|
|
||||||
<HelpCircle size={14} className="text-gray-600 hover:text-gray-400 transition-colors" />
|
|
||||||
<div className="absolute right-0 bottom-full mb-2 w-48 p-2.5 bg-gray-900 text-xs text-gray-300 rounded-lg shadow-xl border border-gray-700 pointer-events-none opacity-0 group-hover/tooltip:opacity-100 transition-opacity z-50">
|
|
||||||
{strategy.description}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{currentStrategy === strategy.value && (
|
|
||||||
<Check size={14} className="text-plex-orange" strokeWidth={3} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Section 2: Regex Preprocessing */}
|
|
||||||
<div className="p-4 bg-gray-900/40">
|
|
||||||
<div className="flex items-center justify-between mb-3">
|
|
||||||
<h3 className="text-[10px] font-bold text-gray-500 uppercase tracking-widest">Regex Rules</h3>
|
|
||||||
{localReplacements.length === 0 && (
|
|
||||||
<button
|
|
||||||
onClick={handleAddRegex}
|
|
||||||
className="p-1 rounded bg-gray-700/50 hover:bg-gray-600 text-gray-400 hover:text-white transition-colors"
|
|
||||||
title="Add Rule"
|
|
||||||
>
|
|
||||||
<Plus size={14} />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2 mb-4 max-h-52 overflow-y-auto pr-1 custom-scrollbar">
|
{/* Section 2: Regex Preprocessing */}
|
||||||
{localReplacements.length === 0 ? (
|
<div className="p-4 bg-gray-900/40 border-b border-white/5 flex-none">
|
||||||
<div className="text-xs text-gray-600 italic text-center py-4 border border-dashed border-gray-700/50 rounded-lg">
|
<div className="flex items-center justify-between mb-3">
|
||||||
No regex replacements configured.
|
<h3 className="text-[10px] font-bold text-gray-500 uppercase tracking-widest">Regex Rules</h3>
|
||||||
</div>
|
{localReplacements.length === 0 && (
|
||||||
) : (
|
<button
|
||||||
localReplacements.map((regex) => (
|
|
||||||
<div key={regex.id} className="flex items-center space-x-2 animate-in slide-in-from-left-2 duration-200">
|
|
||||||
<div className="flex-1 min-w-0">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Regex Pattern"
|
|
||||||
value={regex.pattern}
|
|
||||||
onChange={(e) => handleUpdateRegex(regex.id, 'pattern', e.target.value)}
|
|
||||||
disabled={isLocked}
|
|
||||||
className={`w-full bg-gray-900/80 border rounded-md px-2.5 py-1.5 text-xs text-gray-200 focus:outline-none focus:ring-1 transition-all placeholder-gray-600 disabled:opacity-60 disabled:cursor-not-allowed
|
|
||||||
${!regex.pattern && isDirty ? 'border-red-500/30 focus:border-red-500' : 'border-gray-700 focus:border-plex-orange'}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex-none text-gray-600">
|
|
||||||
<ArrowRightCircle size={12} />
|
|
||||||
</div>
|
|
||||||
<div className="flex-1 min-w-0">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder="Replacement"
|
|
||||||
value={regex.replacement}
|
|
||||||
onChange={(e) => handleUpdateRegex(regex.id, 'replacement', e.target.value)}
|
|
||||||
disabled={isLocked}
|
|
||||||
className="w-full bg-gray-900/80 border border-gray-700 rounded-md px-2.5 py-1.5 text-xs text-gray-200 focus:outline-none focus:border-plex-orange focus:ring-1 focus:ring-plex-orange transition-all placeholder-gray-600 disabled:opacity-60 disabled:cursor-not-allowed"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
onClick={() => handleDeleteRegex(regex.id)}
|
|
||||||
disabled={isLocked}
|
|
||||||
className="text-gray-600 hover:text-red-400 p-1.5 hover:bg-red-500/10 rounded transition-colors disabled:opacity-60 disabled:cursor-not-allowed"
|
|
||||||
title="Delete Rule"
|
|
||||||
>
|
|
||||||
<Trash2 size={14} />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Actions */}
|
|
||||||
<div className="space-y-3 pt-3 border-t border-white/5">
|
|
||||||
{localReplacements.length > 0 && (
|
|
||||||
<div className="flex justify-center">
|
|
||||||
<button
|
|
||||||
onClick={handleAddRegex}
|
onClick={handleAddRegex}
|
||||||
disabled={isLocked}
|
className="p-1 rounded bg-gray-700/50 hover:bg-gray-600 text-gray-400 hover:text-white transition-colors"
|
||||||
className="flex items-center space-x-1.5 text-xs text-plex-orange hover:text-yellow-400 transition-colors opacity-80 hover:opacity-100 disabled:opacity-40 disabled:cursor-not-allowed"
|
title="Add Rule"
|
||||||
>
|
>
|
||||||
<Plus size={12} />
|
<Plus size={14} />
|
||||||
<span className="font-medium">Add Rule</span>
|
</button>
|
||||||
</button>
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="grid grid-cols-2 gap-3">
|
<div className="space-y-2 mb-4 max-h-40 overflow-y-auto pr-1 custom-scrollbar">
|
||||||
<button
|
{localReplacements.length === 0 ? (
|
||||||
onClick={handleReset}
|
<div className="text-xs text-gray-600 italic text-center py-2 border border-dashed border-gray-700/50 rounded-lg">
|
||||||
disabled={!isDirty || isLocked}
|
No regex replacements configured.
|
||||||
className={`flex items-center justify-center space-x-2 py-1.5 rounded-lg text-xs font-medium border transition-all
|
</div>
|
||||||
${isDirty && !isLocked
|
) : (
|
||||||
? 'bg-gray-800 border-gray-600 text-gray-300 hover:bg-gray-700 hover:text-white'
|
localReplacements.map((regex) => (
|
||||||
: 'bg-transparent border-gray-800 text-gray-600 cursor-not-allowed'}`}
|
<div key={regex.id} className="flex items-center space-x-2 animate-in slide-in-from-left-2 duration-200">
|
||||||
>
|
<div className="flex-1 min-w-0">
|
||||||
<RotateCcw size={14} />
|
<input
|
||||||
<span>Revert</span>
|
type="text"
|
||||||
</button>
|
placeholder="Pattern"
|
||||||
<button
|
value={regex.pattern}
|
||||||
onClick={handleSave}
|
onChange={(e) => handleUpdateRegex(regex.id, 'pattern', e.target.value)}
|
||||||
disabled={!isDirty || isLocked}
|
className={`w-full bg-gray-900/80 border rounded-md px-2 py-1.5 text-xs text-gray-200 focus:outline-none focus:ring-1 transition-all placeholder-gray-600
|
||||||
className={`flex items-center justify-center space-x-2 py-1.5 rounded-lg text-xs font-bold border transition-all
|
${!regex.pattern && isRegexDirty ? 'border-red-500/30 focus:border-red-500' : 'border-gray-700 focus:border-plex-orange'}`}
|
||||||
${isDirty && !isLocked
|
/>
|
||||||
? 'bg-plex-orange border-plex-orange text-gray-900 hover:bg-yellow-500 shadow-lg shadow-plex-orange/10'
|
</div>
|
||||||
: 'bg-gray-800/50 border-gray-800 text-gray-600 cursor-not-allowed'}`}
|
<div className="flex-none text-gray-600">
|
||||||
>
|
<ArrowRightCircle size={12} />
|
||||||
<Save size={14} />
|
</div>
|
||||||
<span>Save Changes</span>
|
<div className="flex-1 min-w-0">
|
||||||
</button>
|
<input
|
||||||
</div>
|
type="text"
|
||||||
|
placeholder="Replacement"
|
||||||
|
value={regex.replacement}
|
||||||
|
onChange={(e) => handleUpdateRegex(regex.id, 'replacement', e.target.value)}
|
||||||
|
className="w-full bg-gray-900/80 border border-gray-700 rounded-md px-2 py-1.5 text-xs text-gray-200 focus:outline-none focus:border-plex-orange focus:ring-1 focus:ring-plex-orange transition-all placeholder-gray-600"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
onClick={() => handleDeleteRegex(regex.id)}
|
||||||
|
className="text-gray-600 hover:text-red-400 p-1.5 hover:bg-red-500/10 rounded transition-colors"
|
||||||
|
title="Delete Rule"
|
||||||
|
>
|
||||||
|
<Trash2 size={14} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-between items-center gap-2">
|
||||||
|
<button
|
||||||
|
onClick={handleAddRegex}
|
||||||
|
className={`flex items-center space-x-1 px-2 py-1 rounded text-[10px] font-bold uppercase tracking-wide transition-colors ${localReplacements.length > 0 ? 'text-plex-orange hover:bg-plex-orange/10' : 'hidden'}`}
|
||||||
|
>
|
||||||
|
<Plus size={10} />
|
||||||
|
<span>Add</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-2 ml-auto">
|
||||||
|
<button
|
||||||
|
onClick={handleResetRegex}
|
||||||
|
disabled={!isRegexDirty}
|
||||||
|
className={`flex items-center justify-center space-x-1.5 px-3 py-1.5 rounded-md text-xs font-medium border transition-all
|
||||||
|
${isRegexDirty
|
||||||
|
? 'bg-gray-800 border-gray-600 text-gray-300 hover:bg-gray-700 hover:text-white'
|
||||||
|
: 'bg-transparent border-transparent text-gray-700 cursor-not-allowed'}`}
|
||||||
|
>
|
||||||
|
<RotateCcw size={12} />
|
||||||
|
<span>Revert</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleSaveRegex}
|
||||||
|
disabled={!isRegexDirty}
|
||||||
|
className={`flex items-center justify-center space-x-1.5 px-3 py-1.5 rounded-md text-xs font-bold border transition-all
|
||||||
|
${isRegexDirty
|
||||||
|
? 'bg-plex-orange border-plex-orange text-gray-900 hover:bg-yellow-500 shadow-lg shadow-plex-orange/10'
|
||||||
|
: 'bg-gray-800/30 border-gray-800/50 text-gray-600 cursor-not-allowed'}`}
|
||||||
|
>
|
||||||
|
<Save size={12} />
|
||||||
|
<span>Save</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Section 3: Scheduled Tasks */}
|
||||||
|
<div className="p-4 bg-gray-900/40 border-b border-white/5 flex-none">
|
||||||
|
<div className="flex items-center justify-between mb-3">
|
||||||
|
<h3 className="text-[10px] font-bold text-gray-500 uppercase tracking-widest">Scheduled Tasks</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Tabs */}
|
||||||
|
<div className="flex space-x-1 bg-black/30 p-1 rounded-lg mb-4">
|
||||||
|
{[
|
||||||
|
{ id: ScheduleMode.CRON, label: 'Cron', icon: Repeat },
|
||||||
|
{ id: ScheduleMode.DAILY, label: 'Daily', icon: Clock },
|
||||||
|
{ id: ScheduleMode.WEEKLY, label: 'Weekly', icon: Calendar },
|
||||||
|
].map((tab) => (
|
||||||
|
<button
|
||||||
|
key={tab.id}
|
||||||
|
onClick={() => setActiveTab(tab.id)}
|
||||||
|
className={`flex-1 flex items-center justify-center space-x-2 py-1.5 rounded-md text-xs font-medium transition-all
|
||||||
|
${activeTab === tab.id
|
||||||
|
? 'bg-gray-700 text-plex-orange shadow-sm'
|
||||||
|
: 'text-gray-400 hover:text-gray-200 hover:bg-white/5'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<tab.icon size={12} />
|
||||||
|
<span>{tab.label}</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Tab Content */}
|
||||||
|
<div className="mb-4 min-h-[50px]">
|
||||||
|
{activeTab === ScheduleMode.CRON && (
|
||||||
|
<div className="space-y-2 animate-in fade-in duration-200">
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<span className="text-gray-500 font-mono text-xs">Cron:</span>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
value={localSchedule.cronExpression}
|
||||||
|
onChange={(e) => handleUpdateSchedule('cronExpression', e.target.value)}
|
||||||
|
placeholder="0 0 * * *"
|
||||||
|
className="flex-1 bg-gray-800 border border-gray-700 rounded-md px-2.5 py-1.5 text-xs text-gray-200 font-mono focus:border-plex-orange focus:outline-none focus:ring-1 focus:ring-plex-orange placeholder-gray-600"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p className="text-[10px] text-gray-500">
|
||||||
|
Unix-cron format. Leave empty to disable schedule.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{activeTab === ScheduleMode.DAILY && (
|
||||||
|
<div className="flex flex-col animate-in fade-in duration-200">
|
||||||
|
{/* Top Row: Checkbox + Label */}
|
||||||
|
<div className="flex items-center justify-start space-x-2 mb-2">
|
||||||
|
<button
|
||||||
|
onClick={() => toggleScheduleEnable(ScheduleMode.DAILY)}
|
||||||
|
className={`transition-colors flex-none ${localSchedule.mode === ScheduleMode.DAILY ? 'text-plex-orange' : 'text-gray-500 hover:text-gray-400'}`}
|
||||||
|
title={localSchedule.mode === ScheduleMode.DAILY ? "Schedule Enabled" : "Schedule Disabled"}
|
||||||
|
>
|
||||||
|
{localSchedule.mode === ScheduleMode.DAILY ? <CheckSquare size={16} /> : <Square size={16} />}
|
||||||
|
</button>
|
||||||
|
<label className="text-xs text-gray-400 font-medium">Run daily at:</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Bottom Row: Centered Native Time Input */}
|
||||||
|
<div className="flex justify-center mt-2">
|
||||||
|
<input
|
||||||
|
type="time"
|
||||||
|
value={localSchedule.dailyTime}
|
||||||
|
onChange={(e) => handleUpdateSchedule('dailyTime', e.target.value)}
|
||||||
|
disabled={localSchedule.mode !== ScheduleMode.DAILY}
|
||||||
|
className={`bg-gray-800 border border-gray-700 text-white rounded-md px-4 py-2 text-xl font-mono focus:border-plex-orange focus:ring-1 focus:ring-plex-orange focus:outline-none transition-all ${localSchedule.mode !== ScheduleMode.DAILY ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{activeTab === ScheduleMode.WEEKLY && (
|
||||||
|
<div className="flex flex-col animate-in fade-in duration-200">
|
||||||
|
{/* Top Row: Checkbox + Label */}
|
||||||
|
<div className="flex items-center justify-start space-x-2 mb-2">
|
||||||
|
<button
|
||||||
|
onClick={() => toggleScheduleEnable(ScheduleMode.WEEKLY)}
|
||||||
|
className={`transition-colors flex-none ${localSchedule.mode === ScheduleMode.WEEKLY ? 'text-plex-orange' : 'text-gray-500 hover:text-gray-400'}`}
|
||||||
|
title={localSchedule.mode === ScheduleMode.WEEKLY ? "Schedule Enabled" : "Schedule Disabled"}
|
||||||
|
>
|
||||||
|
{localSchedule.mode === ScheduleMode.WEEKLY ? <CheckSquare size={16} /> : <Square size={16} />}
|
||||||
|
</button>
|
||||||
|
<label className="text-xs text-gray-400 font-medium">Run on days:</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Middle Row: Full Width Capsules */}
|
||||||
|
<div className={`grid grid-cols-7 w-full transition-opacity duration-200 mb-3 ${localSchedule.mode !== ScheduleMode.WEEKLY ? 'opacity-50 pointer-events-none' : ''}`}>
|
||||||
|
{WEEK_DAYS.map((day, index) => {
|
||||||
|
const isSelected = localSchedule.weeklyDays.includes(index);
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={index}
|
||||||
|
onClick={() => toggleWeekDay(index)}
|
||||||
|
className={`h-9 text-xs font-bold border-y border-l last:border-r border-gray-600/50 transition-colors
|
||||||
|
first:rounded-l-lg last:rounded-r-lg
|
||||||
|
${isSelected
|
||||||
|
? 'bg-plex-orange text-gray-900 border-plex-orange z-10'
|
||||||
|
: 'bg-gray-800 text-gray-400 hover:bg-gray-700 hover:text-gray-200'
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
>
|
||||||
|
{day}
|
||||||
|
</button>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Bottom Row: Centered Native Time Input */}
|
||||||
|
<div className="flex justify-center mt-1">
|
||||||
|
<input
|
||||||
|
type="time"
|
||||||
|
value={localSchedule.weeklyTime}
|
||||||
|
onChange={(e) => handleUpdateSchedule('weeklyTime', e.target.value)}
|
||||||
|
disabled={localSchedule.mode !== ScheduleMode.WEEKLY}
|
||||||
|
className={`bg-gray-800 border border-gray-700 text-white rounded-md px-4 py-2 text-xl font-mono focus:border-plex-orange focus:ring-1 focus:ring-plex-orange focus:outline-none transition-all ${localSchedule.mode !== ScheduleMode.WEEKLY ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Auto Watch Checkbox */}
|
||||||
|
<div className="flex items-center mb-4 px-1">
|
||||||
|
<button
|
||||||
|
onClick={() => handleUpdateSchedule('autoWatch', !localSchedule.autoWatch)}
|
||||||
|
className="flex items-center space-x-2 group"
|
||||||
|
>
|
||||||
|
{localSchedule.autoWatch ? (
|
||||||
|
<CheckSquare size={16} className="text-plex-orange" />
|
||||||
|
) : (
|
||||||
|
<Square size={16} className="text-gray-600 group-hover:text-gray-400" />
|
||||||
|
)}
|
||||||
|
<span className={`text-xs ${localSchedule.autoWatch ? 'text-gray-200' : 'text-gray-500 group-hover:text-gray-400'}`}>
|
||||||
|
Watch for local playlist changes
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Action Buttons (Mirrored from Regex) */}
|
||||||
|
<div className="flex items-center gap-2 justify-end pt-3 border-t border-white/5">
|
||||||
|
<button
|
||||||
|
onClick={handleResetSchedule}
|
||||||
|
disabled={!isScheduleDirty}
|
||||||
|
className={`flex items-center justify-center space-x-1.5 px-3 py-1.5 rounded-md text-xs font-medium border transition-all
|
||||||
|
${isScheduleDirty
|
||||||
|
? 'bg-gray-800 border-gray-600 text-gray-300 hover:bg-gray-700 hover:text-white'
|
||||||
|
: 'bg-transparent border-transparent text-gray-700 cursor-not-allowed'}`}
|
||||||
|
>
|
||||||
|
<RotateCcw size={12} />
|
||||||
|
<span>Revert</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
onClick={handleSaveScheduleClick}
|
||||||
|
disabled={!isScheduleDirty}
|
||||||
|
className={`flex items-center justify-center space-x-1.5 px-3 py-1.5 rounded-md text-xs font-bold border transition-all
|
||||||
|
${isScheduleDirty
|
||||||
|
? 'bg-plex-orange border-plex-orange text-gray-900 hover:bg-yellow-500 shadow-lg shadow-plex-orange/10'
|
||||||
|
: 'bg-gray-800/30 border-gray-800/50 text-gray-600 cursor-not-allowed'}`}
|
||||||
|
>
|
||||||
|
<Save size={12} />
|
||||||
|
<span>Save</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Section 3: Sync Now Button */}
|
{/* Section 4: Sync Now Button */}
|
||||||
<div className="p-4 bg-gray-950/50 border-t border-white/5">
|
<div className="p-4 bg-gray-950/50 border-t border-white/5 flex-none">
|
||||||
<button
|
<button
|
||||||
onClick={handleSyncClick}
|
onClick={handleSyncClick}
|
||||||
disabled={isLocked || isDirty}
|
disabled={isLocked}
|
||||||
className={`w-full py-3 rounded-lg text-sm font-bold flex items-center justify-center gap-2 transition-all shadow-lg
|
className={`w-full py-3 rounded-lg text-sm font-bold flex items-center justify-center gap-2 transition-all shadow-lg
|
||||||
${isLocked
|
${isLocked
|
||||||
? 'bg-gray-700/30 text-gray-500 cursor-not-allowed border border-gray-700/50'
|
? 'bg-gray-700/30 text-gray-500 cursor-not-allowed border border-gray-700/50'
|
||||||
: isDirty
|
: isRegexDirty
|
||||||
? 'bg-gray-800 text-gray-500 cursor-not-allowed border border-gray-700'
|
? 'bg-gray-800 text-gray-500 cursor-not-allowed border border-gray-700'
|
||||||
: 'bg-green-600 hover:bg-green-500 text-white border border-green-500 shadow-green-900/20 active:scale-[0.98]'
|
: 'bg-green-600 hover:bg-green-500 text-white border border-green-500 shadow-green-900/20 active:scale-[0.98]'
|
||||||
}`}
|
}`}
|
||||||
@@ -334,9 +603,9 @@ const StrategySelector: React.FC<StrategySelectorProps> = ({
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
{isDirty && (
|
{(isRegexDirty) && (
|
||||||
<p className="text-[10px] text-plex-orange text-center mt-2">
|
<p className="text-[10px] text-plex-orange text-center mt-2">
|
||||||
Please save or revert regex rules changes before syncing.
|
Please save regex changes before syncing.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -345,4 +614,4 @@ const StrategySelector: React.FC<StrategySelectorProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default StrategySelector;
|
export default StrategySelector;
|
||||||
@@ -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 || '';
|
const API_BASE = import.meta.env.VITE_API_BASE_URL || '';
|
||||||
|
|
||||||
@@ -97,6 +97,20 @@ export const apiService = {
|
|||||||
return handleResponse(response);
|
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[]>> {
|
async getPlaylists(serverType: ServerType, signal?: AbortSignal, localPath?: string): Promise<ApiResponse<Playlist[]>> {
|
||||||
const params = new URLSearchParams({ server: serverType.toLowerCase() });
|
const params = new URLSearchParams({ server: serverType.toLowerCase() });
|
||||||
if (serverType === ServerType.LOCAL && localPath) {
|
if (serverType === ServerType.LOCAL && localPath) {
|
||||||
|
|||||||
@@ -40,6 +40,22 @@ export interface RegexReplacement {
|
|||||||
replacement: string;
|
replacement: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ScheduleMode {
|
||||||
|
DISABLED = 'DISABLED',
|
||||||
|
CRON = 'CRON',
|
||||||
|
DAILY = 'DAILY',
|
||||||
|
WEEKLY = 'WEEKLY'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScheduleSettings {
|
||||||
|
mode: ScheduleMode;
|
||||||
|
cronExpression: string;
|
||||||
|
dailyTime: string;
|
||||||
|
weeklyDays: number[]; // 0 = Sunday, 1 = Monday, etc.
|
||||||
|
weeklyTime: string;
|
||||||
|
autoWatch: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface PlexLibrary {
|
export interface PlexLibrary {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ jinja2
|
|||||||
python-multipart
|
python-multipart
|
||||||
plexapi
|
plexapi
|
||||||
merge3
|
merge3
|
||||||
|
apscheduler
|
||||||
|
|||||||
Reference in New Issue
Block a user