public Model.ScanModels.EverythingResult EverythingSearch(string token, string content) { var to = ScanDataBaseManager.GetToken().Token; if (to == token) { var htmlModel = HtmlManager.GetHtmlContentViaUrl("http://*****:*****@"?s=&o=0&j=1&p=c&path_column=1&size_column=1&j=1&q=!c:\ " + EverythingHelper.Extensions + " " + content); if (htmlModel.Success) { var retModel = JsonConvert.DeserializeObject <Model.ScanModels.EverythingResult>(htmlModel.Content); if (retModel != null && retModel.results != null) { retModel.results = retModel.results.OrderByDescending(x => double.Parse(x.size)).ToList(); foreach (var r in retModel.results) { r.sizeStr = FileSize.GetAutoSizeString(double.Parse(r.size), 1); } return(retModel); } } } return(new Model.ScanModels.EverythingResult()); }
public TaskCommonModel RunTask(string token, string name = "ScanJavJob") { TaskCommonModel ret = new TaskCommonModel(); var to = ScanDataBaseManager.GetToken().Token; if (to == token) { TaskService ts = new TaskService(); var task = ts.FindTask(name); ret.Message = "程序没有执行"; if (task != null && task.State == TaskState.Ready) { task.Run(); ret.Message = "开始执行"; } } else { ret.Message = "没有权限"; } return(ret); }
public TaskCommonModel SiriRunJob(string token, string jobName = "SiriRun", int page = 15) { TaskCommonModel ret = new TaskCommonModel(); var to = ScanDataBaseManager.GetToken().Token; if (to == token) { var parameter = new ScanParameter(); parameter.IsAsc = true; parameter.PageSize = page; parameter.StartingPage = new List <string>() { "http://www.javlibrary.com/cn/vl_update.php?mode=" }; var jobId = ScanDataBaseManager.InsertScanJob(jobName, JsonConvert.SerializeObject(parameter)); ret.Message = "建立成功"; } else { ret.Message = "没有权限"; } return(ret); }
public NextRunModel GetNextRunTime(string token, string name = "ScanJavJob") { NextRunModel ret = new NextRunModel(); var to = ScanDataBaseManager.GetToken().Token; if (to == token) { TaskService ts = new TaskService(); var task = ts.FindTask("ScanJavJob"); if (task != null) { ret.NextRunTime = task.NextRunTime; ret.NextRunCountMinutes = (int)Math.Ceiling((task.NextRunTime - DateTime.Now).TotalMinutes); } } return(ret); }
private static void UpdateRefreshUi(int jobId = 0) { Random ran = new Random(); int count = 1; string sukebei = JavINIClass.IniReadValue("Mag", "sukebei"); Parallel.ForEach(models, new ParallelOptions { MaxDegreeOfParallelism = 10 }, rm => { RemoteScanMag entity = new RemoteScanMag(); entity.JobId = jobId; Console.Write("处理 --> " + rm.Name + " " + count++ + "/" + models.Count); var token = ScanDataBaseManager.GetToken(); var htmlResult = HtmlManager.GetHtmlContentViaUrl($"http://www.cainqs.com:8087/avapi/EverythingSearch?token={token.Token}&content=" + rm.Id); Model.ScanModels.EverythingResult searchResult = new Model.ScanModels.EverythingResult(); List <MyFileInfo> matchFiles = new List <MyFileInfo>(); if (htmlResult.Success) { searchResult = JsonConvert.DeserializeObject <Model.ScanModels.EverythingResult>(htmlResult.Content); if (searchResult != null && searchResult.results != null) { foreach (var result in searchResult.results) { var temp = new MyFileInfo(); if (result.location == "本地") { temp.Length = long.Parse(result.size); temp.FullName = result.path + "\\" + result.name; } else { temp.Length = long.Parse(result.size); temp.FullName = "网盘" + long.Parse(result.size); } matchFiles.Add(temp); } } } List <SeedMagnetSearchModel> list = new List <SeedMagnetSearchModel>(); if (sukebei == "pro" || sukebei == "si") { list = MagService.SearchSukebei(id: rm.Id, web: sukebei); } else { list = MagService.SearchJavBus(rm.Id, null); } if (list != null && list.Count > 0) { if (matchFiles.Count > 0) { var biggestFile = matchFiles.FirstOrDefault(x => x.Length == matchFiles.Max(y => y.Length)); entity.SearchStatus = 2; entity.MatchFile = biggestFile.FullName; } else { entity.SearchStatus = 1; } foreach (var seed in list) { entity.AvId = rm.Id; entity.AvName = FileUtility.ReplaceInvalidChar(rm.Name); entity.AvUrl = rm.Url; entity.MagDate = seed.Date; entity.MagSize = seed.Size; entity.MagTitle = FileUtility.ReplaceInvalidChar(seed.Title); entity.MagUrl = seed.MagUrl; try { if (entity.MagTitle.Contains(rm.Id) || entity.MagTitle.Contains(rm.Id.Replace("-", ""))) { ScanDataBaseManager.InsertRemoteScanMag(entity); } } catch (Exception ee) { entity.MatchFile = ""; entity.SearchStatus = 1; ScanDataBaseManager.InsertRemoteScanMag(entity); } } } else { Console.Write(" 没搜到"); entity.SearchStatus = 0; } Console.WriteLine(); }); }
public ReportVM GetReport(string token, int top = 5) { ReportVM ret = new ReportVM(); var to = ScanDataBaseManager.GetToken().Token; if (to == token) { StringBuilder sb = new StringBuilder(); var report = ScanDataBaseManager.GetReport(); var items = ScanDataBaseManager.ReportItem(report.ReportId); ret.TotalCount = report.TotalExist; sb.AppendLine($"总Av数量: [{ret.TotalCount}]"); ret.TotalSizeStr = FileSize.GetAutoSizeString((double)report.TotalExistSize, 1); sb.AppendLine($"总Av大小: [{ret.TotalSizeStr}]"); ret.TotalSize = (double)report.TotalExistSize; ret.ChineseCount = report.ChineseCount; sb.AppendLine($"中文Av数量: [{ret.ChineseCount}]"); ret.FileLessThan1G = report.LessThenOneGiga; sb.AppendLine($"文件小于1GB: [{ret.FileLessThan1G}]"); ret.FileLargeThan1G = report.OneGigaToTwo; sb.AppendLine($"大于1GB小于2GB: [{ret.FileLargeThan1G}]"); ret.FileLargeThan2G = report.TwoGigaToFour; sb.AppendLine($"大于2GB小于4GB: [{ret.FileLargeThan2G}]"); ret.FileLargeThan4G = report.FourGigaToSix; sb.AppendLine($"大于4GB小于6GB: [{ret.FileLargeThan4G}]"); ret.FileLargeThan6G = report.GreaterThenSixGiga; sb.AppendLine($"文件大于6GB: [{ret.FileLargeThan6G}]"); var extensionModel = JsonConvert.DeserializeObject <Dictionary <string, int> >(report.Extension); ret.Formats = extensionModel; sb.AppendLine("后缀分布:"); foreach (var ext in extensionModel) { sb.AppendLine($"\t{ext.Key} : {ext.Value}"); } foreach (ReportType type in Enum.GetValues(typeof(ReportType))) { List <ReportItem> i = new List <ReportItem>(); switch (type) { case ReportType.Actress: i = items.Where(x => (ReportType)x.ReportType == type).OrderByDescending(x => x.ExistCount).Take(top).ToList(); sb.AppendLine("女优TOP" + top); foreach (var temp in i) { var name = temp.ItemName; var count = temp.ExistCount; var ratio = $"{temp.ExistCount} / {temp.TotalCount}"; var size = FileSize.GetAutoSizeString(temp.TotalSize, 1); sb.AppendLine($"\t{name} -> 作品 {ratio},总大小 {size}"); } break; case ReportType.Category: i = items.Where(x => (ReportType)x.ReportType == type).OrderByDescending(x => x.ExistCount).Take(top).ToList(); sb.AppendLine("分类TOP" + top); foreach (var temp in i) { var name = temp.ItemName; var count = temp.ExistCount; var ratio = $"{temp.ExistCount} / {temp.TotalCount}"; var size = FileSize.GetAutoSizeString(temp.TotalSize, 1); sb.AppendLine($"\t{name} -> 作品 {ratio},总大小 {size}"); } break; case ReportType.Prefix: i = items.Where(x => (ReportType)x.ReportType == type).OrderByDescending(x => x.ExistCount).Take(top).ToList(); sb.AppendLine("番号TOP" + top); foreach (var temp in i) { var name = temp.ItemName; var count = temp.ExistCount; var ratio = $"{temp.ExistCount} / {temp.TotalCount}"; var size = FileSize.GetAutoSizeString(temp.TotalSize, 1); sb.AppendLine($"\t{name} -> 作品 {ratio},总大小 {size}"); } break; case ReportType.Company: i = items.Where(x => (ReportType)x.ReportType == type).OrderByDescending(x => x.ExistCount).Take(top).ToList(); sb.AppendLine("公司TOP" + top); foreach (var temp in i) { var name = temp.ItemName; var count = temp.ExistCount; var ratio = $"{temp.ExistCount} / {temp.TotalCount}"; var size = FileSize.GetAutoSizeString(temp.TotalSize, 1); sb.AppendLine($"\t{name} -> 作品 {ratio},总大小 {size}"); } break; case ReportType.Date: i = items.Where(x => (ReportType)x.ReportType == type).OrderByDescending(x => x.ExistCount).Take(top).ToList(); sb.AppendLine("日期TOP" + top); foreach (var temp in i) { var name = temp.ItemName; var count = temp.ExistCount; var ratio = $"{temp.ExistCount} / {temp.TotalCount}"; var size = FileSize.GetAutoSizeString(temp.TotalSize, 1); sb.AppendLine($"\t{name} -> 作品 {ratio},总大小 {size}"); } break; } } ret.ShowContent = sb.ToString(); } return(ret); }
public Model.ScanModels.EverythingResult EverythingSearch(string token, string content) { var to = ScanDataBaseManager.GetToken().Token; var retModel = new Model.ScanModels.EverythingResult(); if (to == token) { var htmlModel = HtmlManager.GetHtmlContentViaUrl("http://*****:*****@"?s=&o=0&j=1&p=c&path_column=1&size_column=1&j=1&q=!c:\ " + EverythingHelper.Extensions + " " + content); if (htmlModel.Success) { retModel = JsonConvert.DeserializeObject <Model.ScanModels.EverythingResult>(htmlModel.Content); if (retModel != null && retModel.results != null && retModel.results.Count > 0) { retModel.results = retModel.results.OrderByDescending(x => double.Parse(x.size)).ToList(); foreach (var r in retModel.results) { r.sizeStr = FileSize.GetAutoSizeString(double.Parse(r.size), 1); r.location = "本地"; } return(retModel); } else { retModel = new Model.ScanModels.EverythingResult { results = new List <EverythingFileResult>() }; List <FileItemModel> oneOneFiveFiles = new List <FileItemModel>(); oneOneFiveFiles = OneOneFiveService.Get115SearchFileResult(OneOneFiveService.Get115Cookie(), content); oneOneFiveFiles.AddRange(OneOneFiveService.Get115SearchFileResult(OneOneFiveService.Get115Cookie(), content, "2068937774368408801")); if (oneOneFiveFiles != null && oneOneFiveFiles.Any()) { var targetFile = oneOneFiveFiles.Where(x => x.n.ToLower().Contains(content.ToLower()) && !string.IsNullOrEmpty(x.fid)).ToList(); retModel.totalResults = targetFile.Count + ""; if (targetFile != null) { foreach (var file in targetFile) { EverythingFileResult temp = new EverythingFileResult { size = file.s + "", sizeStr = FileSize.GetAutoSizeString(double.Parse(file.s + ""), 1), location = "115网盘", name = file.n }; retModel.results.Add(temp); } } return(retModel); } } } } return(new Model.ScanModels.EverythingResult()); }