public File(SVR_VideoLocal vl) { ID = vl.VideoLocalID; Size = vl.FileSize; Hashes = new Hashes { ED2K = vl.Hash, MD5 = vl.MD5, CRC32 = vl.CRC32, SHA1 = vl.SHA1 }; RoundedStandardResolution = FileQualityFilter.GetResolution(vl); Locations = vl.Places.Select(a => new Location { ImportFolderID = a.ImportFolderID, RelativePath = a.FilePath, Accessible = a.GetFile() != null }).ToList(); }
public File(HttpContext ctx, SVR_VideoLocal vl) { ID = vl.VideoLocalID; Size = vl.FileSize; Hashes = new Hashes { ED2K = vl.Hash, MD5 = vl.MD5, CRC32 = vl.CRC32, SHA1 = vl.SHA1 }; RoundedStandardResolution = FileQualityFilter.GetResolution(vl); Locations = vl.Places.Select(a => new Location { ImportFolderID = a.ImportFolderID, RelativePath = a.FilePath, Accessible = a.GetFile() != null }).ToList(); Created = vl.DateTimeCreated; var ur = vl.GetUserRecord(ctx?.GetUser()?.JMMUserID ?? 0); ResumePosition = ur?.ResumePosition ?? 0; Watched = ur?.WatchedDate; }
/// <summary> /// This method attempts to take a video resolution, and return something that is closer to a standard /// </summary> /// <param name="res"></param> /// <returns></returns> public static string GetStandardisedVideoResolution(string res) => FileQualityFilter.GetResolution(res) ?? res;
private static string GetResolution(int width, int height) { return(FileQualityFilter.GetResolution(Tuple.Create(width, height))); }