public ActionResult <AVDumpResult> AvDumpFile([FromRoute] int fileID) { var file = RepoFactory.VideoLocal.GetByID(fileID); if (file == null) { return(NotFound(FileNotFoundWithFileID)); } if (string.IsNullOrWhiteSpace(ServerSettings.Instance.AniDb.AVDumpKey)) { return(BadRequest("Missing AVDump API key")); } var filePath = file.GetBestVideoLocalPlace(true)?.FullServerPath; if (string.IsNullOrEmpty(filePath)) { return(BadRequest(FileNoPath)); } var result = AVDumpHelper.DumpFile(filePath).Replace("\r", ""); return(new AVDumpResult() { FullOutput = result, Ed2k = result.Split('\n').FirstOrDefault(s => s.Trim().Contains("ed2k://")), }); }
public ActionResult AVDumpMismatchedFiles() { var allvids = RepoFactory.VideoLocal.GetAll().Where(vid => !vid.IsEmpty() && vid.Media != null) .ToDictionary(a => a, a => a.GetAniDBFile()); Task.Factory.StartNew(() => { var list = allvids.Keys.Select(vid => new { vid, anidb = allvids[vid] }) .Where(_tuple => _tuple.anidb != null) .Where(_tuple => _tuple.anidb.IsDeprecated != 1) .Where(_tuple => _tuple.vid.Media?.MenuStreams.Any() != (_tuple.anidb.IsChaptered == 1)) .Select(_tuple => _tuple.vid.GetBestVideoLocalPlace(true)?.FullServerPath) .Where(path => !string.IsNullOrEmpty(path)).ToList(); int index = 0; foreach (var path in list) { Logger.Info($"AVDump Start {index + 1}/{list.Count}: {path}"); AVDumpHelper.DumpFile(path); Logger.Info($"AVDump Finished {index + 1}/{list.Count}: {path}"); index++; Logger.Info($"AVDump Progress: {list.Count - index} remaining"); } }); return(Ok()); }
public ActionResult <AVDumpResult> AvDumpFile(int id) { if (string.IsNullOrWhiteSpace(ServerSettings.Instance.AniDb.AVDumpKey)) { return(BadRequest("Missing AVDump API key")); } var vl = RepoFactory.VideoLocal.GetByID(id); if (vl == null) { return(NotFound()); } var file = vl.GetBestVideoLocalPlace(true)?.FullServerPath; if (string.IsNullOrEmpty(file)) { return(this.NoContent()); } var result = AVDumpHelper.DumpFile(file).Replace("\r", ""); return(new AVDumpResult() { FullOutput = result, Ed2k = result.Split('\n').FirstOrDefault(s => s.Trim().Contains("ed2k://")) }); }