Add info. for Album & Artist + print main actions
This commit is contained in:
@@ -137,10 +137,12 @@ class ITunesParser:
|
||||
self._artists[akey] = {
|
||||
'Persistent ID': a_id,
|
||||
'Name': akey,
|
||||
'Artist': akey,
|
||||
'Track Count': 0,
|
||||
'Play Count': 0,
|
||||
'Rating': 0,
|
||||
'Genre': set()
|
||||
'Genre': set(),
|
||||
'Album': set()
|
||||
}
|
||||
|
||||
# Compute information
|
||||
@@ -158,6 +160,9 @@ class ITunesParser:
|
||||
genre_parts = track['Genre'].split('/')
|
||||
self._artists[akey]['Genre'] |= set(genre_parts)
|
||||
|
||||
if 'Album' in track:
|
||||
self._artists[akey]['Album'].add(track['Album'])
|
||||
|
||||
def _process_album(self, track):
|
||||
"""
|
||||
Process albums in the track part of library and return a JSON formated for a bulk ELS request
|
||||
@@ -174,6 +179,7 @@ class ITunesParser:
|
||||
self._albums[akey] = {
|
||||
'Persistent ID': a_id,
|
||||
'Name': akey,
|
||||
'Album': akey,
|
||||
'Track Count': 0,
|
||||
'Play Count': 0,
|
||||
'Rating': 0,
|
||||
@@ -317,12 +323,16 @@ parser.add_argument('-c', '--console', action='store_true',
|
||||
if __name__ == '__main__':
|
||||
args = parser.parse_args()
|
||||
|
||||
print("Parsing file '{}'...".format(args.file))
|
||||
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")
|
||||
|
||||
print('Done!')
|
||||
|
||||
# if args.console:
|
||||
# print(output)
|
||||
# else:
|
||||
|
||||
Reference in New Issue
Block a user