public static async Task <bool> PostDataAboutId(int id, AniListStatusType type, int score, int progress) { const string q = @"mutation ($id: Int, $status: MediaListStatus, $scoreRaw: Int, $progress: Int) { SaveMediaListEntry (mediaId: $id, status: $status, scoreRaw: $scoreRaw, progress: $progress) { id status progress score } }&variables={ ""id"": {0}, ""status"":""{1}"", ""scoreRaw"":{2}, ""progress"":{3} }" ; try { var fullQ = ($"&query={q}") .Replace("{0}", id.ToString()) .Replace("{1}", AniListStatusString[(int)type]) .Replace("{2}", (score * 10).ToString()) .Replace("{3}", progress.ToString()); CloudStreamCore.print(fullQ); var data = await PostApi("https://graphql.anilist.co", fullQ ); //"{\"data\":{\"SaveMediaListEntry\":{\"id\":144884500,\"status\":\"PLANNING\",\"progress\":8,\"score\":7}}}" return(data != ""); } catch (Exception) { return(false); } }
public YugenaniBFProvider(CloudStreamCore _core) : base(_core) { if (Settings.IsProviderActive(Name)) { baseProvider = new YugenaniBaseProvider(); } }
public static async Task <AniListTitleHolder?> GetDataAboutId(int id) { const string q = @"query ($id: Int) { # Define which variables will be used in the query (id) Media (id: $id, type: ANIME) { # Insert our variables into the query arguments (id) (type: ANIME is hard-coded in the query) #id isFavourite mediaListEntry { progress status score (format: POINT_10) } } }&variables={ ""id"":""{0}"" }" ; try { var data = await PostApi("https://graphql.anilist.co", ($"&query={q}").Replace("{0}", id.ToString())); GetDataRoot d = JsonConvert.DeserializeObject <GetDataRoot>(data); var main = d.data.Media; CloudStreamCore.print(data); return(new AniListTitleHolder() { id = id, isFavourite = main.isFavourite, progress = main.mediaListEntry.progress, score = main.mediaListEntry.score, type = (AniListStatusType)AniListStatusString.IndexOf(main.mediaListEntry.status), }); } catch (Exception) { return(null); } }
public static async Task <string> PostRequest(string postdata, DataUpdate _type) { try { string url = Settings.PublishDatabaseServerIp; CloudStreamCore.print("PUBLISHIP: " + url); int waitTime = 400; HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(url); if (CloudStreamCore.GetRequireCert(url)) { webRequest.ServerCertificateValidationCallback = delegate { return(true); }; } webRequest.Method = "POST"; webRequest.UserAgent = "CLOUDSTREAM APP v" + App.GetBuildNumber(); webRequest.Timeout = waitTime * 10; webRequest.ReadWriteTimeout = waitTime * 10; webRequest.ContinueTimeout = waitTime * 10; webRequest.Headers.Add("TYPE", ((int)_type).ToString()); try { HttpWebRequest _webRequest = webRequest; Stream postStream = await _webRequest.GetRequestStreamAsync(); string requestBody = postdata; // --- RequestHeaders --- byte[] byteArray = Encoding.UTF8.GetBytes(requestBody); postStream.Write(byteArray, 0, byteArray.Length); postStream.Close(); // BEGIN RESPONSE try { HttpWebRequest request = webRequest; HttpWebResponse response = (HttpWebResponse)(await webRequest.GetResponseAsync()); using StreamReader httpWebStreamReader = new StreamReader(response.GetResponseStream()); try { string s = await httpWebStreamReader.ReadToEndAsync(); CloudStreamCore.print("RESPONSEF FROM POST::: " + s); } catch (Exception) { return(""); } } catch (Exception _ex) { CloudStreamCore.error("FATAL EX IN POST2: " + _ex); } } catch (Exception _ex) { CloudStreamCore.error("FATAL EX IN POSTREQUEST" + _ex); } return(""); } catch (Exception _ex) { CloudStreamCore.error(_ex); return(""); } }
public void Init() { core = new CloudStreamCore(); var _pickers = App.GetEnumList <PickerType>(); pickers = new PickerInfo[_pickers.Count]; for (int i = 0; i < _pickers.Count; i++) { pickers[i] = new PickerInfo() { picker = _pickers[i], index = 0, isVisible = false, source = new List <string>(), }; } var _labels = App.GetEnumList <LabelType>(); labels = new LabelInfo[_labels.Count]; for (int i = 0; i < _labels.Count; i++) { labels[i] = new LabelInfo() { isVisible = true, label = _labels[i], text = "" }; } var _buttons = App.GetEnumList <ButtonType>(); buttons = new ButtonInfo[_buttons.Count]; for (int i = 0; i < _buttons.Count; i++) { buttons[i] = new ButtonInfo() { text = "", isVisible = false, button = _buttons[i] }; } core.FishProgressLoaded += (o, e) => { if (IsDead) { return; } if (!hasSkipedLoading) { ChangeText(ButtonType.SkipAnimeBtt, $"Skip - {e.currentProgress} of {e.maxProgress}"); if (e.progressProcentage >= 1) { hasSkipedLoading = true; ChangeText(ButtonType.SkipAnimeBtt, null); } } }; core.TitleLoaded += Core_titleLoaded; core.EpisodeHalfLoaded += EpisodesHalfLoaded; core.EpisodeLoaded += Core_episodeLoaded; core.MalDataLoaded += Core_malDataLoaded; }
static Guid GenerateCore() { CloudStreamCore _core = new CloudStreamCore(); Guid _guid = Guid.NewGuid(); cores.Add(_guid, _core); return(_guid); }
public static void OpenBrowser(string url) { CloudStreamCore.print("Trying to open: " + url); if (CloudStreamCore.CheckIfURLIsValid(url)) { try { Launcher.OpenAsync(new Uri(url)); } catch (Exception) { CloudStreamCore.print("BROWSER LOADED ERROR, SHOULD NEVER HAPPEND!!"); } } }
public static async Task <string> _PostRequest(string postdata, DataUpdate _type) { try { string url = Settings.PublishDatabaseServerIp; CloudStreamCore.print("PUBLISHIP: " + url); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = "POST"; byte[] byteArray = Encoding.UTF8.GetBytes(postdata); request.ContentType = "application/json"; request.ContentLength = byteArray.Length; request.Headers.Add("TYPE", ((int)_type).ToString()); Stream dataStream = await request.GetRequestStreamAsync(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); WebResponse response = await request.GetResponseAsync(); dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = await reader.ReadToEndAsync(); reader.Close(); dataStream.Close(); response.Close(); return(responseFromServer); } catch (WebException e) { CloudStreamCore.error(e); try { using (WebResponse response = e.Response) { HttpWebResponse httpResponse = (HttpWebResponse)response; Console.WriteLine("Error code: {0}", httpResponse.StatusCode); using Stream data = response.GetResponseStream(); using var reader = new StreamReader(data); string text = reader.ReadToEnd(); Console.WriteLine(text); } return(""); } catch (Exception _ex) { CloudStreamCore.error(_ex); return(""); } } catch (Exception _ex) { CloudStreamCore.error(_ex); return(""); } }
public List <CloudStreamCore.BasicLink> GetBasicLinks() { var val = CloudStreamCore.GetCachedLink(IMDBEpisodeId); if (val == null) { return(new List <CloudStreamCore.BasicLink>()); } if (val.Value.links.Count == 0) { return(new List <CloudStreamCore.BasicLink>()); } return(val.Value.links.OrderBy(t => - t.priority).ToList()); }
public string DownloadUrl(string url, string fileName, bool mainPath, string extraPath, string toast = "", bool isNotification = false, string body = "") { try { string basePath = GetPath(mainPath, extraPath); CloudStreamCore.print(basePath); Java.IO.File _file = new Java.IO.File(basePath); _file.Mkdirs(); basePath += "/" + CensorFilename(fileName); CloudStreamCore.print(basePath); //webClient.DownloadFile(url, basePath); using (WebClient wc = new WebClient()) { wc.DownloadProgressChanged += (o, e) => { App.OnDownloadProgressChanged(basePath, e); /* * if (e.ProgressPercentage == 100) { * App.ShowToast("Download Successful"); * //OpenFile(basePath); * }*/ // print(e.ProgressPercentage + "|" + basePath); }; wc.DownloadFileCompleted += (o, e) => { if (toast != "") { if (isNotification) { App.ShowNotification(toast, body); } else { App.ShowToast(toast); } } }; wc.DownloadFileAsync( // Param1 = Link of file new System.Uri(url), // Param2 = Path to save basePath ); } } catch (Exception) { App.ShowToast("Download Failed"); return(""); } return(GetPath(mainPath, extraPath) + "/" + CensorFilename(fileName)); }
public ShiroBaseProvider(CloudStreamCore _core, string siteUrl, string name, bool isMovie) : base(_core) { _siteUrl = siteUrl; _name = name; _isMovieProvider = isMovie; if (!loadingToken.ContainsKey(_name)) { loadingToken.Add(_name, true); _core.StartThread("Shiro TokenThread", () => { tokens[_name] = GetShiroToken(); }); } }
[HttpGet] //use or not works same //[ValidateAntiForgeryToken] public async Task <string> GetLoadLinks(int episode, int season, int delay, string guid, bool isDub, bool reloadAllLinks) { try { error("TRYLOAD"); var core = CoreHolder.GetCore(guid); if (core == null) { return(""); } const int maxDelay = 60000; if (delay > maxDelay) { delay = maxDelay; } int normalEpisode = episode == -1 ? 0 : episode - 1; bool isMovie = core.activeMovie.title.IsMovie; string id = isMovie ? core.activeMovie.title.id : core.activeMovie.episodes[normalEpisode].id; if (delay > 0) { if (reloadAllLinks) { CloudStreamCore.ClearCachedLink(id); } core.GetEpisodeLink(episode, season, isDub: isDub); await Task.Delay(delay); } if (core.activeMovie.episodes == null && !isMovie) { return(""); } var _link = CloudStreamCore.GetCachedLink(id).Copy(); if (_link.HasValue) { var json = JsonConvert.SerializeObject(_link); return(json); } else { return("no links"); } } catch { return(""); } }
public static void SetKey(string folder, string name, object value) { string path = GetKeyPath(folder, name); string _set = ConvertToString(value); if (myApp.Properties.ContainsKey(path)) { CloudStreamCore.print("CONTAINS KEY"); myApp.Properties[path] = _set; } else { CloudStreamCore.print("ADD KEY"); myApp.Properties.Add(path, _set); } }
public static async void AuthenticateLogin(string data) { try { string token = CloudStreamCore.FindHTML(data + "&", "access_token=", "&"); string expires_in = CloudStreamCore.FindHTML(data + "&", "expires_in=", "&"); Settings.AniListTokenUnixTime = CloudStreamCore.UnixTime + int.Parse(expires_in); Settings.AniListToken = token; await GetUser(); App.SaveData(); App.ShowToast("Login complete"); } catch (Exception) { App.ShowToast("Login failed"); } }
public static async Task <string> PostRequest(string url, string postdata, string rtype = "POST", string auth = null, string content = "application/x-www-form-urlencoded") { try { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = rtype; if (auth.IsClean()) { request.Headers["Authorization"] = auth; } byte[] byteArray = Encoding.UTF8.GetBytes(postdata); request.ContentType = content; request.ContentLength = byteArray.Length; Stream dataStream = await request.GetRequestStreamAsync(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); WebResponse response = await request.GetResponseAsync(); dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = await reader.ReadToEndAsync(); reader.Close(); dataStream.Close(); response.Close(); return(responseFromServer); } catch (WebException e) { using (WebResponse response = e.Response) { HttpWebResponse httpResponse = (HttpWebResponse)response; Console.WriteLine("Error code: {0}", httpResponse.StatusCode); using (Stream data = response.GetResponseStream()) using (var reader = new StreamReader(data)) { string text = reader.ReadToEnd(); Console.WriteLine(text); } } return(""); } catch (Exception _ex) { CloudStreamCore.error(_ex); return(""); } }
public static T GetKey <T>(string path, T defVal) { try { if (myApp.Properties.ContainsKey(path)) { CloudStreamCore.print("GETKEY::" + myApp.Properties[path]); CloudStreamCore.print("GETKEY::" + typeof(T).ToString() + "||" + ConvertToObject <T>(myApp.Properties[path] as string, defVal)); return((T)ConvertToObject <T>(myApp.Properties[path] as string, defVal)); } else { return(defVal); } } catch (Exception) { return(defVal); } }
public static async Task <string> GetRequest(string url, string auth = null) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; request.Method = "GET"; if (auth.IsClean()) { request.Headers["Authorization"] = auth; } request.ContentType = "text/html; charset=UTF-8"; request.UserAgent = CloudStreamCore.USERAGENT; request.Headers.Add("Accept-Language", "en-US,en;q=0.5"); request.Headers.Add("Accept-Encoding", "gzip, deflate"); request.Headers.Add("TE", "Trailers"); using HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync(); using Stream stream = response.GetResponseStream(); using StreamReader reader = new StreamReader(stream, Encoding.UTF8); string result = await reader.ReadToEndAsync(); return(result); } catch (WebException e) { using (WebResponse response = e.Response) { HttpWebResponse httpResponse = (HttpWebResponse)response; Console.WriteLine("Error code: {0}", httpResponse.StatusCode); using (Stream data = response.GetResponseStream()) using (var reader = new StreamReader(data)) { string text = reader.ReadToEnd(); Console.WriteLine(text); } } return(""); } catch (Exception _ex) { CloudStreamCore.error(_ex); return(""); } }
public static async Task <AniListUser?> GetUser(bool setSettings = true) { try { const string q = @" { Viewer { id name avatar { large } } }" ; var data = await PostApi("https://graphql.anilist.co", $"&query={q}"); if (!data.IsClean()) { return(null); } AniListRoot userData = JsonConvert.DeserializeObject <AniListRoot>(data); var u = userData.data.Viewer; var user = new AniListUser() { id = u.id, name = u.name, picture = u.avatar.large, }; if (setSettings) { Settings.CurrentAniListUser = user; } App.SaveData(); return(user); } catch (Exception _ex) { CloudStreamCore.error(_ex); return(null); } }
public static Java.IO.File WriteFile(string name, string basePath, string write) { try { File.Delete(basePath + "/" + name); } catch (System.Exception) { } //name = Regex.Replace(name, @"[^A-Za-z0-9\.]+", String.Empty); //name.Replace(" ", ""); // name = name.ToLower(); Java.IO.File file = new Java.IO.File(basePath, name); Java.IO.File _file = new Java.IO.File(basePath); CloudStreamCore.print("PATH: " + basePath + "/" + name); _file.Mkdirs(); file.CreateNewFile(); Java.IO.FileWriter writer = new Java.IO.FileWriter(file); // Writes the content to the file writer.Write(write); writer.Flush(); writer.Close(); return(file); }
public static async Task OpenPathsAsVideo(List <string> path, List <string> name, string subtitleLoc) { string absolutePath = Android.OS.Environment.ExternalStorageDirectory + "/" + Android.OS.Environment.DirectoryDownloads; CloudStreamCore.print("AVS: " + absolutePath); bool subtitlesEnabled = subtitleLoc != ""; string writeData = CloudStreamForms.App.ConvertPathAndNameToM3U8(path, name, subtitlesEnabled, "content://" + absolutePath + "/"); Java.IO.File subFile = null; WriteFile(CloudStreamForms.App.baseM3u8Name, absolutePath, writeData); if (subtitlesEnabled) { subFile = WriteFile(CloudStreamForms.App.baseSubtitleName, absolutePath, subtitleLoc); } // await Task.Delay(5000); Device.BeginInvokeOnMainThread(() => { // OpenPathAsVideo(path.First(), name.First(), ""); OpenVlcIntent(absolutePath + "/" + CloudStreamForms.App.baseM3u8Name, absolutePath + "/" + App.baseSubtitleName); }); }
public FilesClubProvider(CloudStreamCore _core) : base(_core) { }
public AnimeSimpleBloatFreeProvider(CloudStreamCore _core) : base(_core) { }
public ArrayAnimeProvider(CloudStreamCore _core) : base(_core) { }
public TheMovieMovieBFProvider(CloudStreamCore _core) : base(_core) { }
static string GetPoster(string _poster) { return(CloudStreamCore.ConvertIMDbImagesToHD(_poster, 2240, 1260, 1, false, true)); }
public async Task <string> LoadPlayer(int episode, string player, string guid) { try { await Task.Delay(100); if (!CloudStreamElectron.Startup.isElectron) { return("is not electron"); } var core = CoreHolder.GetCore(guid); if (core == null) { return("invalid core"); } int normalEpisode = episode == -1 ? 0 : episode - 1; bool isMovie = core.activeMovie.title.IsMovie; var cEpisode = core.activeMovie.episodes[normalEpisode]; string id = isMovie ? core.activeMovie.title.id : cEpisode.id; var _link = CloudStreamCore.GetCachedLink(id).Copy(); if (_link == null) { return("no links"); } var endPath = Path.Combine(Directory.GetCurrentDirectory(), baseM3u8Name); if (System.IO.File.Exists(endPath)) { System.IO.File.Delete(endPath); } var links = _link.Value.links.Where(t => !t.isAdvancedLink); System.IO.File.WriteAllText(endPath, ConvertPathAndNameToM3U8(links.Select(t => t.baseUrl).ToList(), links.Select(t => t.PublicName).ToList())); string argu = ""; if (player == "vlc") { argu = $"--fullscreen --no-loop vlc://quit"; } else if (player == "mpv") { argu = $"--title=\"{(isMovie ? core.activeMovie.title.name : cEpisode.name)}\""; } if (IsLinux) { $"{player} \"{endPath}\" {argu}".Bash(false); } else if (IsWindows) { if (player == "mpv") { //$"{player} \"{endPath}\" {argu}".Cmd(); $"\"{endPath}\" {argu}".CmdCommand(@"mpv.exe"); } else if (player == "vlc") { $"\"{endPath}\" {argu}".CmdCommand(@"C:\Program Files\VideoLAN\VLC\vlc.exe"); } } return("true"); } catch (Exception _ex) { error(_ex); return(_ex.Message); } }
public AnimeParadiseProvider(CloudStreamCore _core) : base(_core) { }
public ChromeCastPage(ChromecastData data) { currentChromeData = data; isActive = true; //episodeResult = MovieResult.chromeResult; // chromeMovieResult = MovieResult.chromeMovieResult; InitializeComponent(); if (lastId != currentChromeData.episodeId) //chromeMovieResult.title.id) { { lastId = currentChromeData.episodeId; //chromeMovieResult.title.id; subtitles = new List <Subtitle>(); subtitleDelay = 0; subtitleIndex = -1; HasSubtitlesOn = false; print("NOT THE SAME AT LAST ONE"); if (globalSubtitlesEnabled) { PopulateSubtitle(); } } else { //subtitles = lastSubtitles; } Subbutton.Source = App.GetImageSource("outline_subtitles_white_48dp.png"); BindingContext = this; TitleName = currentChromeData.titleName; //chromeMovieResult.title.name; EpisodeTitleName = currentChromeData.episodeTitleName; //episodeResult.Title; PosterUrl = CloudStreamCore.ConvertIMDbImagesToHD(currentChromeData.hdPosterUrl, 150, 225); //chromeMovieResult.title.hdPosterUrl, 150, 225); EpisodePosterUrl = currentChromeData.episodePosterUrl; //episodeResult.PosterUrl; EpisodeDescription = currentChromeData.descript; //episodeResult.Description; BackgroundColor = Settings.BlackRBGColor; // CloudStreamForms.MainPage.mainPage.BarBackgroundColor = Color.Transparent; ChromeLabel.Text = "Connected to " + MainChrome.chromeRecivever.FriendlyName; try { DescriptName = DescriptSetName;// currentChromeData.MirrorsNames[currentSelected];//episodeResult.Mirros[currentSelected]; } catch (Exception _ex) { print("ERROR LOADING MIRROR " + _ex); } //https://material.io/resources/icons/?style=baseline VideoSlider.DragStarted += (o, e) => { draging = true; }; VideoSlider.DragCompleted += (o, e) => { MainChrome.SetChromeTime(VideoSlider.Value * CurrentCastingDuration); draging = false; UpdateTxt(); }; const bool rotateAllWay = false; const int rotate = 90; const int time = 100; Commands.SetTap(FastForwardBtt, new Command(async() => { SeekMedia(FastForwardTime); FastForward.Rotation = 0; if (rotateAllWay) { await FastForward.RotateTo(360, 200, Easing.SinOut); } else { FastForward.ScaleTo(0.9, time, Easing.SinOut); await FastForward.RotateTo(rotate, time, Easing.SinOut); FastForward.ScaleTo(1, time, Easing.SinOut); await FastForward.RotateTo(0, time, Easing.SinOut); } })); Commands.SetTap(BackForwardBtt, new Command(async() => { SeekMedia(-BackForwardTime); BackForward.Rotation = 0; if (rotateAllWay) { await BackForward.RotateTo(-360, 200, Easing.SinOut); } else { BackForward.ScaleTo(0.9, time, Easing.SinOut); await BackForward.RotateTo(-rotate, time, Easing.SinOut); BackForward.ScaleTo(1, time, Easing.SinOut); await BackForward.RotateTo(0, time, Easing.SinOut); } })); StopAll.Clicked += (o, e) => { // MainChrome.StopCast(); JustStopVideo(); OnStop(); }; if (currentChromeData.isFromFile) { UpperIconHolder.TranslationX = 20; LowerIconHolder.ColumnSpacing = 40; PlayList.IsEnabled = false; PlayList.IsVisible = false; SkipForward.IsEnabled = false; SkipForward.IsVisible = false; SkipBack.IsEnabled = false; SkipBack.IsVisible = false; Grid.SetColumn(Subbutton, 0); Grid.SetColumn(StopAll, 1); Grid.SetColumn(Audio, 2); if (currentChromeData.movieType == MovieType.YouTube) { Subbutton.IsEnabled = false; Subbutton.Opacity = 0; //TODO Add youtube subtitles download } } else { PlayList.Clicked += async(o, e) => { //ListScale(); string a = await ActionPopup.DisplayActionSheet("Select Mirror", currentChromeData.MirrorsNames.ToArray()); //await DisplayActionSheet("Select Mirror", "Cancel", null, episodeResult.Mirros.ToArray()); //ListScale(); for (int i = 0; i < currentChromeData.MirrorsNames.Count; i++) { if (a == currentChromeData.MirrorsNames[i]) { currentSelected = i; SelectMirror(); return; } } }; SkipForward.Clicked += async(o, e) => { currentSelected++; if (currentSelected > currentChromeData.MirrorsNames.Count) { currentSelected = 0; } SelectMirror(); await SkipForward.TranslateTo(6, 0, 50, Easing.SinOut); await SkipForward.TranslateTo(0, 0, 50, Easing.SinOut); }; SkipBack.Clicked += async(o, e) => { currentSelected--; if (currentSelected < 0) { currentSelected = currentChromeData.MirrorsNames.Count - 1; } SelectMirror(); await SkipBack.TranslateTo(-6, 0, 50, Easing.SinOut); await SkipBack.TranslateTo(0, 0, 50, Easing.SinOut); }; } ConstUpdate(); MainChrome.Volume = (MainChrome.Volume); /* * LowVol.Source = GetImageSource("round_volume_down_white_48dp.png"); * MaxVol.Source = GetImageSource("round_volume_up_white_48dp.png");*/ // UserDialogs.Instance.TimePrompt(new TimePromptConfig() { CancelText = "Cancel", Title = "da", Use24HourClock = false, OkText = "OK", IsCancellable = true }); }
public MonkeyStreamProvider(CloudStreamCore _core) : base(_core) { }
public AnimeFeverHelper(CloudStreamCore _core) { core = _core; }