@@ -9,10 +9,11 @@ namespace EventPi.Abstractions;
9
9
10
10
public interface IVideoRecordingLocator
11
11
{
12
- bool Exists ( in VideoRecordingIdentifier recording ) ;
12
+ VideoRecordingIdentifier . FileNamingConvention ? Resolve ( in VideoRecordingIdentifier recording ) ;
13
+ bool Exists ( in VideoRecordingIdentifier recording , VideoRecordingIdentifier . FileNamingConvention ? convention = null ) ;
13
14
bool Exists ( in FrameId frameId ) ;
14
- RecordingPath GetPath ( in VideoRecordingIdentifier recording ) ;
15
- string GetFolderFullPath ( in VideoRecordingIdentifier recording ) ;
15
+ RecordingPath GetPath ( in VideoRecordingIdentifier recording , VideoRecordingIdentifier . FileNamingConvention ? convention ) ;
16
+ string GetFolderFullPath ( in VideoRecordingIdentifier recording , VideoRecordingIdentifier . FileNamingConvention ? convention ) ;
16
17
IEnumerable < VideoRecordingIdentifier > Recording ( ) ;
17
18
}
18
19
@@ -54,6 +55,7 @@ public static void Configure()
54
55
}
55
56
56
57
58
+
57
59
[ JsonConverter ( typeof ( JsonParsableConverter < VideoRecordingIdentifier > ) ) ]
58
60
[ ProtoContract ]
59
61
public readonly record struct VideoRecordingIdentifier : IParsable < VideoRecordingIdentifier >
@@ -109,10 +111,22 @@ public static VideoRecordingIdentifier Parse(string s, IFormatProvider? provider
109
111
return new VideoRecordingIdentifier ( hostName , cameraId , createdTime ) ;
110
112
}
111
113
}
112
- public string ToStringFileName ( )
114
+
115
+ public enum FileNamingConvention
116
+ {
117
+ Iso8601 ,
118
+ ZoneOffset
119
+ }
120
+
121
+ [ JsonIgnore ]
122
+ public FileNamingConvention Convention
123
+ {
124
+ get => CreatedTime . Offset == TimeSpan . Zero ? FileNamingConvention . Iso8601 : FileNamingConvention . ZoneOffset ;
125
+ }
126
+ public string ToStringFileName ( FileNamingConvention ? convention = null )
113
127
{
114
128
// Convert to filename-safe ISO 8601
115
- if ( CreatedTime . Offset == TimeSpan . Zero )
129
+ if ( ( convention == null && CreatedTime . Offset == TimeSpan . Zero ) || convention == FileNamingConvention . Iso8601 )
116
130
{
117
131
// Use Z for UTC
118
132
var utcStr = CreatedTime . UtcDateTime . ToString ( "yyyyMMddTHHmmss.ffffff" ) + "Z" ;
0 commit comments