示例#1
0
        [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("");
            }
        }
示例#2
0
 public void ClearMirror()
 {
     CloudStreamCore.ClearCachedLink(IMDBEpisodeId);
 }