Exemplo n.º 1
0
        private M3UChannel GetChannelnfo(string extInf, string tunerHostId)
        {
            var titleIndex = extInf.LastIndexOf(',');
            var channel    = new M3UChannel();

            channel.TunerHostId = tunerHostId;

            channel.Number = extInf.Trim().Split(' ')[0] ?? "0";
            channel.Name   = extInf.Substring(titleIndex + 1);

            if (channel.Number == "-1")
            {
                channel.Number = "0";
            }

            //Check for channel number with the format from SatIp
            int number;
            var numberIndex = channel.Name.IndexOf('.');

            if (numberIndex > 0)
            {
                if (int.TryParse(channel.Name.Substring(0, numberIndex), out number))
                {
                    channel.Number = number.ToString();
                    channel.Name   = channel.Name.Substring(numberIndex + 1);
                }
            }
            channel.ImageUrl = FindProperty("tvg-logo", extInf, null);
            channel.Number   = FindProperty("tvg-id", extInf, channel.Number);
            channel.Number   = FindProperty("channel-id", extInf, channel.Number);
            channel.Name     = FindProperty("tvg-name", extInf, channel.Name);
            channel.Name     = FindProperty("tvg-id", extInf, channel.Name);
            return(channel);
        }
Exemplo n.º 2
0
        private M3UChannel GetChannelnfo(string extInf, string tunerHostId)
        {
            var titleIndex = extInf.LastIndexOf(',');
            var channel = new M3UChannel();
            channel.TunerHostId = tunerHostId;

            channel.Number = extInf.Trim().Split(' ')[0] ?? "0";
            channel.Name = extInf.Substring(titleIndex + 1);
            
            if(channel.Number == "-1") { channel.Number = "0"; }         

            //Check for channel number with the format from SatIp            
            int number;                   
            var numberIndex = channel.Name.IndexOf('.');
            if (numberIndex > 0)
            {
                if (int.TryParse(channel.Name.Substring(0, numberIndex), out number))
                {
                    channel.Number = number.ToString();
                    channel.Name = channel.Name.Substring(numberIndex + 1);
                }
            }
            channel.ImageUrl = FindProperty("tvg-logo", extInf, null);
            channel.Number = FindProperty("tvg-id", extInf, channel.Number);
            channel.Number = FindProperty("channel-id", extInf, channel.Number);
            channel.Name = FindProperty("tvg-name", extInf, channel.Name);
            channel.Name = FindProperty("tvg-id", extInf, channel.Name);
            return channel;

        }
Exemplo n.º 3
0
        private M3UChannel GetChannelnfo(string extInf, string tunerHostId, string mediaUrl)
        {
            var titleIndex = extInf.LastIndexOf(',');
            var channel    = new M3UChannel();

            channel.TunerHostId = tunerHostId;

            channel.Number = extInf.Trim().Split(' ')[0] ?? "0";
            channel.Name   = extInf.Substring(titleIndex + 1);

            //Check for channel number with the format from SatIp
            int number;
            var numberIndex = channel.Name.IndexOf('.');

            if (numberIndex > 0)
            {
                if (int.TryParse(channel.Name.Substring(0, numberIndex), out number))
                {
                    channel.Number = number.ToString();
                    channel.Name   = channel.Name.Substring(numberIndex + 1);
                }
            }

            if (string.Equals(channel.Number, "-1", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(mediaUrl))
            {
                channel.Number = Path.GetFileNameWithoutExtension(mediaUrl.Split('/').Last());
            }

            if (string.Equals(channel.Number, "-1", StringComparison.OrdinalIgnoreCase))
            {
                channel.Number = "0";
            }

            channel.ImageUrl = FindProperty("tvg-logo", extInf);

            var name = FindProperty("tvg-name", extInf);

            if (string.IsNullOrWhiteSpace(name))
            {
                name = FindProperty("tvg-id", extInf);
            }

            channel.Name = name;

            var numberString = FindProperty("tvg-id", extInf);

            if (string.IsNullOrWhiteSpace(numberString))
            {
                numberString = FindProperty("channel-id", extInf);
            }

            if (!string.IsNullOrWhiteSpace(numberString))
            {
                channel.Number = numberString;
            }

            return(channel);
        }
Exemplo n.º 4
0
        private M3UChannel GetChannelnfo(string extInf, string tunerHostId, string mediaUrl)
        {
            var titleIndex = extInf.LastIndexOf(',');
            var channel = new M3UChannel();
            channel.TunerHostId = tunerHostId;

            channel.Number = extInf.Trim().Split(' ')[0] ?? "0";
            channel.Name = extInf.Substring(titleIndex + 1);

            //Check for channel number with the format from SatIp            
            int number;                   
            var numberIndex = channel.Name.IndexOf('.');
            if (numberIndex > 0)
            {
                if (int.TryParse(channel.Name.Substring(0, numberIndex), out number))
                {
                    channel.Number = number.ToString();
                    channel.Name = channel.Name.Substring(numberIndex + 1);
                }
            }

            if (string.Equals(channel.Number, "-1", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(mediaUrl))
            {
                channel.Number = Path.GetFileNameWithoutExtension(mediaUrl.Split('/').Last());
            }

            if (string.Equals(channel.Number, "-1", StringComparison.OrdinalIgnoreCase))
            {
                channel.Number = "0";
            }

            channel.ImageUrl = FindProperty("tvg-logo", extInf);

            var name = FindProperty("tvg-name", extInf);
            if (string.IsNullOrWhiteSpace(name))
            {
                 name = FindProperty("tvg-id", extInf);
            }

            channel.Name = name;

            var numberString = FindProperty("tvg-id", extInf);
            if (string.IsNullOrWhiteSpace(numberString))
            {
                numberString = FindProperty("channel-id", extInf);
            }

            if (!string.IsNullOrWhiteSpace(numberString))
            {
                channel.Number = numberString;
            }

            return channel;

        }