@hjd I'd like to create some OliveTin Actions to add (or remove) channels in bulk to PrismCast. I've done this for ADBTuner, and this works quite well as there's a "Provider" field for each virtual channel. This allows me to use the ADBTuner API to update/replace channels in provider groups.
Great questions and request: PrismCast already has the building blocks for this workflow. You don't need a Provider field or any schema changes. The prefix approach you suggested (fruit-01, sling-stzhd, etc.) works with the existing channel key system today, and the APIs support the bulk operations you're looking for. If you look at the API reference tab in the PrismCast webUI, you can find the complete list there.
Here's how your OliveTin actions might work:
Adding/Updating a Provider's Channels
The M3U import endpoint handles this cleanly. Generate an M3U with your provider's channels using prefixed keys, then POST it:
curl -X POST http://localhost:5589/config/channels/import-m3u \
-d "conflictMode=replace" \
--data-urlencode "[email protected]"
Where sling-channels.m3u looks like:
#EXTM3U
#EXTINF:-1 channel-id="sling-stzhd",Sling - Stadium
https://watch.sling.com/channel/stadium
#EXTINF:-1 channel-id="sling-espn",Sling - ESPN
https://watch.sling.com/channel/espn
With conflictMode=replace, existing channels with matching keys get updated, new ones get added, and everything else is left untouched. Import 200 Sling channels at once? No problem.
You can also use JSON import if you prefer more control over channel fields:
curl -X POST http://localhost:5589/config/channels/import \
-H "Content-Type: application/json" \
-d @sling-channels.json
Where the JSON follows the standard channel format:
{
"sling-stzhd": { "name": "Sling - Stadium", "url": "https://watch.sling.com/channel/stadium" },
"sling-espn": { "name": "Sling - ESPN", "url": "https://watch.sling.com/channel/espn" }
}
One caveat: the JSON import endpoint replaces all user channels, not just the ones in the payload. For a merge-style workflow, the M3U import is the better fit.
Removing a Provider's Channels
This is where it gets a bit less elegant, but it's still straightforward. Since your OliveTin action knows which keys it created, you can loop the individual delete endpoint:
for key in sling-stzhd sling-espn sling-tbs; do
curl -X POST http://localhost:5589/config/channels \
-d "action=delete&key=$key"
done
Or if you're generating the key list dynamically:
curl -s http://localhost:5589/config/channels/export | \
jq -r 'keys[] | select(startswith("sling-"))' | \
while read key; do
curl -X POST http://localhost:5589/config/channels \
-d "action=delete&key=$key"
done
As to "why not just add a DELETE /config/channels?prefix=sling- endpoint?" I'm intentionally not adding that right now. A single API call that deletes dozens of channels based on a pattern match is one typo away from a very bad day. The current approach - where each deletion is explicit - acts as a natural guardrail. If your OliveTin action has a bug in its prefix logic, you lose one channel per iteration instead of everything matching s*. I'd rather the bulk delete workflow be a few extra HTTP calls than shooting yourself in the foot. For now.
If this turns out to be a real friction point in practice, I'm open to revisiting it - maybe with a dry-run mode or a confirmation step. But let's see how the current APIs work for you first. This project is in its infancy still...so keep bringing the use cases forward. It's been a fun side project.
Also, a wide mode generally in the WebUI would be great as well -- so values aren't truncated in the columns when there's potentially plenty of display space available to show more
Fair point about column truncation. I'll take a look at improving how the channel table handles wider displays.