diff --git a/cao_sunyata/templates/blog_search.jinja2 b/cao_sunyata/templates/blog_search.jinja2 index 3127741..9e17bc3 100644 --- a/cao_sunyata/templates/blog_search.jinja2 +++ b/cao_sunyata/templates/blog_search.jinja2 @@ -9,7 +9,7 @@
- +
- @@ -233,9 +230,18 @@ {% endfor %}

- {%if request.path != '/blog_search'%} - + + {% if request.path != '/blog_search' %} +
+
+
+ + +
+
+
{% endif %} + {% block content %}

No content

diff --git a/cao_sunyata/views/blog.py b/cao_sunyata/views/blog.py index c10fd9b..ea62c6c 100644 --- a/cao_sunyata/views/blog.py +++ b/cao_sunyata/views/blog.py @@ -187,13 +187,15 @@ def blog_edit(request): @view_config(route_name='blog_search', renderer='../templates/blog_search.jinja2') def blog_search(request): - - criteria = '' - - items = [] - if 'form.submitted' in request.params: + if 'criteria' in request.params : criteria = request.params['criteria'] - # si afficher tous les fiches ? + else: + items = [] + criteria = '' + + if 'form.submitted' in request.params or criteria: + # criteria = request.params['criteria'] + # si afficher tous les fiches trouves ? items = get_entries_by_criteria(request, criteria) if 'form.replace' in request.params: @@ -201,7 +203,7 @@ def blog_search(request): request.session.flash("Le changement a été effectué avec succès !", 'success') return { - 'page_title': "Recherche interne", + 'page_title': "Recherche", 'items': items, 'criteria': criteria, } diff --git a/list_KhoaThien.py b/list_KhoaThien.py new file mode 100644 index 0000000..882ee6b --- /dev/null +++ b/list_KhoaThien.py @@ -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("
") +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 = '

' + ligne += '   %s (%s)

' % (collection, filename, title, duration) + print(ligne) + n += 1 + +print("
") + +print('Total %s ' % n) + + +def mutagen_length(path): + try: + audio = MP3(path) + length = audio.info.length + return length + except: + return None + diff --git a/list_SuoiNguonHanhPhuc.py b/list_SuoiNguonHanhPhuc.py new file mode 100644 index 0000000..13512b9 --- /dev/null +++ b/list_SuoiNguonHanhPhuc.py @@ -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("
") +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 = '

' + ligne += '   %s (%s)

' % (collection, filename, title, duration) + print(ligne) + n += 1 + +print("
") + +print('Total %s ' % n) + + +def mutagen_length(path): + try: + audio = MP3(path) + length = audio.info.length + return length + except: + return None + diff --git a/list_TamTinhVoiNhau.py b/list_TamTinhVoiNhau.py new file mode 100644 index 0000000..b8292c4 --- /dev/null +++ b/list_TamTinhVoiNhau.py @@ -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 = 'S1-TamTinhVoiNhau' +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("
") +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 = '

' + ligne += '   %s (%s)

' % (collection, filename, title, duration) + print(ligne) + n += 1 + +print("
") + +print('Total %s ' % n) + + +def mutagen_length(path): + try: + audio = MP3(path) + length = audio.info.length + return length + except: + return None + diff --git a/list_TiengHatGiuaTroi.py b/list_TiengHatGiuaTroi.py index 1662a64..43e23e3 100644 --- a/list_TiengHatGiuaTroi.py +++ b/list_TiengHatGiuaTroi.py @@ -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 = '

' - ligne += '   %s

' % (collection, filename, title) + ligne += '   %s (%s)

' % (collection, filename, title, duration) print(ligne) n += 1 @@ -31,3 +43,12 @@ print("
") print('Total %s ' % n) + +def mutagen_length(path): + try: + audio = MP3(path) + length = audio.info.length + return length + except: + return None + diff --git a/list_phapthoai.py b/list_phapthoai.py new file mode 100644 index 0000000..9c0520d --- /dev/null +++ b/list_phapthoai.py @@ -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 = 'phapthoai-2025' +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("
") +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 = '

' + ligne += '   %s (%s)

' % (collection, filename, title, duration) + print(ligne) + n += 1 + +print("
") + +print('Total %s ' % n) + + +def mutagen_length(path): + try: + audio = MP3(path) + length = audio.info.length + return length + except: + return None +