exif.model.dart 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import 'dart:convert';
  2. class ImmichExif {
  3. final int? id;
  4. final String? assetId;
  5. final String? make;
  6. final String? model;
  7. final String? imageName;
  8. final int? exifImageWidth;
  9. final int? exifImageHeight;
  10. final int? fileSizeInByte;
  11. final String? orientation;
  12. final String? dateTimeOriginal;
  13. final String? modifyDate;
  14. final String? lensModel;
  15. final double? fNumber;
  16. final double? focalLength;
  17. final int? iso;
  18. final double? exposureTime;
  19. final double? latitude;
  20. final double? longitude;
  21. final String? city;
  22. final String? state;
  23. final String? country;
  24. ImmichExif({
  25. this.id,
  26. this.assetId,
  27. this.make,
  28. this.model,
  29. this.imageName,
  30. this.exifImageWidth,
  31. this.exifImageHeight,
  32. this.fileSizeInByte,
  33. this.orientation,
  34. this.dateTimeOriginal,
  35. this.modifyDate,
  36. this.lensModel,
  37. this.fNumber,
  38. this.focalLength,
  39. this.iso,
  40. this.exposureTime,
  41. this.latitude,
  42. this.longitude,
  43. this.city,
  44. this.state,
  45. this.country,
  46. });
  47. ImmichExif copyWith({
  48. int? id,
  49. String? assetId,
  50. String? make,
  51. String? model,
  52. String? imageName,
  53. int? exifImageWidth,
  54. int? exifImageHeight,
  55. int? fileSizeInByte,
  56. String? orientation,
  57. String? dateTimeOriginal,
  58. String? modifyDate,
  59. String? lensModel,
  60. double? fNumber,
  61. double? focalLength,
  62. int? iso,
  63. double? exposureTime,
  64. double? latitude,
  65. double? longitude,
  66. String? city,
  67. String? state,
  68. String? country,
  69. }) {
  70. return ImmichExif(
  71. id: id ?? this.id,
  72. assetId: assetId ?? this.assetId,
  73. make: make ?? this.make,
  74. model: model ?? this.model,
  75. imageName: imageName ?? this.imageName,
  76. exifImageWidth: exifImageWidth ?? this.exifImageWidth,
  77. exifImageHeight: exifImageHeight ?? this.exifImageHeight,
  78. fileSizeInByte: fileSizeInByte ?? this.fileSizeInByte,
  79. orientation: orientation ?? this.orientation,
  80. dateTimeOriginal: dateTimeOriginal ?? this.dateTimeOriginal,
  81. modifyDate: modifyDate ?? this.modifyDate,
  82. lensModel: lensModel ?? this.lensModel,
  83. fNumber: fNumber ?? this.fNumber,
  84. focalLength: focalLength ?? this.focalLength,
  85. iso: iso ?? this.iso,
  86. exposureTime: exposureTime ?? this.exposureTime,
  87. latitude: latitude ?? this.latitude,
  88. longitude: longitude ?? this.longitude,
  89. city: city ?? this.city,
  90. state: state ?? this.state,
  91. country: country ?? this.country,
  92. );
  93. }
  94. Map<String, dynamic> toMap() {
  95. return {
  96. 'id': id,
  97. 'assetId': assetId,
  98. 'make': make,
  99. 'model': model,
  100. 'imageName': imageName,
  101. 'exifImageWidth': exifImageWidth,
  102. 'exifImageHeight': exifImageHeight,
  103. 'fileSizeInByte': fileSizeInByte,
  104. 'orientation': orientation,
  105. 'dateTimeOriginal': dateTimeOriginal,
  106. 'modifyDate': modifyDate,
  107. 'lensModel': lensModel,
  108. 'fNumber': fNumber,
  109. 'focalLength': focalLength,
  110. 'iso': iso,
  111. 'exposureTime': exposureTime,
  112. 'latitude': latitude,
  113. 'longitude': longitude,
  114. 'city': city,
  115. 'state': state,
  116. 'country': country,
  117. };
  118. }
  119. factory ImmichExif.fromMap(Map<String, dynamic> map) {
  120. return ImmichExif(
  121. id: map['id']?.toInt(),
  122. assetId: map['assetId'],
  123. make: map['make'],
  124. model: map['model'],
  125. imageName: map['imageName'],
  126. exifImageWidth: map['exifImageWidth']?.toInt(),
  127. exifImageHeight: map['exifImageHeight']?.toInt(),
  128. fileSizeInByte: map['fileSizeInByte']?.toInt(),
  129. orientation: map['orientation'],
  130. dateTimeOriginal: map['dateTimeOriginal'],
  131. modifyDate: map['modifyDate'],
  132. lensModel: map['lensModel'],
  133. fNumber: map['fNumber']?.toDouble(),
  134. focalLength: map['focalLength']?.toDouble(),
  135. iso: map['iso']?.toInt(),
  136. exposureTime: map['exposureTime']?.toDouble(),
  137. latitude: map['latitude']?.toDouble(),
  138. longitude: map['longitude']?.toDouble(),
  139. city: map['city'],
  140. state: map['state'],
  141. country: map['country'],
  142. );
  143. }
  144. String toJson() => json.encode(toMap());
  145. factory ImmichExif.fromJson(String source) =>
  146. ImmichExif.fromMap(json.decode(source));
  147. @override
  148. String toString() {
  149. return 'ImmichExif(id: $id, assetId: $assetId, make: $make, model: $model, imageName: $imageName, exifImageWidth: $exifImageWidth, exifImageHeight: $exifImageHeight, fileSizeInByte: $fileSizeInByte, orientation: $orientation, dateTimeOriginal: $dateTimeOriginal, modifyDate: $modifyDate, lensModel: $lensModel, fNumber: $fNumber, focalLength: $focalLength, iso: $iso, exposureTime: $exposureTime, latitude: $latitude, longitude: $longitude, city: $city, state: $state, country: $country)';
  150. }
  151. @override
  152. bool operator ==(Object other) {
  153. if (identical(this, other)) return true;
  154. return other is ImmichExif &&
  155. other.id == id &&
  156. other.assetId == assetId &&
  157. other.make == make &&
  158. other.model == model &&
  159. other.imageName == imageName &&
  160. other.exifImageWidth == exifImageWidth &&
  161. other.exifImageHeight == exifImageHeight &&
  162. other.fileSizeInByte == fileSizeInByte &&
  163. other.orientation == orientation &&
  164. other.dateTimeOriginal == dateTimeOriginal &&
  165. other.modifyDate == modifyDate &&
  166. other.lensModel == lensModel &&
  167. other.fNumber == fNumber &&
  168. other.focalLength == focalLength &&
  169. other.iso == iso &&
  170. other.exposureTime == exposureTime &&
  171. other.latitude == latitude &&
  172. other.longitude == longitude &&
  173. other.city == city &&
  174. other.state == state &&
  175. other.country == country;
  176. }
  177. @override
  178. int get hashCode {
  179. return id.hashCode ^
  180. assetId.hashCode ^
  181. make.hashCode ^
  182. model.hashCode ^
  183. imageName.hashCode ^
  184. exifImageWidth.hashCode ^
  185. exifImageHeight.hashCode ^
  186. fileSizeInByte.hashCode ^
  187. orientation.hashCode ^
  188. dateTimeOriginal.hashCode ^
  189. modifyDate.hashCode ^
  190. lensModel.hashCode ^
  191. fNumber.hashCode ^
  192. focalLength.hashCode ^
  193. iso.hashCode ^
  194. exposureTime.hashCode ^
  195. latitude.hashCode ^
  196. longitude.hashCode ^
  197. city.hashCode ^
  198. state.hashCode ^
  199. country.hashCode;
  200. }
  201. }