示例#1
0
            public static string FullInfo(TV.TVObject tv)
            {
                TV.Data Data = tv.data;
                string  res  = $"📺 {Data.nameRu ?? Data.nameEn} ({Data.year})";

                if (tv.rating.rating.HasValue)
                {
                    if (tv.rating.rating.Value != 0)
                    {
                        res += $"\n⭐ {tv.rating.rating.Value}";
                    }
                    else if (tv.rating.ratingAwait != null)
                    {
                        res += $"\n🏁 {tv.rating.ratingAwait}";
                    }
                }
                res += "\n";
                if (Data.seasons != null)
                {
                    res += $"\n📈 Сезонов: {Data.seasons.Count}";
                }
                if (Data.filmLength != null)
                {
                    res += $"\n⏰ Длина серии: {Data.filmLength}";
                }
                res += "\n";
                if (Data.countries != null)
                {
                    res += $"\n🌎 Страна: {string.Join(", ", Data.countries.Select(x => x.country))}";
                }
                if (Data.genres != null)
                {
                    res += $"\n🎭 Жанр: {string.Join(", ", Data.genres.Select(x => x.genre))}";
                }
                if (Data.ratingAgeLimits != null)
                {
                    res += $"\n⚠ Возраст: {Data.ratingAgeLimits}+";
                }
                else if (Data.ratingMpaa != null)
                {
                    res += $"\n⚠ Возраст: {Data.ratingMpaa}";
                }
                if (Data.premiereRu != null)
                {
                    res += $"\n📅 Дата премьеры: {Film.Methods.ChangeDateType(Data.premiereRu)}";
                }
                else if (Data.premiereWorld != null)
                {
                    res += $"\n📅 Дата премьеры: {Film.Methods.ChangeDateType(Data.premiereWorld)}";
                }
                res += "\n";
                if (Data.description != null)
                {
                    res += $"\n🎬 Описание:\n{Data.description}";
                }

                return(res);
            }
示例#2
0
 public static string RecommendedTVPosterID(TV.TVObject tv, out string photoID2)
 {
     try
     {
         string    path = String.Format(Bot.directory + "/tv_{0}_{1}.jpg", tv.data.filmId, Guid.NewGuid());
         WebClient wc   = new WebClient();
         wc.DownloadFile(tv.data.posterUrl, path);
         //загрузка необрезаного постера
         if (!SizeIsWell(path))
         {
             photoID2 = null;
             return(null);
         }
         var uploadServer2 = Bot.private_vkapi.Photo.GetUploadServer(Bot.album_id_recommended_tv, Bot.group_id_service);
         var responseFile2 = Encoding.ASCII.GetString(wc.UploadFile(uploadServer2.UploadUrl, path));
         var photo2        = Bot.private_vkapi.Photo.Save(new PhotoSaveParams
         {
             SaveFileResponse = responseFile2,
             AlbumId          = Bot.album_id_recommended_tv,
             GroupId          = Bot.group_id_service
         }).First();
         photoID2 = $"-{Bot.group_id_service}_{photo2.Id}";
         //обрезаный постер
         if (!CropAndOverwrite(path))
         {
             photoID2 = null;
             return(null);
         }
         var uploadServer = Bot.private_vkapi.Photo.GetUploadServer(Bot.album_id_recommended_tv, Bot.group_id_service);
         var responseFile = Encoding.ASCII.GetString(wc.UploadFile(uploadServer.UploadUrl, path));
         var photo        = Bot.private_vkapi.Photo.Save(new PhotoSaveParams
         {
             SaveFileResponse = responseFile,
             AlbumId          = Bot.album_id_recommended_tv,
             GroupId          = Bot.group_id_service
         }).First();
         var vkid = $"-{Bot.group_id_service}_{photo.Id}";
         File.Delete(path);
         return(vkid);
     }
     catch (Exception e)
     {
         WriteLine($"Исключение: {e.Message}\nСтектрейс: {e.StackTrace}");
         photoID2 = null;
         return(null);
     }
 }