#Added Emoji plus some minors bugfix

master
MickSlash 2022-12-17 10:11:15 +00:00
parent e894294f76
commit 9b031c9ac3
1 changed files with 14 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import re
from functools import reduce from functools import reduce
import mysql.connector import mysql.connector
import requests import requests
import emoji
LC_URL = "https://onedrive-vercel-index-3lgqsp5f2-tartamafajak22.vercel.app/api/?path=/" LC_URL = "https://onedrive-vercel-index-3lgqsp5f2-tartamafajak22.vercel.app/api/?path=/"
LC_FILEURL = "https://onedrive-vercel-index-3lgqsp5f2-tartamafajak22.vercel.app/api/raw/?path=/" LC_FILEURL = "https://onedrive-vercel-index-3lgqsp5f2-tartamafajak22.vercel.app/api/raw/?path=/"
@ -9,10 +10,10 @@ session = requests.Session()
# CONNESSIONE AL DB # CONNESSIONE AL DB
mydb = mysql.connector.connect( mydb = mysql.connector.connect(
host="localhost", host="lordns.ddns.net",
user="root", user="onedrivelink",
password="Lost66tmv", password="Dinosauroincatenato98",
database="lordb" database="lordb_backup"
) )
def DBSearchAndUpdate(link,value): def DBSearchAndUpdate(link,value):
@ -20,7 +21,12 @@ def DBSearchAndUpdate(link,value):
sql = "UPDATE tbl_episode SET `link embedded` = %s WHERE `titolo` LIKE %s LIMIT 1" sql = "UPDATE tbl_episode SET `link embedded` = %s WHERE `titolo` LIKE %s LIMIT 1"
val = (f'{link}',f'%{value}%') val = (f'{link}',f'%{value}%')
mycursor.execute(sql,val) mycursor.execute(sql,val)
print(f"{mycursor.rowcount} - {value} - {link}") emojitype = ""
if mycursor.rowcount == 1:
emojitype = emoji.emojize(":check_mark_button:")
else:
emojitype = emoji.emojize(":cross_mark:")
print(f"{emojitype} - {value} - {link}\n")
if mycursor.rowcount == 1: if mycursor.rowcount == 1:
text = f"Modificato : {value}" text = f"Modificato : {value}"
writeToText(text) writeToText(text)
@ -31,7 +37,7 @@ def DBSearchAndUpdate(link,value):
def replaceString(string): def replaceString(string):
repls = (".", " "), ("mp4", ""), ("_", " "),("SUB"," "),("ITA"," "),("XX","xx") repls = (".", " "), ("mp4", ""), ("_", " "),("SUB"," "),("ITA"," "),("XX","xx"),("Full HD","")
return reduce(lambda a, kv: a.replace(*kv), repls, string) return reduce(lambda a, kv: a.replace(*kv), repls, string)
@ -88,7 +94,7 @@ def fileFinderDB(nameFile, rawURL, data, counter,epstyle):
fileName = f"{nameFile}E0{counter}" fileName = f"{nameFile}E0{counter}"
elif counter < 10: elif counter < 10:
fileName = f"{nameFile} Ep 0{counter}" fileName = f"{nameFile} Ep 0{counter}"
elif counter>10 and epstyle: elif counter>=10 and epstyle:
fileName = f"{nameFile}E{counter}" fileName = f"{nameFile}E{counter}"
else: else:
fileName = f"{nameFile} Ep {counter}" fileName = f"{nameFile} Ep {counter}"
@ -99,7 +105,7 @@ def fileFinderDB(nameFile, rawURL, data, counter,epstyle):
DBSearchAndUpdate(link,fileName) DBSearchAndUpdate(link,fileName)
def writeToText(text): def writeToText(text):
with open('link_modificati.txt', 'a', encoding='utf-8') as f: with open('link_modificati.txt', 'a', encoding='utf-8', errors="ignore") as f:
f.write(f"{text}\n") f.write(f"{text}\n")