This commit is contained in:
SergeantPanda 2025-04-11 16:19:59 -05:00
commit e253903f34
6 changed files with 52 additions and 4 deletions

View file

@ -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)

View file

@ -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)

View file

@ -712,6 +712,7 @@ export default class API {
if (!payload.url) {
delete payload.url;
}
body = payload;
}
const response = await request(`${host}/api/epg/sources/${id}/`, {

View file

@ -13,6 +13,7 @@ import {
Button,
Flex,
useMantineTheme,
Switch,
} from '@mantine/core';
import { notifications } from '@mantine/notifications';
import { IconSquarePlus } from '@tabler/icons-react';
@ -25,10 +26,16 @@ const EPGsTable = () => {
const [rowSelection, setRowSelection] = useState([]);
const { epgs } = useEPGsStore();
console.log(epgs);
const theme = useMantineTheme();
const toggleActive = async (epg) => {
await API.updateEPG({
...epg,
is_active: !epg.is_active,
});
};
const columns = useMemo(
//column definitions...
() => [
@ -45,6 +52,24 @@ const EPGsTable = () => {
accessorKey: 'url',
enableSorting: false,
},
{
header: 'Active',
accessorKey: 'is_active',
size: 100,
sortingFn: 'basic',
mantineTableBodyCellProps: {
align: 'left',
},
Cell: ({ row, cell }) => (
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
<Switch
size="xs"
checked={cell.getValue()}
onChange={() => toggleActive(row.original)}
/>
</Box>
),
},
{
header: 'Updated',
accessorFn: (row) => dayjs(row.updated_at).format('MMMM D, YYYY h:mma'),
@ -142,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}
>
<RefreshCcw size="18" /> {/* Small icon size */}
</ActionIcon>

View file

@ -13,6 +13,7 @@ import {
Box,
ActionIcon,
Tooltip,
Switch,
} from '@mantine/core';
import { SquareMinus, SquarePen, RefreshCcw, Check, X } from 'lucide-react';
import { IconSquarePlus } from '@tabler/icons-react'; // Import custom icons
@ -84,6 +85,13 @@ const M3UTable = () => {
return `Parsing: ${data.progress}%`;
};
const toggleActive = async (playlist) => {
await API.updatePlaylist({
...playlist,
is_active: !playlist.is_active,
});
};
const columns = useMemo(
//column definitions...
() => [
@ -133,9 +141,13 @@ const M3UTable = () => {
mantineTableBodyCellProps: {
align: 'left',
},
Cell: ({ cell }) => (
Cell: ({ row, cell }) => (
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
{cell.getValue() ? <Check color="green" /> : <X color="red" />}
<Switch
size="xs"
checked={cell.getValue()}
onChange={() => toggleActive(row.original)}
/>
</Box>
),
},
@ -251,6 +263,7 @@ const M3UTable = () => {
size="sm"
color="blue.5"
onClick={() => refreshPlaylist(row.original.id)}
disabled={!row.original.is_active}
>
<RefreshCcw size="18" />
</ActionIcon>

View file

@ -2,4 +2,4 @@
Dispatcharr version information.
"""
__version__ = '0.1.0' # Follow semantic versioning (MAJOR.MINOR.PATCH)
__build__ = '23' # Auto-incremented on builds
__build__ = '24' # Auto-incremented on builds