@@ -155,3 +155,96 @@ class SharedRemoteEpisode {
155155 );
156156 }
157157}
158+
159+ class SharedRemoteScannedFolder {
160+ SharedRemoteScannedFolder ({
161+ required this .path,
162+ required this .name,
163+ required this .exists,
164+ });
165+
166+ final String path;
167+ final String name;
168+ final bool exists;
169+
170+ factory SharedRemoteScannedFolder .fromJson (Map <String , dynamic > json) {
171+ return SharedRemoteScannedFolder (
172+ path: json['path' ] as String ? ?? '' ,
173+ name: json['name' ] as String ? ?? '' ,
174+ exists: json['exists' ] as bool ? ?? false ,
175+ );
176+ }
177+ }
178+
179+ class SharedRemoteScanStatus {
180+ SharedRemoteScanStatus ({
181+ required this .isScanning,
182+ required this .progress,
183+ required this .message,
184+ required this .totalFilesFound,
185+ });
186+
187+ final bool isScanning;
188+ final double progress;
189+ final String message;
190+ final int totalFilesFound;
191+
192+ factory SharedRemoteScanStatus .fromJson (Map <String , dynamic > json) {
193+ return SharedRemoteScanStatus (
194+ isScanning: json['isScanning' ] as bool ? ?? false ,
195+ progress: (json['progress' ] as num ? )? .toDouble () ?? 0.0 ,
196+ message: json['message' ] as String ? ?? '' ,
197+ totalFilesFound: json['totalFilesFound' ] as int ? ?? 0 ,
198+ );
199+ }
200+ }
201+
202+ class SharedRemoteFileEntry {
203+ SharedRemoteFileEntry ({
204+ required this .path,
205+ required this .name,
206+ required this .isDirectory,
207+ this .size,
208+ this .modifiedTime,
209+ this .animeName,
210+ this .episodeTitle,
211+ this .animeId,
212+ this .episodeId,
213+ this .isFromScan,
214+ });
215+
216+ final String path;
217+ final String name;
218+ final bool isDirectory;
219+ final int ? size;
220+ final DateTime ? modifiedTime;
221+ final String ? animeName;
222+ final String ? episodeTitle;
223+ final int ? animeId;
224+ final int ? episodeId;
225+ final bool ? isFromScan;
226+
227+ factory SharedRemoteFileEntry .fromJson (Map <String , dynamic > json) {
228+ int ? parseInt (dynamic value) {
229+ if (value is int ) return value;
230+ if (value is num ) return value.toInt ();
231+ if (value is String ) return int .tryParse (value);
232+ return null ;
233+ }
234+
235+ return SharedRemoteFileEntry (
236+ path: json['path' ] as String ? ?? '' ,
237+ name: json['name' ] as String ? ?? '' ,
238+ isDirectory: json['isDirectory' ] as bool ? ?? false ,
239+ size: json['size' ] as int ? ,
240+ modifiedTime: json['modifiedTime' ] != null
241+ ? DateTime .tryParse (json['modifiedTime' ] as String )
242+ : null ,
243+ animeName: json['animeName' ] as String ? ,
244+ episodeTitle: json['episodeTitle' ] as String ? ,
245+ animeId: parseInt (json['animeId' ]),
246+ episodeId: parseInt (json['episodeId' ]),
247+ isFromScan: json['isFromScan' ] as bool ? ,
248+ );
249+ }
250+ }
0 commit comments