From 8bf75293fbc55a6ec0ff097a0f2723f791aea989 Mon Sep 17 00:00:00 2001 From: dekzter Date: Fri, 11 Apr 2025 17:18:32 -0400 Subject: [PATCH] disabled refresh button on inactive items, don't process them in inactive --- apps/epg/tasks.py | 4 ++++ apps/m3u/tasks.py | 4 ++++ frontend/src/components/tables/EPGsTable.jsx | 1 + frontend/src/components/tables/M3UsTable.jsx | 1 + 4 files changed, 10 insertions(+) diff --git a/apps/epg/tasks.py b/apps/epg/tasks.py index 33e981a6..9bfce9fe 100644 --- a/apps/epg/tasks.py +++ b/apps/epg/tasks.py @@ -42,6 +42,10 @@ def refresh_epg_data(source_id): return source = EPGSource.objects.get(id=source_id) + if not source.is_active: + logger.info(f"EPG source {source_id} is not active. Skipping.") + return + logger.info(f"Processing EPGSource: {source.name} (type: {source.source_type})") if source.source_type == 'xmltv': fetch_xmltv(source) diff --git a/apps/m3u/tasks.py b/apps/m3u/tasks.py index 3529e1ef..5db25e2a 100644 --- a/apps/m3u/tasks.py +++ b/apps/m3u/tasks.py @@ -383,6 +383,10 @@ def refresh_single_m3u_account(account_id): try: account = M3UAccount.objects.get(id=account_id, is_active=True) + if not account.is_active: + logger.info(f"Account {account_id} is not active, skipping.") + return + filters = list(account.filters.all()) except M3UAccount.DoesNotExist: release_task_lock('refresh_single_m3u_account', account_id) diff --git a/frontend/src/components/tables/EPGsTable.jsx b/frontend/src/components/tables/EPGsTable.jsx index 85584fca..9da2b114 100644 --- a/frontend/src/components/tables/EPGsTable.jsx +++ b/frontend/src/components/tables/EPGsTable.jsx @@ -167,6 +167,7 @@ const EPGsTable = () => { size="sm" // Makes the button smaller color="blue.5" // Red color for delete actions onClick={() => refreshEPG(row.original.id)} + disabled={!row.original.is_active} > {/* Small icon size */} diff --git a/frontend/src/components/tables/M3UsTable.jsx b/frontend/src/components/tables/M3UsTable.jsx index 08ec142e..0fccfc82 100644 --- a/frontend/src/components/tables/M3UsTable.jsx +++ b/frontend/src/components/tables/M3UsTable.jsx @@ -263,6 +263,7 @@ const M3UTable = () => { size="sm" color="blue.5" onClick={() => refreshPlaylist(row.original.id)} + disabled={!row.original.is_active} >