exif.model.dart 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. ImmichExif({
  22. this.id,
  23. this.assetId,
  24. this.make,
  25. this.model,
  26. this.imageName,
  27. this.exifImageWidth,
  28. this.exifImageHeight,
  29. this.fileSizeInByte,
  30. this.orientation,
  31. this.dateTimeOriginal,
  32. this.modifyDate,
  33. this.lensModel,
  34. this.fNumber,
  35. this.focalLength,
  36. this.iso,
  37. this.exposureTime,
  38. this.latitude,
  39. this.longitude,
  40. });
  41. ImmichExif copyWith({
  42. int? id,
  43. String? assetId,
  44. String? make,
  45. String? model,
  46. String? imageName,
  47. int? exifImageWidth,
  48. int? exifImageHeight,
  49. int? fileSizeInByte,
  50. String? orientation,
  51. String? dateTimeOriginal,
  52. String? modifyDate,
  53. String? lensModel,
  54. double? fNumber,
  55. double? focalLength,
  56. int? iso,
  57. double? exposureTime,
  58. double? latitude,
  59. double? longitude,
  60. }) {
  61. return ImmichExif(
  62. id: id ?? this.id,
  63. assetId: assetId ?? this.assetId,
  64. make: make ?? this.make,
  65. model: model ?? this.model,
  66. imageName: imageName ?? this.imageName,
  67. exifImageWidth: exifImageWidth ?? this.exifImageWidth,
  68. exifImageHeight: exifImageHeight ?? this.exifImageHeight,
  69. fileSizeInByte: fileSizeInByte ?? this.fileSizeInByte,
  70. orientation: orientation ?? this.orientation,
  71. dateTimeOriginal: dateTimeOriginal ?? this.dateTimeOriginal,
  72. modifyDate: modifyDate ?? this.modifyDate,
  73. lensModel: lensModel ?? this.lensModel,
  74. fNumber: fNumber ?? this.fNumber,
  75. focalLength: focalLength ?? this.focalLength,
  76. iso: iso ?? this.iso,
  77. exposureTime: exposureTime ?? this.exposureTime,
  78. latitude: latitude ?? this.latitude,
  79. longitude: longitude ?? this.longitude,
  80. );
  81. }
  82. Map<String, dynamic> toMap() {
  83. return {
  84. 'id': id,
  85. 'assetId': assetId,
  86. 'make': make,
  87. 'model': model,
  88. 'imageName': imageName,
  89. 'exifImageWidth': exifImageWidth,
  90. 'exifImageHeight': exifImageHeight,
  91. 'fileSizeInByte': fileSizeInByte,
  92. 'orientation': orientation,
  93. 'dateTimeOriginal': dateTimeOriginal,
  94. 'modifyDate': modifyDate,
  95. 'lensModel': lensModel,
  96. 'fNumber': fNumber,
  97. 'focalLength': focalLength,
  98. 'iso': iso,
  99. 'exposureTime': exposureTime,
  100. 'latitude': latitude,
  101. 'longitude': longitude,
  102. };
  103. }
  104. factory ImmichExif.fromMap(Map<String, dynamic> map) {
  105. return ImmichExif(
  106. id: map['id']?.toInt(),
  107. assetId: map['assetId'],
  108. make: map['make'],
  109. model: map['model'],
  110. imageName: map['imageName'],
  111. exifImageWidth: map['exifImageWidth']?.toInt(),
  112. exifImageHeight: map['exifImageHeight']?.toInt(),
  113. fileSizeInByte: map['fileSizeInByte']?.toInt(),
  114. orientation: map['orientation'],
  115. dateTimeOriginal: map['dateTimeOriginal'],
  116. modifyDate: map['modifyDate'],
  117. lensModel: map['lensModel'],
  118. fNumber: map['fNumber']?.toDouble(),
  119. focalLength: map['focalLength']?.toDouble(),
  120. iso: map['iso']?.toInt(),
  121. exposureTime: map['exposureTime']?.toDouble(),
  122. latitude: map['latitude']?.toDouble(),
  123. longitude: map['longitude']?.toDouble(),
  124. );
  125. }
  126. String toJson() => json.encode(toMap());
  127. factory ImmichExif.fromJson(String source) => ImmichExif.fromMap(json.decode(source));
  128. @override
  129. String toString() {
  130. 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)';
  131. }
  132. @override
  133. bool operator ==(Object other) {
  134. if (identical(this, other)) return true;
  135. return other is ImmichExif &&
  136. other.id == id &&
  137. other.assetId == assetId &&
  138. other.make == make &&
  139. other.model == model &&
  140. other.imageName == imageName &&
  141. other.exifImageWidth == exifImageWidth &&
  142. other.exifImageHeight == exifImageHeight &&
  143. other.fileSizeInByte == fileSizeInByte &&
  144. other.orientation == orientation &&
  145. other.dateTimeOriginal == dateTimeOriginal &&
  146. other.modifyDate == modifyDate &&
  147. other.lensModel == lensModel &&
  148. other.fNumber == fNumber &&
  149. other.focalLength == focalLength &&
  150. other.iso == iso &&
  151. other.exposureTime == exposureTime &&
  152. other.latitude == latitude &&
  153. other.longitude == longitude;
  154. }
  155. @override
  156. int get hashCode {
  157. return id.hashCode ^
  158. assetId.hashCode ^
  159. make.hashCode ^
  160. model.hashCode ^
  161. imageName.hashCode ^
  162. exifImageWidth.hashCode ^
  163. exifImageHeight.hashCode ^
  164. fileSizeInByte.hashCode ^
  165. orientation.hashCode ^
  166. dateTimeOriginal.hashCode ^
  167. modifyDate.hashCode ^
  168. lensModel.hashCode ^
  169. fNumber.hashCode ^
  170. focalLength.hashCode ^
  171. iso.hashCode ^
  172. exposureTime.hashCode ^
  173. latitude.hashCode ^
  174. longitude.hashCode;
  175. }
  176. }