Ajout liste exclusion + logs
This commit is contained in:
@@ -11,6 +11,7 @@ from difflib import SequenceMatcher
|
||||
from heapq import nlargest as _nlargest
|
||||
|
||||
class ChefMou(Plugin):
|
||||
listRemove = ["", "Souba", "Basse", "Trombone", "Trompette", "Sax Mib", "Clarinette", "Midi", "Original", "Enregistrement", "Paroles", "Commentaire"]
|
||||
async def start(self) -> None:
|
||||
self.on_external_config_update()
|
||||
|
||||
@@ -56,6 +57,7 @@ class ChefMou(Plugin):
|
||||
"""
|
||||
)
|
||||
else:
|
||||
self.log.info("Commande : " + pattern)
|
||||
if pattern == "morceau":
|
||||
soup = await self.get_site_content()
|
||||
s = soup.findAll('th', background='/fond3.gif')
|
||||
@@ -74,11 +76,14 @@ class ChefMou(Plugin):
|
||||
return
|
||||
soup = await self.get_site_content()
|
||||
# Récuperer liste morceaux
|
||||
s = soup.select('th', background='/fond3.gif')
|
||||
#s = soup.select('th', background='/fond3.gif')
|
||||
s = soup.select('th')
|
||||
# Object bts en str
|
||||
parsedList=[]
|
||||
originalList=[]
|
||||
for ts in s:
|
||||
if ts.text in self.listRemove :
|
||||
continue
|
||||
fullTitre = ts.text
|
||||
#Supression des ()
|
||||
parsedList.append(re.sub("[\(\[].*?[\)\]]", "", fullTitre))
|
||||
@@ -89,6 +94,8 @@ class ChefMou(Plugin):
|
||||
idxTitre = self.get_close_matches_indexes(chunks[2], parsedList, cutoff=0.4)
|
||||
# Si trouvé le chercher sinon erreur
|
||||
if len(idxTitre) > 0 :
|
||||
for el in idxTitre :
|
||||
self.log.info(parsedList[el] + ': ' + str(SequenceMatcher(None, chunks[2], parsedList[el]).ratio()))
|
||||
#Et on recherche dans la liste originale avec le titre original
|
||||
s = soup.find('th', string=originalList[idxTitre[0]])
|
||||
t = s.parent.findAll('a')
|
||||
|
||||
Reference in New Issue
Block a user