Little py script adaptation
This commit is contained in:
@@ -263,8 +263,8 @@ class WriteElsJson:
|
||||
"index": {"_index": ITunesParser.ARTIST_INDEX, "_id": persistent_id}
|
||||
}
|
||||
|
||||
file_artist.write(bytes(json.dumps(json_track_index, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
file_artist.write(bytes("\n", 'UTF-8'))
|
||||
# file_artist.write(bytes(json.dumps(json_track_index, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
# file_artist.write(bytes("\n", 'UTF-8'))
|
||||
file_artist.write(bytes(json.dumps(artist, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
file_artist.write(bytes("\n", 'UTF-8'))
|
||||
file_artist.close()
|
||||
@@ -284,8 +284,8 @@ class WriteElsJson:
|
||||
"index": {"_index": ITunesParser.ALBUM_INDEX, "_id": persistent_id}
|
||||
}
|
||||
|
||||
file_albums.write(bytes(json.dumps(json_track_index, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
file_albums.write(bytes("\n", 'UTF-8'))
|
||||
# file_albums.write(bytes(json.dumps(json_track_index, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
# file_albums.write(bytes("\n", 'UTF-8'))
|
||||
file_albums.write(bytes(json.dumps(album, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
file_albums.write(bytes("\n", 'UTF-8'))
|
||||
file_albums.close()
|
||||
@@ -301,8 +301,8 @@ class WriteElsJson:
|
||||
"index": {"_index": ITunesParser.SONG_INDEX, "_id": persistent_id}
|
||||
}
|
||||
|
||||
file.write(bytes(json.dumps(json_track_index, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
file.write(bytes("\n", 'UTF-8'))
|
||||
# file.write(bytes(json.dumps(json_track_index, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
# file.write(bytes("\n", 'UTF-8'))
|
||||
file.write(bytes(json.dumps(song, indent=None, cls=SetEncoder), 'UTF-8'))
|
||||
file.write(bytes("\n", 'UTF-8'))
|
||||
file.close()
|
||||
@@ -335,9 +335,9 @@ if __name__ == '__main__':
|
||||
itunes_parser = ITunesParser().parse(args.file)
|
||||
|
||||
print("Writing JSON files...")
|
||||
WriteElsJson.write_songs(itunes_parser['songs'], "es-songs.json")
|
||||
WriteElsJson.write_artists(itunes_parser['artists'], "es-artists.json")
|
||||
WriteElsJson.write_albums(itunes_parser['albums'], "es-albums.json")
|
||||
WriteElsJson.write_songs(itunes_parser['songs'], "es-songs.jsonl")
|
||||
WriteElsJson.write_artists(itunes_parser['artists'], "es-artists.jsonl")
|
||||
WriteElsJson.write_albums(itunes_parser['albums'], "es-albums.jsonl")
|
||||
|
||||
print('Done!')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user