Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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");
        }