* fix validation in new form layout * pin mediatr to last oss version * update dependencies * cleanup code in core * cleanup code in ffmpeg * cleanup code in infra * cleanup code in scanner * cleanup code in application * cleanup main code * cleanup test code * solution-wide code cleanup
23 lines
600 B
C#
23 lines
600 B
C#
using System.Globalization;
|
|
|
|
namespace ErsatzTV.Core.Iptv;
|
|
|
|
public static class ChannelIdentifier
|
|
{
|
|
public static string LegacyFromNumber(string channelNumber) => $"{channelNumber}.etv";
|
|
|
|
public static string FromNumber(string channelNumber)
|
|
{
|
|
// get rid of any decimal (only two are allowed)
|
|
var number = (int)(decimal.Parse(channelNumber, CultureInfo.InvariantCulture) * 100);
|
|
var id = 0;
|
|
while (number != 0)
|
|
{
|
|
id += number % 10 + 48;
|
|
number /= 10;
|
|
}
|
|
|
|
return $"C{channelNumber}.{id}.ersatztv.org";
|
|
}
|
|
}
|