Exemple #1
0
        public static async Task <string> GetCommonCss(string sourceUrl, bool process, bool setNext = true, string videoCssUrl = "", string bootstrapCssUrl = "")
        {
            string c = await ExtWebInterface.GetHtmlTextFromUrl(sourceUrl);

            c = await GetOverrideCss(c);

            if (videoCssUrl != "")
            {
                string videoCss = await ExtWebInterface.GetTextResponseWithGenericClient(videoCssUrl);
                await GetVideoCss(videoCss);
            }
            if (bootstrapCssUrl != "")
            {
                string bootstrapCss = await ExtWebInterface.GetTextResponseWithGenericClient(bootstrapCssUrl);
                await GetBootStrapCss(bootstrapCss);
            }
            if (setNext)
            {
                //await GetSearchCss(SearchCssUrl);
                await GetFeedCommonCss();
                await GetMyChannelCommonCss();
                await GetSettingsCommonCss();
            }
            CustomCssReadyForRead = true;
            return(c);
        }
 public static async void InitializeVideoDownload(string videoLink)
 {
     if (!VideoDownloadInProgress)
     {
         try
         {
             ViewHelpers.Tab3.DownloadProgressTextView.Text = "Getting permissions";
             if (!FileBrowser.GetExternalPermissions())
             {
                 return;
             }
             VideoDownloadInProgress = true;
             VideoDownloader _vd = new VideoDownloader();
             if (videoLink != null && videoLink != "")
             {
                 ViewHelpers.Tab3.DownloadProgressTextView.Text = "Getting video link";
                 Task <string>    rawHtmlTask   = ExtWebInterface.GetHtmlTextFromUrl(videoLink);
                 var              html          = await rawHtmlTask;
                 Task <VideoCard> videoCardTask = _vd.DecodeHtmlVideoSource(html);
                 var              vidCard       = await videoCardTask;
                 if ((vidCard).VideoUri.AbsolutePath == "" ||
                     (vidCard).VideoUri.AbsolutePath == null)
                 {
                     ViewHelpers.Tab3.DownloadProgressTextView.Text = LanguageSupport.Main.IO.VideoSourceMissing();
                     Toast.MakeText(Android.App.Application.Context, LanguageSupport.Main.IO.VideoSourceMissing(), ToastLength.Long);
                     VideoDownloadInProgress = false;
                     return;
                 }
                 Task <bool> videoDownloadComplete = _vd.DownloadAndSaveVideo(vidCard);
                 await       videoDownloadComplete;
             }
             else
             {
                 await _vd.DownloadAndSaveVideo(null);
             }
         }
         catch (Exception ex)
         {
             VideoDownloadInProgress = false;
             ViewHelpers.Tab3.DownloadProgressTextView.Text = $"An error occured : {ex.Message} ";
         }
     }
     else
     {
         try
         {
             ViewHelpers.Tab3.DownloadProgressTextView.Text = "Video download already in progress, stop it first";
             Toast.MakeText(Android.App.Application.Context, "Video download already in progress, stop it first", ToastLength.Long);
         }
         catch { }
     }
 }
Exemple #3
0
        public static async Task <string> GetSearchCss(string url = null)
        {
            if (SearchCss == "" || SearchCss == null)
            {
                SearchCss = await ExtWebInterface.GetHtmlTextFromUrl(url);
            }

            Task <string> fct = Task.FromResult <string>(SearchCss
                                                         .Replace(@"""", @"'")
                                                         .Replace(Strings.VidResultImageOrg, Strings.VidResultImageNew)
                                                         .Replace(Strings.VidResultImageContOrg, Strings.VidResultImageContNew)
                                                         .Replace(Strings.ResultListImgContOrg, Strings.ResultListImgContNew)
                                                         .Replace(Strings.VidResultTextOrg, Strings.VidResultTextNew)
                                                         .Replace(Strings.VidResultTextContainerOrg, Strings.VidResultTextContainerNew)
                                                         .Replace("270px", "100%")
                                                         .Replace(@"[max-width~='592px']", "")
                                                         );

            SearchCss = await fct; return(SearchCss);
        }