replace google search by internal search
This commit is contained in:
@@ -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 = 'S2-SuoiNguonHanhPhuc'
|
||||
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('_',' ')+ '.' + 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/%s/%s"><span><i class="ti ti-volume fs-6"></i> %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
|
||||
|
||||
Reference in New Issue
Block a user