replace google search by internal search
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" name="criteria">
|
||||
<input type="text" class="form-control" name="criteria" value="{{ criteria }}"">
|
||||
<button class="btn btn-primary" type="submit" name="form.submitted">Rechercher</button>
|
||||
</div>
|
||||
<!--
|
||||
@@ -24,7 +24,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Titre</th>
|
||||
<th>Tags</th>
|
||||
<th>Topic</th>
|
||||
<th>Date</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@@ -37,7 +37,10 @@
|
||||
{{ entry.title }}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ entry.tag }}</td>
|
||||
<td>
|
||||
<a href="{{ request.route_url('topic', topic=entry.topic_id) }}">
|
||||
{{ entry.topic_id }} - {{ entry.tag }}
|
||||
</td>
|
||||
<td>{{ entry.edit_date }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
<script src="{{request.static_url('cao_sunyata:static/js/simplebar.js')}}"></script>
|
||||
<script src="{{request.static_url('cao_sunyata:static/js/sidebarmenu.js')}}"></script>
|
||||
<script src="{{request.static_url('cao_sunyata:static/js/app.min.js')}}"></script>
|
||||
<!-- moteur de recherche Google -->
|
||||
<script async src="https://cse.google.com/cse.js?cx=b1b21623144614306">
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -233,9 +230,18 @@
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
<!-- Search blog input -->
|
||||
{% if request.path != '/blog_search' %}
|
||||
<div class="gcse-search"></div>
|
||||
<form id="search-form" class="form-horizontal" role="form" action="/blog_search" method="post">
|
||||
<div class="mb-3">
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" name="criteria">
|
||||
<button class="btn btn-primary" type="submit" name="form.submitted">Rechercher</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<!-- display page content-->
|
||||
{% block content %}
|
||||
<p>No content</p>
|
||||
|
||||
@@ -187,13 +187,15 @@ def blog_edit(request):
|
||||
|
||||
@view_config(route_name='blog_search', renderer='../templates/blog_search.jinja2')
|
||||
def blog_search(request):
|
||||
|
||||
if 'criteria' in request.params :
|
||||
criteria = request.params['criteria']
|
||||
else:
|
||||
items = []
|
||||
criteria = ''
|
||||
|
||||
items = []
|
||||
if 'form.submitted' in request.params:
|
||||
criteria = request.params['criteria']
|
||||
# si afficher tous les fiches ?
|
||||
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,
|
||||
}
|
||||
|
||||
@@ -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> %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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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("<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
|
||||
|
||||
@@ -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> %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> %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
|
||||
|
||||
|
||||
@@ -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("<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://mp3.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