protected void Page_Load(object sender, EventArgs e) { int removed = 0; var vids = new Videos(); vids.GetAll(); foreach (Video vv1 in vids) { if (vv1.IsEnabled) { bool? sss = Utilities.GETRequest(new Uri( string.Format("http://i3.ytimg.com/vi/{0}/1.jpg", vv1.ProviderKey)), true); if (sss == null) continue; if (!Convert.ToBoolean(sss)) { vv1.IsEnabled = false; removed++; vv1.Update(); } } } Response.Write(removed); }
private void ClearBadVideos() { Videos vids = new Videos(); vids.GetAll(); foreach (Video vv1 in vids) { if (vv1.IsEnabled) { bool? sss = Utilities.GETRequest(new Uri( string.Format("http://i3.ytimg.com/vi/{0}/1.jpg", vv1.ProviderKey)), true); if (sss == null) continue; if (!Convert.ToBoolean(sss)) { vv1.IsEnabled = false; vv1.Update(); } } } }
private static void ClearBadVideos() { var vids = new Videos(); vids.GetAll(); foreach (Video vv1 in from vv1 in vids where vv1.IsEnabled let sss = Utilities.GETRequest(new Uri( string.Format("http://i3.ytimg.com/vi/{0}/1.jpg", vv1.ProviderKey)), true) where sss != null where !Convert.ToBoolean(sss) select vv1) { vv1.IsEnabled = false; vv1.Update(); } }