feat(epg): order EPG sources by priority (#24)

Add persistent EPG priority ordering, source reorder validation, and priority-aware EPG matching for live channels.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-06 11:58:50 +02:00
parent 9718155e75
commit afe91089e5
8 changed files with 254 additions and 8 deletions

View File

@ -47,6 +47,20 @@ router.get('/type/:type', async (req, res) => {
}
});
router.put('/epg/order', async (req, res) => {
try {
const ordered = await sources.reorderEpg(req.body?.orderedIds);
res.json(ordered.map(source => ({
...source,
password: source.password ? '••••••••' : null
})));
} catch (err) {
if (err.code) return res.status(400).json({ error: err.message, code: err.code });
console.error('Error reordering EPG sources:', err);
res.status(500).json({ error: 'Failed to reorder EPG sources' });
}
});
// Get single source
router.get('/:id', async (req, res) => {
try {