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
+22 -1
View File
@@ -3,7 +3,15 @@ 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 = 'S3-TiengHatGiuaTroi'
@@ -19,11 +27,15 @@ 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('_',' ')+ '.' + w[2]
title = ' '.join(elem.capitalize() for elem in s.split())
ligne = '<p class="fs-4 ps-4">'
ligne += '<a href="https://media.meditation-sunyata.paris/TuyenTapNiSu/%s/%s"><span><i class="ti ti-volume fs-6"></i>&nbsp;&nbsp;&nbsp;%s</a></p>' % (collection, filename, title)
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
@@ -31,3 +43,12 @@ print("<br>")
print('Total %s ' % n)
def mutagen_length(path):
try:
audio = MP3(path)
length = audio.info.length
return length
except:
return None