public static Database.StreamCookie ToDBO(this Cookie cookie, Database.MovieStreamSet streamSet) { return(new Database.StreamCookie { MovieStreamSet = streamSet, Value = SerializationUtils.SerializeCookie(cookie), ExpirationDate = cookie.Expires }); }
public static MovieStreamSet ToDTA(this Database.MovieStreamSet movieSet) { return(new MovieStreamSet { Id = movieSet.Id, Captions = movieSet.Captions.Select(li => li.ToDTA()).ToList(), VideoStreams = movieSet.VideoStream.Select(li => li.ToDTA()).ToList() }); }
private async Task IssueStreamParse(Database.MovieStreamSet streamSet) { /*var uri = new Uri(streamSet.AddressSource); * var streamHost = CrawlingFactory.CreateStreamCrawler(uri); * SetupCrawler(streamHost); * var newMovieStreamSet = await streamHost.GetStreamSetInfoAsync(uri); * * streamSet.StreamCookie.SetSource(newMovieStreamSet.CookieCollection.Cast<Cookie>().Select(li => li.ToDBO(streamSet))); * streamSet.StreamHeaders.SetSource(newMovieStreamSet.HeaderCollection.Select(li => li.ToDBO(streamSet)));*/ }
public static void SaveMovieInformation(this Database.MoviesContext context, Database.Movies dbMovie, MovieInfo movieInfo) { context.Movies.InsertOnSubmit(dbMovie); foreach (var streamSet in movieInfo.Streams) { var dbStreamSet = new Database.MovieStreamSet { Movies = dbMovie, AddressSource = movieInfo.Link.ToString(), }; context.Captions.InsertAllOnSubmit(streamSet.Captions.Select(li => new Database.Captions { MovieStreamSet = dbStreamSet, Language = li.Language, Address = li.Address })); context.VideoStream.InsertAllOnSubmit(streamSet.VideoStreams.Select(li => new Database.VideoStream { MovieStreamSet = dbStreamSet, Resolution = (byte)li.Resolution, VideoAddress = li.AVStream, })); context.StreamCookie.InsertAllOnSubmit(streamSet.Cookies.Cast <System.Net.Cookie>().Select(li => new Database.StreamCookie { MovieStreamSet = dbStreamSet, Value = SerializationUtils.SerializeCookie(li), ExpirationDate = li.Expires })); context.StreamHeaders.InsertAllOnSubmit(streamSet.Headers.Select(li => new Database.StreamHeaders { MovieStreamSet = dbStreamSet, Name = li.Key, Value = li.Value, })); } }
public static Database.StreamHeaders ToDBO(this KeyValuePair <string, string> kvp, Database.MovieStreamSet streamSet) { return(new Database.StreamHeaders { MovieStreamSet = streamSet, Name = kvp.Key, Value = kvp.Value, }); }