fix toplist folder
This commit is contained in:
parent
7dd107fc72
commit
9173247212
13
app.py
13
app.py
@ -279,17 +279,16 @@ def api_browse(subpath):
|
||||
foldernames = []
|
||||
files = []
|
||||
split_path = subpath.split('/')
|
||||
|
||||
if len(split_path) == 1 and split_path[0] == 'toplist':
|
||||
foldernames = [
|
||||
{'name': 'Predigten', 'path': 'toplist/predigt'},
|
||||
{'name': 'Chorlieder', 'path': 'toplist/chor'},
|
||||
{'name': 'Gemeinsamer Gesang', 'path': 'toplist/gemeinsamer_gesang'},
|
||||
{'name': 'Gruppengesang', 'path': 'toplist/gruppengesang'},
|
||||
{'name': 'Predigten', 'path': 'toplist/Predigt'},
|
||||
{'name': 'Chorlieder', 'path': 'toplist/Chor'},
|
||||
{'name': 'Gemeinsamer Gesang', 'path': 'toplist/Gemeinsamer Gesang'},
|
||||
{'name': 'Gruppenlieder', 'path': 'toplist/Gruppenlied'},
|
||||
]
|
||||
elif len(split_path) > 1 and split_path[0] == 'toplist':
|
||||
files = [
|
||||
hf.generate_top_list(split_path[1])
|
||||
]
|
||||
files = hf.generate_top_list(split_path[1])
|
||||
|
||||
return jsonify({
|
||||
'breadcrumbs': generate_breadcrumbs(subpath),
|
||||
|
||||
@ -104,7 +104,7 @@ def generate_top_list(category):
|
||||
start_str = start_dt.isoformat()
|
||||
|
||||
# Filter for mimes that start with the given type
|
||||
params_for_filter = (start_str)
|
||||
params_for_filter = (start_str,)
|
||||
|
||||
# 1. Top files by access count
|
||||
query = f'''
|
||||
@ -123,17 +123,18 @@ def generate_top_list(category):
|
||||
rows = [
|
||||
{
|
||||
'rel_path': rel_path,
|
||||
'access_count': access_count,
|
||||
'category': extract_structure_from_string(rel_path)[0]
|
||||
}
|
||||
for rel_path in rows
|
||||
for rel_path, access_count in rows
|
||||
]
|
||||
|
||||
rows = [r for r in rows if r['category'] == category][:20]
|
||||
|
||||
|
||||
filelist = [
|
||||
{
|
||||
'name': rel_path,
|
||||
'path': rel_path
|
||||
'name': rel_path.split('/')[-1],
|
||||
'path': rel_path,
|
||||
'file_type': 'music'
|
||||
}
|
||||
for rel_path in [r['rel_path'] for r in rows]
|
||||
]
|
||||
|
||||
@ -117,7 +117,7 @@ function renderContent(data) {
|
||||
contentHTML += `<li class="directory-item"><a href="#" class="directory-link" data-path="gestern">📅 Gestern</a></li>`;
|
||||
}
|
||||
if (data.breadcrumbs.length === 1 ) {
|
||||
contentHTML += `<li class="directory-item"><a href="#" class="directory-link" data-path="toplist">👥 oft gehört</a></li>`;
|
||||
contentHTML += `<li class="directory-item"><a href="#" class="directory-link" data-path="toplist">🔥 oft angehört</a></li>`;
|
||||
}
|
||||
console.log(data.folder_today, data.folder_yesterday);
|
||||
data.directories.forEach(dir => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user