public string UpdateAnimeData(int animeID) { try { using (var session = JMMService.SessionFactory.OpenSession()) { JMMService.AnidbProcessor.GetAnimeInfoHTTP(session, animeID, true, false); // also find any files for this anime which don't have proper media info data // we can usually tell this if the Resolution == '0x0' VideoLocalRepository repVids = new VideoLocalRepository(); AniDB_FileRepository repFiles = new AniDB_FileRepository(); foreach (VideoLocal vid in repVids.GetByAniDBAnimeID(session, animeID)) { AniDB_File aniFile = vid.GetAniDBFile(session); if (aniFile == null) continue; if (aniFile.File_VideoResolution.Equals("0x0", StringComparison.InvariantCultureIgnoreCase)) { CommandRequest_GetFile cmd = new CommandRequest_GetFile(vid.VideoLocalID, true); cmd.Save(session); } } // update group status information CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(animeID, true); cmdStatus.Save(session); } } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } return ""; }
public string UpdateFileData(int videoLocalID) { try { VideoLocalRepository repVids = new VideoLocalRepository(); VideoLocal vid = repVids.GetByID(videoLocalID); if (vid == null) return "File could not be found"; CommandRequest_GetFile cmd = new CommandRequest_GetFile(vid.VideoLocalID, true); cmd.Save(); } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); return ex.Message; } return ""; }
public static int UpdateAniDBFileData(bool missingInfo, bool outOfDate, bool countOnly) { List<int> vidsToUpdate = new List<int>(); try { AniDB_FileRepository repFiles = new AniDB_FileRepository(); VideoLocalRepository repVids = new VideoLocalRepository(); if (missingInfo) { List<VideoLocal> vids = repVids.GetByAniDBResolution("0x0"); foreach (VideoLocal vid in vids) { if (!vidsToUpdate.Contains(vid.VideoLocalID)) vidsToUpdate.Add(vid.VideoLocalID); } } if (outOfDate) { List<VideoLocal> vids = repVids.GetByInternalVersion(1); foreach (VideoLocal vid in vids) { if (!vidsToUpdate.Contains(vid.VideoLocalID)) vidsToUpdate.Add(vid.VideoLocalID); } } if (!countOnly) { foreach (int id in vidsToUpdate) { CommandRequest_GetFile cmd = new CommandRequest_GetFile(id, true); cmd.Save(); } } } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } return vidsToUpdate.Count; }