replace google search by internal search

This commit is contained in:
2026-10-10 12:03:48 +02:00
parent 8f69a2bb8a
commit d67484ecac
8 changed files with 264 additions and 16 deletions
+54
View File
@@ -0,0 +1,54 @@
"""
Lister tous les noms de fichier d'un dossier
Formater pour les affichier dans une liste
"""
import os
from mutagen.mp3 import MP3
def mutagen_length(path):
try:
audio = MP3(path)
length = audio.info.length
return length
except:
return None
# Chemin du répertoire que vous souhaitez explorer
collection = 'khoa-thien'
chemin = '/Users/phuoc/pyramid/cao_sunyata_media/TuyenTapNiSu/' + collection
# Obtenir la liste de tous les fichiers et dossiers
items = os.listdir(chemin)
sorted_items = sorted(items)
# Afficher le contenu
print("<br>")
n = 0
for filename in sorted_items:
if filename != '.DS_Store':
# get duration of mp3 file
length = mutagen_length(chemin + '/' + filename)
duration = str(int(length/60)) + ':' + str(int(length%60))
w = filename.split('-')
s = w[0] + '. ' + w[1].replace('_',' ')
title = ' '.join(elem.capitalize() for elem in s.split())
ligne = '<p class="fs-4 ps-4">'
ligne += '<a href="https://media.meditation-sunyata.paris/%s/%s"><span><i class="ti ti-volume fs-6"></i>&nbsp;&nbsp;&nbsp;%s</a> (%s)</p>' % (collection, filename, title, duration)
print(ligne)
n += 1
print("<br>")
print('Total %s ' % n)
def mutagen_length(path):
try:
audio = MP3(path)
length = audio.info.length
return length
except:
return None