#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
import mysql.connector
import requests
import emoji
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=/"
@ -9,10 +10,10 @@ session = requests.Session()
# CONNESSIONE AL DB
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="Lost66tmv",
database="lordb"
host="lordns.ddns.net",
user="onedrivelink",
password="Dinosauroincatenato98",
database="lordb_backup"
)
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"
val = (f'{link}',f'%{value}%')
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:
text = f"Modificato : {value}"
writeToText(text)
@ -31,7 +37,7 @@ def DBSearchAndUpdate(link,value):
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)
@ -88,7 +94,7 @@ def fileFinderDB(nameFile, rawURL, data, counter,epstyle):
fileName = f"{nameFile}E0{counter}"
elif counter < 10:
fileName = f"{nameFile} Ep 0{counter}"
elif counter>10 and epstyle:
elif counter>=10 and epstyle:
fileName = f"{nameFile}E{counter}"
else:
fileName = f"{nameFile} Ep {counter}"
@ -99,7 +105,7 @@ def fileFinderDB(nameFile, rawURL, data, counter,epstyle):
DBSearchAndUpdate(link,fileName)
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")