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 = ""; } 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(); } 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(); }
public void ChannelToNumber(int number) { ChannelInfo channel = Channels.Get().GetChannel(number); ChangeChannelTo(channel, (number).ToString()); }
public void PrevChannel() { ChannelInfo channel = Channels.Get().GetChannel(chnl.ChNumber - 1); ChangeChannelTo(channel, (chnl.ChNumber - 1).ToString()); }
private void MediaLoaded(object sender, EventArgs e) { if (AmiConfiguration.Get().ENABLE_LOG) { string msg = "[MediaLoaded-MPV] MPV load streaming with next values: "; msg += $"SetPositionOnLoad => {SetPositionOnLoad} "; msg += $"currLang => {currLang} "; msg += $"isChannel=> {isChannel} "; msg += $"positioncchangedevent=> {positioncchangedevent} "; msg += $"player.Duration.TotalSeconds=> {player.Duration.TotalSeconds} "; Logger.Current.Debug(msg); } ParseTracksAndSetDefaults(); if (!isChannel && player.Duration.TotalSeconds > 0) { seekBar.Invoke((System.Threading.ThreadStart) delegate { seekBar.Enabled = true; seekBar.Value = 0; seekBar.Maximum = Convert.ToInt32(player.Duration.TotalSeconds); if (SetPositionOnLoad) { seekBar.Value = positionOnLoad; } }); if (!positioncchangedevent) { player.PositionChanged += PositionChanged; positioncchangedevent = true; } } /*else * { * cmbLangs.Invoke((System.Threading.ThreadStart)delegate * { * cmbLangs.Enabled = false; * cmbLangs.Items.Clear(); * }); * cmbSubs.Invoke((System.Threading.ThreadStart)delegate * { * cmbSubs.Enabled = false; * cmbSubs.Items.Clear(); * * }); * seekBar.Invoke((System.Threading.ThreadStart)delegate { * seekBar.Enabled = false; * seekBar.Value = 0; * }); * }*/ player.Resume(); if (SetPositionOnLoad) { player.SeekAsync(positionOnLoad); SetPositionOnLoad = false; } btnPlayPause.BackgroundImage = Image.FromFile("./resources/images/pause.png"); btnPlayPause.BackgroundImageLayout = ImageLayout.Stretch; if (currLang > -1) { cmbLangs.Invoke((System.Threading.ThreadStart) delegate { cmbLangs.SelectedIndex = currLang; }); currLang = -1; } if (currSub > -1) { cmbSubs.Invoke((System.Threading.ThreadStart) delegate { cmbSubs.SelectedIndex = currSub; }); currSub = -1; } panelvideo.Invoke((System.Threading.ThreadStart) delegate { panelvideo.Focus(); }); Channels.Get().IsShowAndGetMoreEpisodes(principalForm.GetCurrentChannel()); }