TheLastGimbus / GooglePhotosTakeoutHelper

Script that organizes the Google Takeout archive into one big chronological folder
https://aur.archlinux.org/packages/gpth-bin
Apache License 2.0
3.88k stars 191 forks source link

FileSystemException: Failed to decode data using encoding 'utf-8' #143

Closed xavgru12 closed 1 year ago

xavgru12 commented 1 year ago

version v3.2.0

xavgru12 commented 1 year ago

complete output:

Xavers-MacBook-Pro:INTENSO xavergruber$ ./gpth-macos --input ./TakeoutComplete --output ./filesFromTakeoutHelperScript
Okay, running... searching for everything in input folder...
Found 44706 photos/videos in input folder
Finding duplicates...
Guessing dates from files : ........................................ 0/25620  Unhandled exception:
FileSystemException: Failed to decode data using encoding 'utf-8', path = './TakeoutComplete/Takeout/Google Fotos/Photos from 2015/._IMG_20151231_213538027.jpg.json'
#0      _File.readAsString (dart:io/file_impl.dart:573)
#1      jsonExtractor (package:gpth/date_extractors/json_extractor.dart:11)
<asynchronous suspension>
#2      main (file:///Users/runner/work/GooglePhotosTakeoutHelper/GooglePhotosTakeoutHelper/bin/gpth.dart:287)
<asynchronous suspension>
TheLastGimbus commented 1 year ago

Damn... could you send me a zip of this one json file? I could check the encoding etc... this is weird

xavgru12 commented 1 year ago
{
  "title": "IMG_20151231_213538027.jpg",
  "description": "",
  "imageViews": "45",
  "creationTime": {
    "timestamp": "1451604963",
    "formatted": "31.12.2015, 23:36:03 UTC"
  },
  "photoTakenTime": {
    "timestamp": "1451604937",
    "formatted": "31.12.2015, 23:35:37 UTC"
  },
  "geoData": {
    "latitude": 0.0,
    "longitude": 0.0,
    "altitude": 0.0,
    "latitudeSpan": 0.0,
    "longitudeSpan": 0.0
  },
  "geoDataExif": {
    "latitude": 0.0,
    "longitude": 0.0,
    "altitude": 0.0,
    "latitudeSpan": 0.0,
    "longitudeSpan": 0.0
  },
  "people": [{
    "name": "Eu Mesma"
  }],
  "url": "https://lh3.googleusercontent.com/IGl9Ohs51NBP42aui4-7XNOGg_Vp-GT6YMAErD96hJwXLMH3Y8ky3QI7FdyBzH7ohYJzlLT7D_W5b75e6IO0ac2d--vtJ-esbolqUvB0",
  "googlePhotosOrigin": {
    "mobileUpload": {
      "deviceFolder": {
        "localFolderName": ""
      },
      "deviceType": "ANDROID_PHONE"
    }
  },
  "photoLastModifiedTime": {
    "timestamp": "1650040026",
    "formatted": "15.04.2022, 16:27:06 UTC"
  }
}
TheLastGimbus commented 1 year ago

No no, i can't do anything like that :/ you have to zip the file directly from your disk without touching it, then send me this zip (through WeTransfer or something)

TheLastGimbus commented 1 year ago

Dart natively supports only utf8 and Latin1 :confused: - i suppose you have file with some weird windows encoding, so only thing i can do is to handle the exception and try exif/name-guess method... anyway, looking at your photo,

IMG_20151231_213538027.jpg

this should work nice :+1:

Go ahead and try v3.3.0

xavgru12 commented 1 year ago

using v3.3.0


Xavers-MacBook-Pro:INTENSO xavergruber$ ./gpth-macos-2 --input ./TakeoutComplete --output ./filesFromTakeoutHelperScript --copy
Okay, running... searching for everything in input folder...
Unhandled exception:
FileSystemException: Failed to decode data using encoding 'utf-8', path = './TakeoutComplete/Takeout/Google Fotos/Samstagnachmittag in Würzburg/._Metadaten.json'
#0      _File._tryDecode (dart:io/file_impl.dart:564)
#1      _File.readAsStringSync (dart:io/file_impl.dart:584)
#2      isArchiveFolder.<anonymous closure> (package:gpth/folder_classify.dart:62)
#3      Stream.any.<anonymous closure>.<anonymous closure> (dart:async/stream.dart:1271)
#4      _runUserCode (dart:async/stream_pipe.dart:11)
#5      Stream.every.<anonymous closure> (dart:async/stream.dart:1233)
#6      _RootZone.runUnaryGuarded (dart:async/zone.dart:1586)
#7      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
#8      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271)
#9      _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123)
#10     _WhereStream._handleData (dart:async/stream_pipe.dart:195)
#11     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153)
#12     _RootZone.runUnaryGuarded (dart:async/zone.dart:1586)
#13     CastStreamSubscription._onData (dart:_internal/async_cast.dart:85)
#14     _RootZone.runUnaryGuarded (dart:async/zone.dart:1586)
#15     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
#16     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271)
#17     _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123)
#18     _WhereStream._handleData (dart:async/stream_pipe.dart:195)
#19     _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153)
#20     _RootZone.runUnaryGuarded (dart:async/zone.dart:1586)
#21     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339)
#22     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271)
#23     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774)
#24     _StreamController._add (dart:async/stream_controller.dart:648)
#25     _StreamController.add (dart:async/stream_controller.dart:596)
#26     _AsyncDirectoryLister.next.<anonymous closure> (dart:io/directory_impl.dart:383)
<asynchronous [suspension>[]
´´´
Link for example: https://www.mediafire.com/file/9rog4wgzysdrlv2/Takeout.zip/file
TheLastGimbus commented 1 year ago

Ah, shit - i fixed decoding in reading timestamps, but introduced the problem again with new archive detection - i will fix this fast 👍

TheLastGimbus commented 1 year ago

there should be no non-try-catch instances of readAsString() now :+1: