Exemplo n.º 1
0
        public Download()
        {
            InitializeComponent();
            // ytBtt.Source = App.GetImageSource("round_movie_white_48dp.png");
            ytBtt.Source = App.GetImageSource("ytIcon.png");

            ytrealBtt.Clicked += async(o, e) => {
                string txt = await Clipboard.GetTextAsync();

                UserDialogs.Instance.Prompt(new PromptConfig()
                {
                    Title       = "YouTube Download",
                    CancelText  = "Cancel",
                    OkText      = "Download",
                    InputType   = InputType.Url,
                    Text        = txt,
                    Placeholder = "YouTube Link",
                    OnAction    = new Action <PromptResult>(async t => {
                        if (t.Ok)
                        {
                            string ytUrl          = t.Text;
                            Video v               = null;
                            const string errorTxt = "Error Downloading YouTube Video";
                            try {
                                v = await YouTube.GetYTVideo(ytUrl);
                            }
                            catch (Exception) {
                                App.ShowToast(errorTxt);
                            }
                            if (v == null)
                            {
                                App.ShowToast(errorTxt);
                            }
                            else
                            {
                                try {
                                    string dpath = YouTube.GetYTPath(v.Title);
                                    var data     = await YouTube.GetInfoAsync(v.GetUrl());
                                    double mb    = App.ConvertBytesToAny(data.Size, 5, 2);
                                    // (episodeResult.mirrosUrls[i], episodeResult.Title + ".mp4", true, "/" + GetPathFromType());
                                    //  string ppath = App.DownloadUrl(episodeResult.PosterUrl, "epP" + episodeResult.Title + ".jpg", false, "/Posters");
                                    // string mppath = App.DownloadUrl(currentMovie.title.hdPosterUrl, "hdP" + episodeResult.Title + ".jpg", false, "/TitlePosters");
                                    string mppath = v.Thumbnails.HighResUrl;
                                    string ppath  = v.Thumbnails.HighResUrl;

                                    string key = "_dpath=" + dpath + "|||_ppath=" + ppath + "|||_mppath=" + mppath + "|||_descript=" + v.Description + "|||_maindescript=" + v.Description + "|||_epCounter=" + "-1" + "|||_epId=" + v.Id + "|||_movieId=" + v.GetUrl() + "|||_title=" + v.Title + "|||_movieTitle=" + v.Title + "|||isYouTube=" + true + "|||UploadData=" + v.UploadDate.ToString() + "|||Author=" + v.Author + "|||Duration=" + v.Duration.TotalSeconds + "|||=EndAll";
                                    print("DKEY: " + key);
                                    App.SetKey("Download", v.Id, key);
                                    App.ShowToast("Download Started - " + Math.Round(mb, 1) + "MB");
                                    App.SetKey("DownloadSize", v.Id, Math.Round(mb, 2));
                                    YouTube.DownloadVideo(data, v.Title, "Download complete!", true, v.Title);
                                    // YouTube.DownloadVideo(data, v.Title);
                                }
                                catch (Exception) {
                                    App.ShowToast(errorTxt);
                                }
                            }
                        }
                    })
                });;
            };


            epView         = new MainEpisodeView();
            BindingContext = epView;

            BackgroundColor = Settings.BlackRBGColor;
        }
Exemplo n.º 2
0
        public Home()
        {
            InitializeComponent();
            baseImg.Source = App.GetImageSource("NoBookmarks.png");

            selectTabItems = new BorderView[] {
                HomeBtt, RelatedBtt, TopBtt, TrendingBtt,
            };
            selectTabLabels = new Label[] {
                HomeLbl, RelatedLbl, TopLbl, TrendingLbl,
            };
            ChangeSizeOfTabs();
            for (int i = 0; i < selectTabItems.Length; i++)
            {
                Commands.SetTap(selectTabItems[i], new Command((o) => {
                    int id          = int.Parse(o.ToString());
                    selectedTabItem = id;
                    ChangeSizeOfTabs();
                }));
                Commands.SetTapParameter(selectTabItems[i], i.ToString());
            }

            if (Settings.IS_TEST_BUILD)
            {
                return;
            }
            try {
                epView         = new MainEpisodeView();
                BindingContext = epView;

                BackgroundColor = Settings.BlackRBGColor;

                MovieTypePicker = new LabelList(MovieTypePickerBtt, genresNames);

                // ImdbTypePicker = new LabelList(ImdbTypePickerBtt, recomendationTypes);

                //MovieTypePicker.ItemsSource = genresNames;
                // ImdbTypePicker.ItemsSource = recomendationTypes;
                //   UpdateBookmarks();

                MovieTypePicker.SelectedIndex = 0;

                /*
                 * ImdbTypePicker.SelectedIndex = -1;
                 *
                 * ImdbTypePicker.SelectedIndexChanged += (o, e) => {
                 *  ClearEpisodes();
                 *  mainCore.PurgeThreads(21);
                 *  Fething = false;
                 *  if (IsRecommended) {
                 *      GetFetchRecomended();
                 *  }
                 *  else {
                 *      GetFetch();
                 *  }
                 *  //    ImdbTypePickerBtt.Text = ImdbTypePicker.Items[ImdbTypePicker.SelectedIndex];
                 *
                 * };*/

                //   MovieTypePickerBtt.Text = MovieTypePicker.ItemsSource[MovieTypePicker.SelectedIndex];

                MovieTypePicker.SelectedIndexChanged += (o, e) => {
                    ClearEpisodes(!IsRecommended);
                    if (IsRecommended)
                    {
                        CoreHelpers.Shuffle(iMDbTopList);
                        LoadMoreImages();
                    }
                    else
                    {
                        mainCore.PurgeThreads(21);
                        Fething = false;
                        GetFetch();
                    }
                };

                double lastScroll = 0;

                episodeView.Scrolled += (o, e) => {
                    MovieTypePickerBttScrollY -= lastScroll - e.ScrollY;
                    lastScroll = e.ScrollY;

                    if (MovieTypePickerBttScrollY > MovieTypePickerBttMinScrollY)
                    {
                        MovieTypePickerBttScrollY = MovieTypePickerBttMinScrollY;
                    }
                    else if (MovieTypePickerBttScrollY < 0)
                    {
                        MovieTypePickerBttScrollY = 0;
                    }

                    MovieTypePickerBtt.TranslationY = MovieTypePickerBttScrollY;

                    double maxY = episodeView.HeightRequest - episodeView.Height;
                    //print(maxY);
                    if (e.ScrollY >= maxY - 200)
                    {
                        LoadMoreImages();
                    }
                };


                if (Device.RuntimePlatform == Device.UWP)
                {
                    // BlueSeperator.IsVisible = false;
                    // BlueSeperator.IsEnabled = false;
                    OffBar.IsVisible = false;
                    OffBar.IsEnabled = false;
                }
                else
                {
                    OffBar.Source = App.GetImageSource("gradient.png"); OffBar.HeightRequest = 3; OffBar.HorizontalOptions = LayoutOptions.Fill; OffBar.ScaleX = 100; OffBar.Opacity = 0.3;
                }

                episodeView.VerticalScrollBarVisibility = Settings.ScrollBarVisibility;
            }
            catch (Exception _ex) {
                error(_ex);
            }

            /*
             * ImageScroller.Scrolled += (o, e) => {
             *  double maxY = ImageScroller.ContentSize.Height - ImageScroller.Height;
             *  if (e.ScrollY >= maxY - 200) {
             *      LoadMoreImages();
             *  }
             *
             * };*/
        }
Exemplo n.º 3
0
        public Home()
        {
            InitializeComponent();
            baseImg.Source = App.GetImageSource("NoBookmarks.png");

            selectTabItems = new BorderView[] {
                HomeBtt, RelatedBtt, TopBtt, TrendingBtt,
            };
            selectTabLabels = new Label[] {
                HomeLbl, RelatedLbl, TopLbl, TrendingLbl,
            };
            FastTxtBtt.Clicked += async(o, e) => {
                string a = await ActionPopup.DisplayActionSheet("Clear watching", "Yes, clear currently watching", "No, dont clear currently watching");

                if (a.StartsWith('Y'))
                {
                    App.RemoveFolder(nameof(CachedCoreEpisode));
                    UpdateNextEpisode();
                }
            };
            ChangeSizeOfTabs();
            for (int i = 0; i < selectTabItems.Length; i++)
            {
                Commands.SetTap(selectTabItems[i], new Command((o) => {
                    int id          = int.Parse(o.ToString());
                    selectedTabItem = id;
                    ChangeSizeOfTabs();
                }));
                Commands.SetTapParameter(selectTabItems[i], i.ToString());
            }

            if (Settings.IS_TEST_BUILD)
            {
#pragma warning disable CS0162 // Unreachable code detected
                return;

#pragma warning restore CS0162 // Unreachable code detected
            }
            try {
                epView         = new MainEpisodeView();
                BindingContext = epView;

                BackgroundColor = Settings.BlackRBGColor;

                MovieTypePicker = new LabelList(MovieTypePickerBtt, genresNames)
                {
                    SelectedIndex = 0
                };

                MovieTypePicker.SelectedIndexChanged += (o, e) => {
                    ClearEpisodes(!IsRecommended);
                    if (IsRecommended)
                    {
                        CoreHelpers.Shuffle(iMDbTopList);
                        LoadMoreImages();
                    }
                    else
                    {
                        mainCore.PurgeThreads(21);
                        Fething = false;
                        GetFetch();
                    }
                };

                double lastScroll = 0;

                episodeView.Scrolled += (o, e) => {
                    MovieTypePickerBttScrollY -= lastScroll - e.ScrollY;
                    lastScroll = e.ScrollY;

                    if (MovieTypePickerBttScrollY > MovieTypePickerBttMinScrollY)
                    {
                        MovieTypePickerBttScrollY = MovieTypePickerBttMinScrollY;
                    }
                    else if (MovieTypePickerBttScrollY < 0)
                    {
                        MovieTypePickerBttScrollY = 0;
                    }

                    MovieTypePickerBtt.TranslationY = MovieTypePickerBttScrollY;

                    double maxY = episodeView.HeightRequest - episodeView.Height;
                    //print(maxY);
                    if (e.ScrollY >= maxY - 200)
                    {
                        LoadMoreImages();
                    }
                };


                if (Device.RuntimePlatform == Device.UWP)
                {
                    // BlueSeperator.IsVisible = false;
                    // BlueSeperator.IsEnabled = false;
                    OffBar.IsVisible = false;
                    OffBar.IsEnabled = false;
                }
                else
                {
                    OffBar.Source = App.GetImageSource("gradient.png"); OffBar.HeightRequest = 3; OffBar.HorizontalOptions = LayoutOptions.Fill; OffBar.ScaleX = 100; OffBar.Opacity = 0.3;
                }

                episodeView.VerticalScrollBarVisibility = Settings.ScrollBarVisibility;
            }
            catch (Exception _ex) {
                error(_ex);
            }

            /*
             * ImageScroller.Scrolled += (o, e) => {
             * double maxY = ImageScroller.ContentSize.Height - ImageScroller.Height;
             * if (e.ScrollY >= maxY - 200) {
             * LoadMoreImages();
             * }
             *
             * };*/
        }
Exemplo n.º 4
0
        public Home()
        {
            InitializeComponent();
            epView         = new MainEpisodeView();
            BindingContext = epView;

            BackgroundColor = Settings.BlackRBGColor;

            MovieTypePicker = new LabelList(MovieTypePickerBtt, genresNames);
            ImdbTypePicker  = new LabelList(ImdbTypePickerBtt, recomendationTypes);

            // MovieTypePicker.ItemsSource = genresNames;
            // ImdbTypePicker.ItemsSource = recomendationTypes;
            //   UpdateBookmarks();

            MovieTypePicker.SelectedIndex = 0;
            ImdbTypePicker.SelectedIndex  = -1;



            ImdbTypePicker.SelectedIndexChanged += (o, e) => {
                ClearEpisodes();
                PurgeThreds(21);
                Fething = false;
                if (IsRecommended)
                {
                    GetFetchRecomended();
                }
                else
                {
                    GetFetch();
                }
                //    ImdbTypePickerBtt.Text = ImdbTypePicker.Items[ImdbTypePicker.SelectedIndex];
            };

            // MovieTypePickerBtt.Text = MovieTypePicker.Items[MovieTypePicker.SelectedIndex];

            MovieTypePicker.SelectedIndexChanged += (o, e) => {
                ClearEpisodes(!IsRecommended);
                if (IsRecommended)
                {
                    CloudStreamCore.Shuffle(iMDbTopList);
                    LoadMoreImages();
                }
                else
                {
                    PurgeThreds(21);
                    Fething = false;
                    GetFetch();
                }
                //    MovieTypePickerBtt.Text = MovieTypePicker.Items[MovieTypePicker.SelectedIndex];
                //GetFetchRecomended
                //  print(MovieTypePicker.SelectedIndex + "<<Selected");
            };

            episodeView.Scrolled += (o, e) => {
                double maxY = episodeView.HeightRequest - episodeView.Height;
                //print(maxY);
                if (e.ScrollY >= maxY - 200)
                {
                    LoadMoreImages();
                }
            };


            if (Device.RuntimePlatform == Device.UWP)
            {
                // BlueSeperator.IsVisible = false;
                // BlueSeperator.IsEnabled = false;
                OffBar.IsVisible = false;
                OffBar.IsEnabled = false;
            }
            else
            {
                OffBar.Source = App.GetImageSource("gradient.png"); OffBar.HeightRequest = 3; OffBar.HorizontalOptions = LayoutOptions.Fill; OffBar.ScaleX = 100; OffBar.Opacity = 0.3; OffBar.TranslationY = 9;
            }

            episodeView.VerticalScrollBarVisibility = Settings.ScrollBarVisibility;

            /*
             * ImageScroller.Scrolled += (o, e) => {
             *  double maxY = ImageScroller.ContentSize.Height - ImageScroller.Height;
             *  if (e.ScrollY >= maxY - 200) {
             *      LoadMoreImages();
             *  }
             *
             * };*/

            // MovieTypePicker.IsEnabled = false;
            //MovieTypePicker.IsVisible = false;
        }