Skip to content

Commit

Permalink
proof of concept for our movie parser to return hash data. This sketc…
Browse files Browse the repository at this point in the history
…hes out the API, still need to actually parse the hashes out of various file formats
  • Loading branch information
adelikat committed Nov 9, 2024
1 parent 3431191 commit 537ff7b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions TASVideos.Parsers/Result/ErrorResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ internal class ErrorResult(string errorMsg) : IParseResult
public double? FrameRateOverride => null;
public long? CycleCount => null;
public string? Annotations => null;
public Dictionary<HashType, string> Hashes => [];
}
7 changes: 7 additions & 0 deletions TASVideos.Parsers/Result/IParseResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,11 @@ public interface IParseResult
/// Gets the annotations. These can be general comments, or other user entered descriptions supported by the file format.
/// </summary>
string? Annotations { get; }

Dictionary<HashType, string> Hashes { get; }
}

public enum HashType
{
Md5, Sha1, Sha256, Crc32
}
2 changes: 2 additions & 0 deletions TASVideos.Parsers/Result/SuccessResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ internal class SuccessResult(string fileExtension) : IParseResult
public string? Annotations { get; internal set; }

internal List<ParseWarnings> WarningList { get; } = [];

public Dictionary<HashType, string> Hashes { get; } = [];
}

internal static class ParseResultExtensions
Expand Down
1 change: 1 addition & 0 deletions tests/TASVideos.Core.Tests/Services/TestParseResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ internal class TestParseResult : IParseResult
public double? FrameRateOverride { get; init; }
public long? CycleCount { get; init; }
public string? Annotations { get; init; }
public Dictionary<HashType, string> Hashes { get; init; } = new Dictionary<HashType, string>();
}
1 change: 1 addition & 0 deletions tests/TASVideos.Core.Tests/Services/UserFilesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,6 @@ private class TestParseResult : IParseResult
public double? FrameRateOverride => null;
public long? CycleCount => null;
public string? Annotations => null;
public Dictionary<HashType, string> Hashes { get; init; } = new Dictionary<HashType, string>();
}
}

0 comments on commit 537ff7b

Please sign in to comment.