Open Konnichy opened 7 months ago
For information, I fixed an export containing 528 sessions with this Python script:
#!/usr/bin/env python3
import sys
import os
import json
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Usage: {} <export from Session Buddy>".format(sys.argv[0]))
exit(1)
input_file = sys.argv[1]
(root, ext) = os.path.splitext(input_file)
output_file = ''.join([root, "_converted", ext])
with open(input_file, 'r', encoding='utf-8-sig') as file:
content = json.loads(file.read().encode())
for session in content['sessions']:
if 'name' not in session:
session.update({'name': 'Unnamed session'})
if session['created'] is None:
if session['modified'] is not None:
session['created'] = session['modified']
print("Warning: Session '{}': missing creation date fixed with the last modification date.".format(session['name']))
else:
print("Warning: Session '{}' does not have a creation date. You may fix the file manually.".format(session['name']))
with open(output_file, 'w', encoding='utf-8-sig') as file:
json.dump(content, file, indent=3)
Short description
Trying to import in TSM an export from SB, even a small a only one session, fails with error "Read failed". Investigation shows this happens when the SB export contains sessions with no name. I attach 2 versions of the same simple export, one with a session name added.
Steps to reproduce
Expected result
Both files should import successfully. The one without session name may be named "Unnamed session" on the fly (it is display with this name in SB).
Actual result
See above.
Platform information