Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
624 B

using System.Globalization;
namespace ErsatzTV.Core.Iptv;
public static class ChannelIdentifier
{
public static string LegacyFromNumber(string channelNumber)
{
return $"{channelNumber}.etv";
}
public static string FromNumber(string channelNumber)
{
// get rid of any decimal (only two are allowed)
int number = (int)(decimal.Parse(channelNumber, CultureInfo.InvariantCulture) * 100);
int id = 0;
while (number != 0)
{
id += number % 10 + 48;
number /= 10;
}
return $"C{channelNumber}.{id}.ersatztv.org";
}
}