Skip to content

Commit

Permalink
Allow fo detection of AudioMoth dates in result file names
Browse files Browse the repository at this point in the history
Also limits valid range of dates an AudioMoth file could have.
  • Loading branch information
atruskie committed Sep 30, 2019
1 parent ce28732 commit bea4285
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Acoustics.Shared/FileDateHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ public class FileDateHelpers

// AudioMoth V1 format
// 5BFA3A06.WAV
// This pattern will recognize dates between 2012-07-13 and 2021-01-14.
// We've restricted the date format to have a leading '5' character so that we can disambiguate between this pattern
// and other patterns.
new DateVariants(
"^(?<date>[0-9A-F]{8}).WAV$",
"^(?<date>5[0-9A-F]{7}).*",
parseFormat: AudioMothKey,
parseTimeZone: true,
acceptedFormats: Array.Empty<string>()),
Expand Down
1 change: 1 addition & 0 deletions tests/Acoustics.Test/Shared/FileDateHelpersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void TestInvalidDateFormats()
["SERF_20130314_000021Z_000.wav"] = Parse("2013-03-14T00:00:21.000+00:00"),
["20150727T133138Z.wav"] = Parse("2015-07-27T13:31:38.000+00:00"),
["5BFA3A06.WAV"] = Parse("2018-11-25T05:58:30.000+00:00"),
["5BFA3A06__blahblahblahresults.WAV"] = Parse("2018-11-25T05:58:30.000+00:00"),
};

[TestMethod]
Expand Down

0 comments on commit bea4285

Please sign in to comment.