diff --git a/iTunesParser.py b/iTunesParser.py index 366e346..ebb54a9 100644 --- a/iTunesParser.py +++ b/iTunesParser.py @@ -192,7 +192,8 @@ class ITunesParser: 'Avg Bit Rate': track['Bit Rate'], 'Min Bit Rate': track['Bit Rate'], # 'Album Artist': '', - 'Total Time': 0 + 'Total Time': 0, + 'Location': '' } # Compute information @@ -207,6 +208,8 @@ class ITunesParser: self._albums[akey]['Play Count'] += play_count self._albums[akey]['Total Time'] += total_time + self._albums[akey]['Location'] = os.path.dirname(track['Location']) + if self._albums[akey]['Min Bit Rate'] > track['Bit Rate']: self._albums[akey]['Min Bit Rate'] = track['Bit Rate'] diff --git a/mapping.albums.json b/mapping.albums.json index c8b4990..f8e60a3 100644 --- a/mapping.albums.json +++ b/mapping.albums.json @@ -1,4 +1,28 @@ { + "settings": { + "analysis": { + "analyzer": { + "custom_path_tree": { + "tokenizer": "custom_hierarchy" + }, + "custom_path_tree_reversed": { + "tokenizer": "custom_hierarchy_reversed" + } + }, + "tokenizer": { + "custom_hierarchy": { + "type": "path_hierarchy", + "delimiter": "/", + "skip": 3 + }, + "custom_hierarchy_reversed": { + "type": "path_hierarchy", + "delimiter": "/", + "reverse": "true" + } + } + } + }, "mappings" : { "properties": { "Artist": { @@ -21,6 +45,19 @@ }, "Genre": { "type": "keyword" + }, + "Location": { + "type": "text", + "fields": { + "tree": { + "type": "text", + "analyzer": "custom_path_tree" + }, + "tree_reversed": { + "type": "text", + "analyzer": "custom_path_tree_reversed" + } + } } } } diff --git a/mapping.songs.json b/mapping.songs.json index ceabb7f..c6320d5 100644 --- a/mapping.songs.json +++ b/mapping.songs.json @@ -1,28 +1,24 @@ { "settings": { "analysis": { - "analyzer": { - "custom_path_tree": { - "tokenizer": "custom_hierarchy" + "analyzer": { + "custom_path_tree": { "tokenizer": "custom_hierarchy" }, + "custom_path_tree_reversed": { "tokenizer": "custom_hierarchy_reversed" } }, - "custom_path_tree_reversed": { - "tokenizer": "custom_hierarchy_reversed" + "tokenizer": { + "custom_hierarchy": { + "type": "path_hierarchy", + "delimiter": "/", + "skip": 3 + }, + "custom_hierarchy_reversed": { + "type": "path_hierarchy", + "delimiter": "/", + "reverse": "true" + } } - }, - "tokenizer": { - "custom_hierarchy": { - "type": "path_hierarchy", - "delimiter": "/", - "skip": 3 - }, - "custom_hierarchy_reversed": { - "type": "path_hierarchy", - "delimiter": "/", - "reverse": "true" - } - } } - }, + }, "mappings" : { "properties": { "Artist": { diff --git a/iTunesAnalyzer.py b/old/iTunesAnalyzer.py similarity index 100% rename from iTunesAnalyzer.py rename to old/iTunesAnalyzer.py diff --git a/iTunesGraphParser.py b/old/iTunesGraphParser.py similarity index 100% rename from iTunesGraphParser.py rename to old/iTunesGraphParser.py