private void FillMoviesEPG(JObject filmMatch, ChType channelType)
        {
            string title;
            string description;
            string stars;
            string year;

            if (channelType == ChType.MOVIE)
            {
                title       = filmMatch["title"].ToString();
                description = filmMatch["overview"].ToString();
                stars       = filmMatch["vote_average"].ToString();
                year        = filmMatch["release_date"].ToString().Split('-')[0];
            }
            else
            {
                title       = filmMatch["name"].ToString();
                description = filmMatch["overview"].ToString();
                stars       = filmMatch["vote_average"].ToString();
                year        = filmMatch["first_air_date"].ToString().Split('-')[0];
            }
            lbTitleEPG.Text = title;
            if (description.Length > 200 || description.Split('\n').Length > 3)
            {
                description = description.Substring(0, 190) + " ...";
            }
            lbDescription.Text = description;
            lbStars.Text       = stars;
            lbYear.Text        = year;
        }
        public static dynamic GetFilmInfo(ChType chType, string title, string year, string lang)
        {
            lang = Strings.Culture.TwoLetterISOLanguageName;
            string apiUrl     = "https://api.themoviedb.org/3/search/$$FTYPE$$?api_key=$$APIKEY$$&language=$$LANG$$&query=$$NAME$$&$$YEAR$$page=1&include_adult=false";
            string apiKey     = "9e92adff436095fb58d51262de09385a";
            string ftype      = "movie";
            string yearStr    = "year=$$YEAR$$";
            string name       = title;
            string movie_date = year;

            if (chType == ChType.SHOW)
            {
                ftype   = "tv";
                yearStr = "first_air_date_year=$$YEAR$$";
            }
            apiUrl = apiUrl.Replace("$$FTYPE$$", ftype).Replace("$$APIKEY$$", apiKey).Replace("$$LANG$$", lang);
            if (!string.IsNullOrEmpty(movie_date) && Regex.IsMatch(movie_date, @"\d\d\d\d"))
            {
                apiUrl = apiUrl.Replace("$$YEAR$$", yearStr).Replace("$$YEAR$$", movie_date + "&");
            }
            string nameWithPercent = name.Replace(" ", "%20");

            apiUrl = apiUrl.Replace("$$NAME$$", nameWithPercent);
            string result = GetUrl(apiUrl);

            return(JsonConvert.DeserializeObject(result));
        }
Esempio n. 3
0
        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);
                }
            }
        }
 public void CalculateType()
 {
     if (URL.EndsWith(".mkv") || URL.EndsWith(".avi") || URL.EndsWith(".mp4"))
     {
         ChannelType = ChType.MOVIE;
         if (Regex.IsMatch(Title, @"S\d\d\s*?E\d\d$"))
         {
             ChannelType = ChType.SHOW;
         }
     }
     else
     {
         ChannelType = ChType.CHANNEL;
     }
 }
Esempio n. 5
0
        public void FillMovieData(JObject filmInfo, ChType chType)
        {
            VisibleChannel(false);
            string title       = "";
            string description = "";
            string stars       = "";
            string year        = "";

            if (chType == ChType.MOVIE)
            {
                title = filmInfo["title"].ToString();
                year  = filmInfo["release_date"].ToString().Split('-')[0];
            }
            else
            {
                title = filmInfo["name"].ToString();
                year  = filmInfo["first_air_date"].ToString().Split('-')[0];
            }
            logoPRG.LoadCompleted -= logoEPGLoaded;
            description            = filmInfo["overview"].ToString();
            stars = filmInfo["vote_average"].ToString();
            txtDescription.Text = description;
            lbCountry.Text      = "-";
            lbTitleEPG.Text     = title;
            lbStars.Text        = stars;
            lbReleaseDate.Text  = year;
            string poster_path = filmInfo["poster_path"].ToString();

            logoPRG.Image = Image.FromFile("./resources/images/nochannel.png");
            if (!string.IsNullOrEmpty(poster_path))
            {
                logoPRG.LoadAsync(Utils.PosterBasePath + poster_path);
                logoPRG.LoadCompleted += logoEPGLoaded;
            }

            /*List<string> genre_ids = new List<string>();
             * foreach (JValue genre in (JArray)filmInfo["genre_ids"])
             * {
             *  genre_ids.Add(genre.ToString());
             * }
             * if (genre_ids.Count > 0)
             * {
             *  lbRatings.Text = string.Join(",", genre_ids.ToArray<string>());
             * }*/
        }
        private void ChangeChannelTo(ChannelInfo channel, string number)
        {
            if (channel == null)
            {
                MessageBox.Show(Strings.NOT_FOUND_CH + number);
            }
            else
            {
                if (ParentalControl.Get().IsChBlock(channel))
                {
                    using (var askForm = new AskPass())
                    {
                        var result = askForm.ShowDialog();
                        if (result == DialogResult.Cancel)
                        {
                            return;
                        }
                    }
                }
                Logger.Current.Info($"[ChangeChannelTo] Change channel to {channel.TVGName}");
                playerForm.Stop();
                playerForm.SetIsChannel(channel.ChannelType == ChType.CHANNEL);
                playerForm.SetIsPaused(false);
                Thread.Sleep(500);
                currLang = -1;
                currSub  = -1;
                int currPostion = 0;
                if (channel.currentPostion != null && !channel.seen)
                {
                    if (MessageBox.Show(owner: this, Strings.Resume, "AmiIptvPlayer", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                    {
                        currPostion = (int)channel.currentPostion;
                    }
                    else
                    {
                        channel.currentPostion = null;
                        SeenResumeChannels.Get().RemoveResume(channel.Title);
                        RefreshListView();
                    }
                }
                playerForm.SetMedia(channel.URL, currPostion, currLang, currSub);
                try
                {
                    string        chName = channel.TVGName.Length < 100 ? channel.TVGName : channel.TVGName.Substring(0, 99);
                    Task <string> stats  = Utils.GetAsync("http://amian.es:5085/stats?ctype=connected&app=net&chn=" + chName);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("ERROR SENDING STATS");
                }

                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;
                chnl          = channel;
                currentChType = channel.ChannelType;
                SetEPG(channel);
            }
            playerForm.SetFocusOnVideoPanel();
        }
        public static List <SearchIdent> TransformJArrayToSearchIdent(JArray fillFilmResults, ChType type)
        {
            List <SearchIdent> listSearch = new List <SearchIdent>();

            foreach (JObject obj in fillFilmResults)
            {
                string title = "";
                string year  = "1900";
                if (type == ChType.MOVIE)
                {
                    title = obj["title"].ToString();
                    year  = obj["release_date"]?.ToString().Split('-')[0];
                }
                else
                {
                    title = obj["name"].ToString();
                    year  = obj["first_air_date"]?.ToString().Split('-')[0];
                }
                SearchIdent se = new SearchIdent();
                se.Title      = title;
                se.Year       = year;
                se.SearchData = obj;
                se.ChType     = type;
                listSearch.Add(se);
            }
            return(listSearch);
        }
Esempio n. 8
0
 /// <summary>
 /// ASP = All Space 指包含换行在内的空白字符
 /// </summary>
 /// <param name="cht"></param>
 /// <returns></returns>
 static bool IsASP(ChType cht)
 {
     return(cht == ChType.ISP || cht == ChType.NL);
 }