SatIndex grabber now working.
2 using System.Collections.Generic;
3 using System.ComponentModel;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
11 using System.Diagnostics;
18 public struct ProgressReport
20 public int Max { get; set; }
21 public int Value { get; set; }
24 public partial class MainForm : Form, IProgress<ProgressReport>
28 InitializeComponent();
31 private void buttonGenerate_Click(object sender, EventArgs e)
33 List<Channel> channels = new List<Channel>();
34 channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-skygermany.php", "19.2°E", true));
35 channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-hdplus.php", "19.2°E", true));
36 channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-arddigital.php", "19.2°E", true));
37 channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-zdfvision.php", "19.2°E", true));
38 channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-tntsat.php", "19.2°E", true, "TNTSAT"));
40 //Discard non HD channels we don't need
41 channels = KingOfSat.CleanChannelList(channels);
43 //Declare tuner cards so that we don't need to create mapping manually after import
44 List<string> tuners = new List<string>(){"3","4"};
46 //Export to XML for MediaPortal to import
47 MediaPortal.Export(channels, tuners, "channels.xml", false);
53 /// <param name="sender"></param>
54 /// <param name="e"></param>
55 private async void iButtonSatIndex_Click(object sender, EventArgs e)
57 await Task.Run(() => FetchSatIndexChannels());
63 private void FetchSatIndexChannels()
65 List<Channel> channels = new List<Channel>();
67 channels.AddRange(SatIndex.Parse(this, channels, "http://www.satindex.de/tv/1/1/", "19.2°E", true));
68 //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-hdplus.php", "19.2°E", true));
69 //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-arddigital.php", "19.2°E", true));
70 //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-zdfvision.php", "19.2°E", true));
71 //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-tntsat.php", "19.2°E", true, "TNTSAT"));
73 //Discard non HD channels we don't need
74 channels = SatIndex.CleanChannelList(channels);
76 //Declare tuner cards so that we don't need to create mapping manually after import
77 List<string> tuners = new List<string>() { "3", "4" };
79 //Export to XML for MediaPortal to import
80 MediaPortal.Export(channels, tuners, "channels.xml", false);
87 /// <param name="aProgress"></param>
88 public void Report(ProgressReport aProgress)
90 MethodInvoker methodInvokerDelegate = delegate ()
92 toolStripProgressBar.Maximum = aProgress.Max;
93 toolStripProgressBar.Value = aProgress.Value;
94 toolStripStatusLabel.Text = aProgress.Value + " / " + aProgress.Max;
97 //This will be true if Current thread is not UI thread.
100 Invoke(methodInvokerDelegate);
104 methodInvokerDelegate();