private void Ok() { string lastList = config.AppSettings.Settings["Url"].Value; if (lastList != txtURL.Text) { config.AppSettings.Settings["Url"].Value = txtURL.Text; Channels channels = Channels.Get(); channels.SetUrl(txtURL.Text); channels.SetNeedRefresh(true); ConfigurationManager.RefreshSection("appSettings"); } string lastEPG = config.AppSettings.Settings["Epg"].Value; if (lastEPG != txtEPG.Text) { config.AppSettings.Settings["Epg"].Value = txtEPG.Text; EPG_DB epgDB = EPG_DB.Get(); epgDB.Refresh = true; ConfigurationManager.RefreshSection("appSettings"); } config.AppSettings.Settings["audio"].Value = Utils.GetAudioConfName(audio.SelectedItem.ToString()); config.AppSettings.Settings["sub"].Value = Utils.GetSubConfName(sub.SelectedItem.ToString()); config.Save(ConfigurationSaveMode.Modified); this.Close(); this.Dispose(); }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { Preferences pref = new Preferences(); pref.ShowDialog(); Channels channels = Channels.Get(); if (channels.NeedRefresh()) { loadingPanel.Visible = true; loadingPanel.Size = new Size(799, 516); loadingPanel.BringToFront(); new System.Threading.Thread(delegate() { channels.RefreshList(); fillChannelList(); loadingPanel.Invoke((System.Threading.ThreadStart) delegate { loadingPanel.Visible = false; loadingPanel.Size = new Size(20, 20); }); }).Start(); } EPG_DB epgDB = EPG_DB.Get(); if (epgDB.Refresh) { loadingPanel.Visible = true; loadingPanel.Size = new Size(799, 516); loadingPanel.BringToFront(); DownloadEPGFile(epgDB, config.AppSettings.Settings["Epg"].Value); } }
public static EPG_DB LoadFromJSON() { if (_instance == null) { _instance = new EPG_DB(); } bool deleteJson = false; using (StreamReader r = new StreamReader(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepgCache.json")) { try { string json = r.ReadToEnd(); _instance.DB = JsonConvert.DeserializeObject <Dictionary <string, Dictionary <int, Dictionary <int, Dictionary <int, List <PrgInfo> > > > > >(json); EPGEventArgs epgEvent = new EPGEventArgs(); epgEvent.Error = false; _instance.epgEventFinish(_instance, epgEvent); _instance.Loaded = true; }catch (Exception ex) { deleteJson = true; _instance.Loaded = false; Console.WriteLine("Error trying read epg json: " + ex.ToString()); } } if (deleteJson) { File.Delete(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepgCache.json"); } return(_instance); }
private void exit() { exitApp = true; player.Stop(); EPG_DB epg = EPG_DB.Get(); epg.epgEventFinish -= FinishLoadEpg; Thread.Sleep(500); }
public static EPG_DB Get() { if (_instance == null) { _instance = new EPG_DB(); _instance.Loaded = false; } return(_instance); }
public static EPG_DB Get() { if (_instance == null) { _instance = new EPG_DB(); _instance.Loaded = EPG_STATUS.Loading; } return(_instance); }
private void exit() { SaveSeen(); playerForm.ExitApp(true); playerForm.Stop(); EPG_DB epg = EPG_DB.Get(); epg.epgEventFinish -= FinishLoadEpg; epg.Stop(); }
private void exit() { Logger.Current.Info($"[Exit] Exit APP"); SaveSeen(); playerForm.ExitApp(true); playerForm.Stop(); EPG_DB epg = EPG_DB.Get(); epg.epgEventFinish -= FinishLoadEpg; epg.Stop(); }
private void RepaintEPGLoadedLabel() { lbProcessingEPG.Text = Strings.LOADING; if (EPG_DB.Get().Loaded == EPG_STATUS.Loaded) { lbProcessingEPG.Text = Strings.LOADED; } if (EPG_DB.Get().Loaded == EPG_STATUS.Error) { lbProcessingEPG.Text = Strings.ERROR; } }
private void FinishLoadEpg(EPG_DB epg, EPGEventArgs e) { if (e.Error) { MessageBox.Show("EPG işlenirken hata oluştu, lütfen URL'nizi kontrol edin", "EPG HATASI", MessageBoxButtons.OK, MessageBoxIcon.Error); lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = "Error"; }); } else { lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = "Yüklendi"; }); } }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { Preferences pref = new Preferences(); pref.PrincipalForm = this; pref.ShowDialog(); EPG_DB epgDB = EPG_DB.Get(); if (epgDB.Refresh) { loadingPanel.Visible = true; loadingPanel.Size = this.Size; loadingPanel.BringToFront(); DownloadEPGFile(epgDB, AmiConfiguration.Get().URL_EPG); } }
private void FinishLoadEpg(EPG_DB epg, EPGEventArgs e) { if (e.Error) { MessageBox.Show(Strings.ERROR_EPG, "EPG ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = Strings.ERROR; }); } else { lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = Strings.LOADED; }); } }
private void LoadEPG() { EPG_DB epg = EPG_DB.Get(); epg.epgEventFinish += FinishLoadEpg; DefaultEpgLabels(); logoEPG.Image = Image.FromFile("./resources/images/info.png"); if (File.Exists(Utils.CONF_PATH + "amiiptvepgCache.json")) { epg = EPG_DB.LoadFromJSON(); } DateTime creation = File.GetLastWriteTimeUtc(Utils.CONF_PATH + "amiiptvepgCache.json"); if (File.Exists(Utils.CONF_PATH + "amiiptvepgCache.json") && creation.Day < DateTime.Now.Day - 1) { DownloadEPGFile(epg, AmiConfiguration.Get().URL_EPG); } else { if (File.Exists(Utils.CONF_PATH + "amiiptvepgCache.json")) { epg = EPG_DB.LoadFromJSON(); } else if (File.Exists(Utils.CONF_PATH + "amiiptvepg.xml")) { lbProcessingEPG.Text = Strings.LOADING; epg.ParseDB(); } else { DownloadEPGFile(epg, "http://bit.ly/AVappEPG"); AmiConfiguration amiConf = AmiConfiguration.Get(); amiConf.URL_EPG = "http://bit.ly/AVappEPG"; using (StreamWriter file = File.CreateText(Utils.CONF_PATH + "amiIptvConf.json")) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(file, amiConf); } } } }
private void FinishLoadEpg(EPG_DB epg, EPGEventArgs e) { if (e.Error) { lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = Strings.ERROR; }); Logger.Current.Error("Error processing EPG: " + e.Error.ToString()); } else { lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = Strings.LOADED; }); Logger.Current.Info("EPG Loaded correct"); } }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { Preferences pref = new Preferences(); pref.PrincipalForm = this; pref.ShowDialog(); Channels channels = Channels.Get(); if (channels.NeedRefresh()) { loadingPanel.Visible = true; loadingPanel.Size = this.Size; loadingPanel.BringToFront(); new System.Threading.Thread(delegate() { channels.RefreshList(); fillChannelList(); cmbGroups.Invoke((System.Threading.ThreadStart) delegate { cmbGroups.Items.Clear(); foreach (string group in lstListsChannels.Keys) { cmbGroups.Items.Add(group); } }); loadingPanel.Invoke((System.Threading.ThreadStart) delegate { loadingPanel.Visible = false; loadingPanel.Size = new Size(20, 20); }); }).Start(); } EPG_DB epgDB = EPG_DB.Get(); if (epgDB.Refresh) { loadingPanel.Visible = true; loadingPanel.Size = this.Size; loadingPanel.BringToFront(); DownloadEPGFile(epgDB, AmiConfiguration.Get().URL_EPG); } }
private void DownloadEPGFile(EPG_DB epgDB, string url) { new System.Threading.Thread(delegate() { try { using (var client = new WebClient()) { string tempFile = Path.GetTempFileName(); client.DownloadFile(url, tempFile); if (File.Exists(Utils.CONF_PATH + "amiiptvepg.xml")) { File.Delete(Utils.CONF_PATH + "amiiptvepg.xml"); } File.Move(tempFile, Utils.CONF_PATH + "amiiptvepg.xml"); epgDB.Refresh = false; loadingPanel.Invoke((System.Threading.ThreadStart) delegate { loadingPanel.Visible = false; loadingPanel.Size = new Size(20, 20); }); lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = Strings.LOADING; }); epgDB.ParseDB(); } } catch (Exception ex) { MessageBox.Show( "Error: " + ex.Message + ". URL=" + url, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); Logger.Current.Error($"Error: {ex.Message} .URL={url}"); } }).Start(); }
private void DownloadEPGFile(EPG_DB epgDB, string url) { new System.Threading.Thread(delegate() { try { using (var client = new WebClient()) { string tempFile = Path.GetTempFileName(); client.DownloadFile(url, tempFile); if (File.Exists(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepg.xml")) { File.Delete(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepg.xml"); } File.Move(tempFile, System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepg.xml"); epgDB.Refresh = false; loadingPanel.Invoke((System.Threading.ThreadStart) delegate { loadingPanel.Visible = false; loadingPanel.Size = new Size(20, 20); }); lbProcessingEPG.Invoke((System.Threading.ThreadStart) delegate { lbProcessingEPG.Text = "Yükleniyor..."; }); epgDB.ParseDB(); } } catch (Exception ex) { MessageBox.Show( "Error: " + ex.Message + ". URL=" + url, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } }).Start(); }
private void SetEPG(ChannelInfo channel) { if (channel.ChannelType == ChType.CHANNEL) { VisibleEPGLabes(true); EPG_DB epg = EPG_DB.Get(); if (epg.Loaded == EPG_STATUS.Loaded) { PrgInfo prg = epg.GetCurrentProgramm(channel); if (prg != null) { FillChannelInfo(prg); } else { DefaultEpgLabels(); } } else { DefaultEpgLabels(); } } else { DefaultEpgLabels(); VisibleEPGLabes(false); dynamic result = Utils.GetFilmInfo(channel, "es"); fillFilmResults = result["results"]; JObject filmMatch = null; if (result["results"].Count > 0) { filmMatch = result["results"][0]; } filmInfo = filmMatch; DrawMovieInfo(); } }
private void refreshEPGToolStripMenuItem_Click(object sender, EventArgs e) { DownloadEPGFile(EPG_DB.Get(), AmiConfiguration.Get().URL_EPG); }
private void Ok() { AmiConfiguration amiconf = AmiConfiguration.Get(); var encode = Utils.Base64Encode(txtParentalControl.Text); if (amiconf.PARENTAL_PASS != encode && !string.IsNullOrEmpty(txtParentalControl.Text)) { if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS)) { using (var askForm = new AskPass()) { var result = askForm.ShowDialog(); if (result == DialogResult.Cancel) { return; } } } amiconf.PARENTAL_PASS = encode; } if (string.IsNullOrEmpty(txtParentalControl.Text) && !string.IsNullOrEmpty(amiconf.PARENTAL_PASS)) { if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS)) { using (var askForm = new AskPass()) { var result = askForm.ShowDialog(); if (result == DialogResult.Cancel) { return; } } } amiconf.PARENTAL_PASS = ""; } if (amiconf.URL_IPTV != txtURL.Text) { amiconf.URL_IPTV = txtURL.Text; Channels channels = Channels.Get(); channels.SetUrl(txtURL.Text); channels.SetNeedRefresh(true); } else { Channels channels = Channels.Get(); channels.SetNeedRefresh(false); } if (amiconf.REQ_EMAIL != txtRequestEmail.Text) { amiconf.REQ_EMAIL = txtRequestEmail.Text; } if (amiconf.URL_EPG != txtEPG.Text) { amiconf.URL_EPG = txtEPG.Text; EPG_DB epgDB = EPG_DB.Get(); epgDB.Refresh = true; } amiconf.DEF_LANG = Utils.GetAudioConfName(audio.SelectedItem.ToString()); amiconf.DEF_SUB = Utils.GetSubConfName(sub.SelectedItem.ToString()); using (StreamWriter file = File.CreateText(Utils.CONF_PATH + "amiIptvConf.json")) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(file, amiconf); } this.Close(); this.Dispose(); }
private void refreshEPGToolStripMenuItem_Click(object sender, EventArgs e) { DownloadEPGFile(EPG_DB.Get(), config.AppSettings.Settings["Epg"].Value); }
private void Form1_Load(object sender, EventArgs e) { lbVersion.Text = ApplicationDeployment.IsNetworkDeployed ? ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString() : Assembly.GetExecutingAssembly().GetName().Version.ToString(); config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); chList.FullRowSelect = true; player.MediaUnloaded += StopPlayEvent; player.MediaLoaded += MediaLoaded; player.Volume = 100; trVolumen.Value = Convert.ToInt32(player.Volume / 2); btnMuteUnmute.BackgroundImage = Image.FromFile("./resources/images/unmute.png"); btnMuteUnmute.BackgroundImageLayout = ImageLayout.Stretch; btnPlayPause.BackgroundImage = Image.FromFile("./resources/images/play.png"); btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch; btnStop.BackgroundImage = Image.FromFile("./resources/images/stop.png"); btnStop.BackgroundImageLayout = ImageLayout.Stretch; EPG_DB epg = EPG_DB.Get(); epg.epgEventFinish += FinishLoadEpg; DefaultEpgLabels(); logoEPG.Image = Image.FromFile("./resources/images/info.png"); Channels channels = Channels.Get(); channels.SetUrl(config.AppSettings.Settings["Url"].Value); if (File.Exists(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\channelCache.json")) { channels = Channels.LoadFromJSON(); fillChannelList(); } else { ChannelInfo ch = new ChannelInfo(); ch.Title = "Please load iptv list"; ListViewItem i = new ListViewItem("0"); i.SubItems.Add("Please load iptv list"); chList.Items.Add(i); lstChannels.Add(ch); } DateTime creationCacheChannel = File.GetLastWriteTimeUtc(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\channelCache.json"); if (File.Exists(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\channelCache.json") && creationCacheChannel.Day < DateTime.Now.Day - 1) { RefreshChList(false); } if (File.Exists(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepgCache.json")) { epg = EPG_DB.LoadFromJSON(); } DateTime creation = File.GetLastWriteTimeUtc(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepgCache.json"); if (File.Exists(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepgCache.json") && creation.Day < DateTime.Now.Day - 1) { //DownloadEPGFile(epg, config.AppSettings.Settings["Epg"].Value); } else { if (File.Exists(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepgCache.json")) { epg = EPG_DB.LoadFromJSON(); } else if (File.Exists(System.Environment.GetEnvironmentVariable("USERPROFILE") + "\\amiiptvepg.xml")) { lbProcessingEPG.Text = "Loading..."; epg.ParseDB(); } else { DownloadEPGFile(epg, "http://bit.ly/AVappEPG"); config.AppSettings.Settings["Epg"].Value = "http://bit.ly/AVappEPG"; ConfigurationManager.RefreshSection("appSettings"); config.Save(ConfigurationSaveMode.Modified); } } player.API.SetPropertyString("deinterlace", "yes"); }
private void Ok() { AmiConfiguration amiconf = AmiConfiguration.Get(); var encode = Utils.Base64Encode(txtParentalControl.Text); if (amiconf.PARENTAL_PASS != encode && !string.IsNullOrEmpty(txtParentalControl.Text)) { if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS)) { using (var askForm = new AskPass()) { var result = askForm.ShowDialog(); if (result == DialogResult.Cancel) { return; } } } amiconf.PARENTAL_PASS = encode; } if (string.IsNullOrEmpty(txtParentalControl.Text) && !string.IsNullOrEmpty(amiconf.PARENTAL_PASS)) { if (!string.IsNullOrEmpty(amiconf.PARENTAL_PASS)) { using (var askForm = new AskPass()) { var result = askForm.ShowDialog(); if (result == DialogResult.Cancel) { return; } } } amiconf.PARENTAL_PASS = ""; } amiconf.URL_IPTV = "NEW_VERSION"; /*if (amiconf.URL_IPTV != txtURL.Text) * { * amiconf.URL_IPTV = txtURL.Text; * Channels channels = Channels.Get(); * channels.SetUrl(txtURL.Text); * channels.SetNeedRefresh(true); * } * else * { * Channels channels = Channels.Get(); * channels.SetNeedRefresh(false); * }*/ if (amiconf.REQ_EMAIL != txtRequestEmail.Text) { amiconf.REQ_EMAIL = txtRequestEmail.Text; } if (amiconf.URL_EPG != txtEPG.Text) { amiconf.URL_EPG = txtEPG.Text; EPG_DB epgDB = EPG_DB.Get(); epgDB.Refresh = true; } if (!amiconf.ENABLE_LOG && chLog.Checked) { amiconf.ENABLE_LOG = true; PrincipalForm.RepaintLabels(); } if (amiconf.ENABLE_LOG && !chLog.Checked) { amiconf.ENABLE_LOG = false; PrincipalForm.RepaintLabels(); } if (!amiconf.AUTOPLAY_EPISODES && chAutoPlayEpisodes.Checked) { amiconf.AUTOPLAY_EPISODES = true; PrincipalForm.RepaintLabels(); } if (amiconf.AUTOPLAY_EPISODES && !chAutoPlayEpisodes.Checked) { amiconf.AUTOPLAY_EPISODES = false; PrincipalForm.RepaintLabels(); PrincipalForm.HideAutoPlay(); } if (!amiconf.REMOVE_DONATE && chDonate.Checked) { amiconf.REMOVE_DONATE = true; PrincipalForm.RepaintLabels(); } if (amiconf.REMOVE_DONATE && !chDonate.Checked) { amiconf.REMOVE_DONATE = false; PrincipalForm.RepaintLabels(); } if (audio.SelectedItem != null) { amiconf.DEF_LANG = Utils.GetAudioConfName(audio.SelectedItem.ToString()); } else { amiconf.DEF_LANG = "spa"; } if (sub.SelectedItem != null) { amiconf.DEF_SUB = Utils.GetSubConfName(sub.SelectedItem.ToString()); } else { amiconf.DEF_SUB = "none"; } using (StreamWriter file = File.CreateText(Utils.CONF_PATH + "amiIptvConf.json")) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(file, amiconf); } this.Close(); this.Dispose(); }