Ejemplo n.º 1
0
        public async Task TestRealStreetAngels()
        {
            var info = await RealStreetAngels.GetInfo("m407_misa");

            Trace.WriteLine(info.Title);
            info = await RealStreetAngels.GetInfo("m410_hibiki");

            Trace.WriteLine(info.Title);

            Assert.IsTrue(!string.IsNullOrEmpty(info.Title));
        }
Ejemplo n.º 2
0
        public async Task WriteOutput(string megaLinks, string rgLinks)
        {
            string imageCode     = null;
            string imageCodeBlog = null;
            var    isUncensored  = VideoInfo.IsUncensored(id);
            var    megaBackup    = megaLinks;
            var    rgBackup      = rgLinks;

            var outputId = id;

            if (!isUncensored && !RealStreetAngels.Match(id) && !SiroutoDouga.Match(id))
            {
                outputId = id.ToUpper();
                int dash = 0;
                for (int i = 0; i < outputId.Length - 1; i++)
                {
                    if (char.IsLetter(outputId[i]))
                    {
                        if (!char.IsDigit(outputId[i + 1]))
                        {
                            continue;
                        }
                        dash = i + 1;
                    }
                }
                if (dash > 0)
                {
                    outputId = outputId.Insert(dash, "-");
                }
            }

            var flinks = new Dictionary <int, string>
            {
                { 0, ForumLinks1 },
                { 1, ForumLinks2 },
                { 2, ForumLinks3 },
                //{ 3, ForumLinks4 },
            };
            var wlinks = new Dictionary <int, string>
            {
                { 0, WebLinks1 },
                { 1, WebLinks2 },
                { 2, WebLinks3 },
                //{ 3, WebLinks4 },
            };

            if (flinks.Count(p => !string.IsNullOrEmpty(p.Value)) == 1 || wlinks.Count(p => !string.IsNullOrEmpty(p.Value)) == 1)
            {
                imageCode     = flinks.First().Value;
                imageCodeBlog = wlinks.First().Value;
            }
            else
            {
                var fIndex = imageHostIndex % flinks.Count;
                var wIndex = fIndex < flinks.Count - 1 ? fIndex + 1 : 0;

                imageCode     = flinks[fIndex];
                imageCodeBlog = wlinks[wIndex];

                if (string.IsNullOrEmpty(imageCode) || string.IsNullOrEmpty(imageCodeBlog))
                {
                    imageCode = flinks.Where(l => !string.IsNullOrEmpty(l.Value)).Select(l => l.Value).Random();
                    var imgCodeIndex = flinks.FirstOrDefault(l => l.Value == imageCode).Key;
                    imageCodeBlog = wlinks.Where(l => l.Key != imgCodeIndex && !string.IsNullOrEmpty(l.Value)).Select(l => l.Value).Random();
                }
            }

            imageHostIndex++;

            try
            {
                string filePath   = null;
                string uploadPath = null;

                foreach (var path in UploadPaths)
                {
                    if (!Directory.Exists(path))
                    {
                        continue;
                    }
                    filePath =
                        Directory.GetFiles(path, string.Format("{0}*.part*.rar", id), SearchOption.TopDirectoryOnly)
                        .FirstOrDefault();
                    if (filePath == null)
                    {
                        continue;
                    }
                    uploadPath = path;
                    break;
                }

                string fileFormat = null, fileSize = null;
                if (!string.IsNullOrEmpty(filePath) && !string.IsNullOrEmpty(uploadPath))
                {
                    fileFormat = VideoUtil.GetFileFormat(filePath);
                    fileSize   = VideoUtil.GetFileSizeGB(uploadPath, id) + "GB";
                }

                var ouoShortening = urlShortenings.First(u => u.Name == "Ouo");
                megaLinks = await ShortenFirstLink(ouoShortening, megaLinks);

                if (rgLinks.Contains("zippyshare"))
                {
                    var eraShortening = urlShortenings.First(u => u.Name == "ERA.AC");
                    rgLinks = await ShortenFirstLink(eraShortening, rgLinks);
                }

                string links1 = null, links2 = null;
                switch (rnd.Next(0, 1000) % 2)
                {
                case 0:
                    links1 = megaLinks;
                    links2 = rgLinks;
                    break;

                case 1:
                    links1 = rgLinks;
                    links2 = megaLinks;
                    break;
                }

                var content = string.Empty;
                content  = string.Format("{0}\\nor\\n{1}", links1, links2);
                content += "\\n\\nAll links are interchangeable and no password.";
                content  = content.Replace("\\n", "<br />");

                var contentBackup = string.Format("{0}\\nor\\n{1}", megaBackup, rgBackup);
                contentBackup += "\\n\\nAll links are interchangeable and no password.";
                contentBackup  = contentBackup.Replace("\\n", "<br />");

                var linksBackup = new LinksBackup
                {
                    Id    = id,
                    Links = contentBackup,
                };

                var linksPage      = Blogger.CreateLinksPost(content);
                var shortenedLinks = new List <string>();
                if (string.IsNullOrEmpty(linksPage))
                {
                    await
                    GenerateOutput(outputId, fileSize, fileFormat, imageCode, imageCodeBlog, linksPage, linksBackup, isUncensored, shortenedLinks);
                }
                else
                {
                    var firstShortenedLink = linksPage;
                    if (isUncensored)
                    {
                        firstShortenedLink = await ouoShortening.GetLink(linksPage);
                    }

                    foreach (var urlShortening in urlShortenings.Where(u => u.Enabled))
                    {
                        var shortenedLink = await urlShortening.GetLink(firstShortenedLink);

                        if (!string.IsNullOrEmpty(shortenedLink))
                        {
                            shortenedLinks.Add(shortenedLink);
                        }
                    }

                    await
                    GenerateOutput(outputId, fileSize, fileFormat, imageCode, imageCodeBlog, linksPage, linksBackup, isUncensored, shortenedLinks);
                }

                GenerateJavLibrary(shortenedLinks.Where(l => !l.Contains("shink")), fileSize, fileFormat, imageCode);
                GenerateWestern(shortenedLinks, fileSize, fileFormat, imageCode);
                GeneratePornBB(shortenedLinks, fileSize, fileFormat, imageCode);
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.Message, ex);
            }
        }