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); } }
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 RefreshChList(bool showLoading) { Channels channels = Channels.Get(); if (showLoading) { loadingPanel.Size = this.Size; loadingPanel.Visible = true; loadingPanel.BringToFront(); } new System.Threading.Thread(delegate() { channels.RefreshList(); if (channels.NeedRefresh()) { 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; }); }).Start(); }
private void chList_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var channel = Channels.Get().GetChannel(int.Parse(chList.SelectedItems[0].SubItems[0].Text)); if (channel.ChannelType == ChType.MOVIE || channel.ChannelType == ChType.SHOW) { if (SeenResumeChannels.Get().IsSeen(chList.SelectedItems[0].SubItems[1].Text)) { menuItemChnSeen.Text = Strings.UnSeen; } else { menuItemChnSeen.Text = Strings.Seen; } if (SeenResumeChannels.Get().IsResume(chList.SelectedItems[0].SubItems[1].Text)) { menuItemChnResum.Text = Strings.UnResume; menuItemChnResum.Visible = true; } else { menuItemChnResum.Visible = false; } contextMenuChannel.Show(Cursor.Position); } } }
public void RefreshListView() { FillChList(); chList.Invoke((System.Threading.ThreadStart) delegate { txtLoadCh.Invoke((System.Threading.ThreadStart) delegate { txtLoadCh.Text = Strings.LOADING_CHANNELS; txtLoadCh.BringToFront(); txtLoadCh.Visible = true; }); foreach (ListViewItem item in chList.Items) { item.ImageIndex = -1; var channel = Channels.Get().GetChannel(int.Parse(item.SubItems[0].Text)); if (channel.seen) { item.ImageIndex = 0; } else if (channel.currentPostion != null) { item.ImageIndex = 1; } } txtLoadCh.Invoke((System.Threading.ThreadStart) delegate { txtLoadCh.Text = Strings.LOADING_CHANNELS; txtLoadCh.Visible = false; }); }); }
private void menuItemChnResum_Click(object sender, EventArgs e) { var channel = Channels.Get().GetChannel(int.Parse(chList.SelectedItems[0].SubItems[0].Text)); channel.currentPostion = null; SeenResumeChannels.Get().RemoveResume(channel.Title); RefreshListView(); }
private void btnCancel_Click(object sender, EventArgs e) { Channels channels = Channels.Get(); channels.SetNeedRefresh(false); this.Close(); this.Dispose(); }
private void LoadChannels() { UrlLists urls = UrlLists.Get(); Channels channels = Channels.Get(); bool withoutUrls = false; bool refreshList = false; if (urls.Lists.Count > 0) { channels.SetUrl(urls.Lists[urls.Selected]); } else { channels.SetUrl(new UrlObject() { Name = "NONE", URL = "http://no_url" }); withoutUrls = true; } if (!withoutUrls && File.Exists(Utils.CONF_PATH + "\\lists\\" + urls.Lists[urls.Selected].Name + "_cache.json")) { channels = Channels.LoadFromJSON(); fillChannelList(); DateTime creationCacheChannel = File.GetLastWriteTimeUtc(Utils.CONF_PATH + "\\lists\\" + urls.Lists[urls.Selected].Name + "_cache.json"); if (File.Exists(Utils.CONF_PATH + "\\lists\\" + urls.Lists[urls.Selected].Name + "_cache.json") && creationCacheChannel.Day < DateTime.Now.Day - 1) { refreshList = true; } } else { ChannelInfo ch = new ChannelInfo(); ch.Title = Strings.DEFAULT_MSG_NO_LIST; ListViewItem i = new ListViewItem("0"); i.SubItems.Add(Strings.DEFAULT_MSG_NO_LIST); chList.Invoke((System.Threading.ThreadStart) delegate { chList.Items.Add(i); }); var x = new ChannelListItem(ch.Title, ch.ChNumber); x.Seen = ch.seen; x.Resume = ch.currentPostion != null; lstListsChannels[ALL_GROUP].Add(x); lstChannels.Add(x); if (urls.Lists.Count > 0 && !File.Exists(Utils.CONF_PATH + "\\lists\\" + urls.Lists[urls.Selected].Name + "_cache.json")) { refreshList = true; } } FillGroups(); if (refreshList) { RefreshChList(true); } }
private void listView1_DoubleClick(object sender, EventArgs e) { Channels channels = Channels.Get(); if (chList.SelectedItems.Count > 0) { ListViewItem item = chList.SelectedItems[0]; ChannelInfo channel = channels.GetChannel(int.Parse(item.SubItems[0].Text)); ChangeChannelTo(channel, item.SubItems[0].Text); } }
private void listView1_DoubleClick(object sender, EventArgs e) { Channels channels = Channels.Get(); if (chList.SelectedItems.Count > 0) { ListViewItem item = chList.SelectedItems[0]; ChannelInfo channel = channels.GetChannel(int.Parse(item.SubItems[0].Text)); if (channel == null) { MessageBox.Show(item.SubItems[1].Text); } else { player.Stop(); isChannel = channel.ChannelType == ChType.CHANNEL; isPaused = false; Thread.Sleep(500); player.Load(channel.URL); try { string chName = channel.TVGName.Length < 100 ? channel.TVGName : channel.TVGName.Substring(0, 99); Task <string> stats = Utils.GetAsync("" + chName); } catch (Exception ex) { Console.WriteLine("HATA GÖNDERME İSTATİSTİKLERİ"); } logoChannel.LoadCompleted -= logoLoaded; logoChannel.Image = Image.FromFile("./resources/images/nochannel.png"); if (!string.IsNullOrEmpty(channel.TVGLogo)) { logoChannel.LoadAsync(channel.TVGLogo); logoChannel.LoadCompleted += logoLoaded; } string title = channel.Title; if (title.Length > 20) { title = title.Substring(0, 20) + "..."; } lbChName.Text = title; currentChannel = channel; currentChType = channel.ChannelType; SetEPG(channel); } } }
private void menuItemChnSeen_Click(object sender, EventArgs e) { var channel = Channels.Get().GetChannel(int.Parse(chList.SelectedItems[0].SubItems[0].Text)); if (SeenResumeChannels.Get().IsSeen(chList.SelectedItems[0].SubItems[1].Text)) { channel.seen = false; SeenResumeChannels.Get().RemoveSeen(channel.Title); } else { channel.seen = true; SeenResumeChannels.Get().UpdateOrSetSeen(channel.Title, true, channel.totalDuration == null?-1:(double)channel.totalDuration, DateTime.Now); } RefreshListView(); }
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 fillChannelList() { Channels channels = Channels.Get(); List <ListViewItem> listChannels = new List <ListViewItem>(); lstChannels.Clear(); foreach (var elem in channels.GetChannelsDic()) { int chNumber = elem.Key; ChannelInfo channel = elem.Value; lstChannels.Add(channel); } chList.Invoke((System.Threading.ThreadStart) delegate { chList.Items.Clear(); chList.Items.AddRange(lstChannels.Select(c => new ListViewItem(new string[] { c.ChNumber.ToString(), c.Title })).ToArray()); }); }
public void RefreshListView() { FillChList(); chList.Invoke((System.Threading.ThreadStart) delegate { foreach (ListViewItem item in chList.Items) { item.ImageIndex = -1; var channel = Channels.Get().GetChannel(int.Parse(item.SubItems[0].Text)); if (channel.seen) { item.ImageIndex = 0; } else if (channel.currentPostion != null) { item.ImageIndex = 1; } } }); }
private void RefreshChList(bool showLoading) { Channels channels = Channels.Get(); if (showLoading) { loadingPanel.Visible = true; loadingPanel.BringToFront(); } new System.Threading.Thread(delegate() { channels.RefreshList(); if (channels.NeedRefresh()) { fillChannelList(); } loadingPanel.Invoke((System.Threading.ThreadStart) delegate { loadingPanel.Visible = false; }); }).Start(); }
private void LoadChannels() { Channels channels = Channels.Get(); channels.SetUrl(AmiConfiguration.Get().URL_IPTV); if (File.Exists(Utils.CONF_PATH + "channelCache.json")) { channels = Channels.LoadFromJSON(); fillChannelList(); } else { ChannelInfo ch = new ChannelInfo(); ch.Title = Strings.DEFAULT_MSG_NO_LIST; ListViewItem i = new ListViewItem("0"); i.SubItems.Add(Strings.DEFAULT_MSG_NO_LIST); chList.Items.Add(i); var x = new ChannelListItem(ch.Title, ch.ChNumber); x.Seen = ch.seen; x.Resume = ch.currentPostion != null; lstListsChannels[ALL_GROUP].Add(x); lstChannels.Add(x); } cmbGroups.Items.Clear(); foreach (string group in lstListsChannels.Keys) { cmbGroups.Items.Add(group); } cmbGroups.SelectedIndex = 0; DateTime creationCacheChannel = File.GetLastWriteTimeUtc(Utils.CONF_PATH + "channelCache.json"); if (File.Exists(Utils.CONF_PATH + "channelCache.json") && creationCacheChannel.Day < DateTime.Now.Day - 1) { RefreshChList(false); } }
private void FillChannelList() { Channels channels = Channels.Get(); List <GrpInfo> groups = channels.GetGroups(); var groupsNodeWhite = new List <TreeNode>(); var groupsNodeBlack = new List <TreeNode>(); foreach (var group in groups) { var grpNode = new TreeNode(group.Title); grpNode.Tag = group; var grpNodeBlack = new TreeNode(group.Title); grpNodeBlack.Tag = group; foreach (var ch in channels.GetChannelsByGroup(group)) { var chNode = new TreeNode(ch.Title); chNode.Tag = ch; if (ParentalControl.Get().IsChBlock(ch)) { grpNodeBlack.Nodes.Add(chNode); } else { grpNode.Nodes.Add(chNode); } } if (grpNode.Nodes.Count > 0) { groupsNodeWhite.Add(grpNode); } if (grpNodeBlack.Nodes.Count > 0) { groupsNodeBlack.Add(grpNodeBlack); } } treeList.Nodes.AddRange(groupsNodeWhite.ToArray()); treeBlock.Nodes.AddRange(groupsNodeBlack.ToArray()); }
private void SaveSeen() { if (File.Exists(Utils.CONF_PATH + "amiIptvChannelSeen.json")) { File.Delete(Utils.CONF_PATH + "amiIptvChannelSeen.json"); } SeenResumeChannels channels = SeenResumeChannels.Get(); foreach (var ch in Channels.Get().GetChannelsDic().Values) { if (ch.ChannelType == ChType.MOVIE || ch.ChannelType == ChType.SHOW) { if (ch.seen) { if (!SeenResumeChannels.Get().IsSeen(ch.Title)) { SeenResumeChannels.Get().UpdateOrSetSeen(ch.Title, true, ch.totalDuration == null ? -1 : (double)ch.totalDuration, DateTime.Now); } } else { if (ch.currentPostion != null) { if (!SeenResumeChannels.Get().IsResume(ch.Title)) { SeenResumeChannels.Get().UpdateOrSetResume(ch.Title, (double)ch.currentPostion, ch.totalDuration == null ? -1 : (double)ch.totalDuration, DateTime.Now); } } } } } using (StreamWriter file = File.CreateText(Utils.CONF_PATH + "amiIptvChannelSeen.json")) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(file, channels); } }
private void FillChList() { Channels channels = Channels.Get(); List <ChannelListItem> woGroup = new List <ChannelListItem>(); lstListsChannels.Clear(); lstListsChannels[ALL_GROUP] = new List <ChannelListItem>(); lstListsChannels[ALL_GROUP].Clear(); lstChannels.Clear(); foreach (var elem in channels.GetChannelsDic()) { int chNumber = elem.Key; ChannelInfo channel = elem.Value; ChannelListItem chanItem = new ChannelListItem(channel.Title, channel.ChNumber); chanItem.Seen = channel.seen; chanItem.Resume = channel.currentPostion != null; lstChannels.Add(chanItem); lstListsChannels[ALL_GROUP].Add(chanItem); string group = channel.TVGGroup; if (string.IsNullOrEmpty(group)) { woGroup.Add(chanItem); } else { if (!lstListsChannels.ContainsKey(group)) { lstListsChannels[group] = new List <ChannelListItem>(); } lstListsChannels[group].Add(chanItem); } } if (woGroup.Count > 0) { lstListsChannels[EMPTY_GROUP] = woGroup; } }
public void ChannelToNumber(int number) { ChannelInfo channel = Channels.Get().GetChannel(number); ChangeChannelTo(channel, (number).ToString()); }
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(); }
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 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()); }
public void PrevChannel() { ChannelInfo channel = Channels.Get().GetChannel(chnl.ChNumber - 1); ChangeChannelTo(channel, (chnl.ChNumber - 1).ToString()); }