StephaneLenclud@0: using System; StephaneLenclud@0: using System.Collections.Generic; StephaneLenclud@0: using System.ComponentModel; StephaneLenclud@0: using System.Data; StephaneLenclud@0: using System.Drawing; StephaneLenclud@0: using System.Linq; StephaneLenclud@0: using System.Text; StephaneLenclud@0: using System.Threading.Tasks; StephaneLenclud@0: using System.Windows.Forms; StephaneLenclud@0: using CsQuery; StephaneLenclud@0: using System.Diagnostics; StephaneLenclud@0: using System.Net; StephaneLenclud@0: StephaneLenclud@0: StephaneLenclud@0: StephaneLenclud@0: namespace SatChanGen StephaneLenclud@0: { StephaneLenclud@9: public struct ProgressReport StephaneLenclud@9: { StephaneLenclud@9: public int Max { get; set; } StephaneLenclud@9: public int Value { get; set; } StephaneLenclud@9: } StephaneLenclud@9: StephaneLenclud@9: public partial class MainForm : Form, IProgress StephaneLenclud@0: { StephaneLenclud@0: public MainForm() StephaneLenclud@0: { StephaneLenclud@0: InitializeComponent(); StephaneLenclud@0: } StephaneLenclud@0: StephaneLenclud@0: private void buttonGenerate_Click(object sender, EventArgs e) StephaneLenclud@0: { StephaneLenclud@5: List channels = new List(); StephaneLenclud@7: channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-skygermany.php", "19.2°E", true)); StephaneLenclud@7: channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-hdplus.php", "19.2°E", true)); StephaneLenclud@7: channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-arddigital.php", "19.2°E", true)); StephaneLenclud@7: channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-zdfvision.php", "19.2°E", true)); StephaneLenclud@7: channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-tntsat.php", "19.2°E", true, "TNTSAT")); StephaneLenclud@5: StephaneLenclud@5: //Discard non HD channels we don't need StephaneLenclud@5: channels = KingOfSat.CleanChannelList(channels); StephaneLenclud@4: StephaneLenclud@5: //Declare tuner cards so that we don't need to create mapping manually after import StephaneLenclud@5: List tuners = new List(){"3","4"}; StephaneLenclud@4: StephaneLenclud@5: //Export to XML for MediaPortal to import StephaneLenclud@5: MediaPortal.Export(channels, tuners, "channels.xml", false); StephaneLenclud@0: } StephaneLenclud@9: StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: private async void iButtonSatIndex_Click(object sender, EventArgs e) StephaneLenclud@9: { StephaneLenclud@9: await Task.Run(() => FetchSatIndexChannels()); StephaneLenclud@9: } StephaneLenclud@9: StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: private void FetchSatIndexChannels() StephaneLenclud@9: { StephaneLenclud@9: List channels = new List(); StephaneLenclud@9: StephaneLenclud@9: channels.AddRange(SatIndex.Parse(this, channels, "http://www.satindex.de/tv/1/1/", "19.2°E", true)); StephaneLenclud@9: //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-hdplus.php", "19.2°E", true)); StephaneLenclud@9: //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-arddigital.php", "19.2°E", true)); StephaneLenclud@9: //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-zdfvision.php", "19.2°E", true)); StephaneLenclud@9: //channels.AddRange(KingOfSat.Parse(channels, "http://en.kingofsat.net/pack-tntsat.php", "19.2°E", true, "TNTSAT")); StephaneLenclud@9: StephaneLenclud@9: //Discard non HD channels we don't need StephaneLenclud@9: channels = SatIndex.CleanChannelList(channels); StephaneLenclud@9: StephaneLenclud@9: //Declare tuner cards so that we don't need to create mapping manually after import StephaneLenclud@9: List tuners = new List() { "3", "4" }; StephaneLenclud@9: StephaneLenclud@9: //Export to XML for MediaPortal to import StephaneLenclud@9: MediaPortal.Export(channels, tuners, "channels.xml", false); StephaneLenclud@9: StephaneLenclud@9: } StephaneLenclud@9: StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: /// StephaneLenclud@9: public void Report(ProgressReport aProgress) StephaneLenclud@9: { StephaneLenclud@9: MethodInvoker methodInvokerDelegate = delegate () StephaneLenclud@9: { StephaneLenclud@9: toolStripProgressBar.Maximum = aProgress.Max; StephaneLenclud@9: toolStripProgressBar.Value = aProgress.Value; StephaneLenclud@9: toolStripStatusLabel.Text = aProgress.Value + " / " + aProgress.Max; StephaneLenclud@9: }; StephaneLenclud@9: StephaneLenclud@9: //This will be true if Current thread is not UI thread. StephaneLenclud@9: if (InvokeRequired) StephaneLenclud@9: { StephaneLenclud@9: Invoke(methodInvokerDelegate); StephaneLenclud@9: } StephaneLenclud@9: else StephaneLenclud@9: { StephaneLenclud@9: methodInvokerDelegate(); StephaneLenclud@9: } StephaneLenclud@9: StephaneLenclud@9: } StephaneLenclud@9: StephaneLenclud@9: StephaneLenclud@9: StephaneLenclud@0: } StephaneLenclud@0: }