(back) Add location for albums

This commit is contained in:
2023-01-29 19:38:24 +01:00
parent cf8cd046f4
commit 7e0a791fbe
5 changed files with 56 additions and 20 deletions

View File

@@ -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']

View File

@@ -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"
}
}
}
}
}

View File

@@ -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": {