to learn goupby learn pandas groupby groupby learn pandas groupby 优化正则提取番号和集数 待理解下载图片逻辑 还有剪裁+背景图逻辑 修改所有config[ 将整理生成nfo的代码 可缓存番号信息和缩略图和海报 可以识别番号后集数和尾部集数,赞不能分辨-C中文字幕片 改正一个错误 嵌套字典存储数据 整理函数 修正匹配时间正则 pipenv 添加依赖 修改优先取三位数字的规则:heyzo四位数除外 添加了依赖 和 有番号的优化 修改了啥 我也记不得了
81 lines
1.6 KiB
Python
Executable File
81 lines
1.6 KiB
Python
Executable File
import os
|
|
import re
|
|
from itertools import groupby
|
|
|
|
import fuckit as fuckit
|
|
import pandas as pd
|
|
from tenacity import retry, stop_after_delay, wait_fixed
|
|
|
|
|
|
def go():
|
|
a = [1, 2, 3, 4, 5, 6]
|
|
# [print(x) for x in a]
|
|
# [print(x) for x in a]
|
|
a1 = groupby(a, key=lambda k: (k / 2))
|
|
for i in a1:
|
|
print(i)
|
|
for i in a1:
|
|
print(i)
|
|
|
|
|
|
class TryDo:
|
|
def __init__(self, func, times=3):
|
|
self.tries = times
|
|
self.func = func
|
|
|
|
def __iter__(self):
|
|
self.currentTry = 1
|
|
return self
|
|
|
|
def __next__(self):
|
|
if self.currentTry > self.tries:
|
|
raise StopIteration(False)
|
|
else:
|
|
self.currentTry += 1
|
|
self.func()
|
|
raise StopIteration(True)
|
|
|
|
# def do(self):
|
|
|
|
|
|
@retry(stop=stop_after_delay(3), wait=wait_fixed(2))
|
|
def stop_after_10_s():
|
|
print("Stopping after 10 seconds")
|
|
raise Exception
|
|
|
|
|
|
# f = iter( TryDo(do_something, 5))
|
|
|
|
# stop_after_10_s()
|
|
def errorfunc():
|
|
raise Exception
|
|
|
|
|
|
def okfunc():
|
|
print("ok")
|
|
|
|
|
|
# with fuckit:
|
|
# errorfunc()
|
|
# okfunc()
|
|
# re.match()
|
|
|
|
r = re.search(r'(?<=999)-?((?P<alpha>([A-Z](?![A-Z])))|(?P<num>\d(?!\d)))', "IPTD-999-B-彼女の姉貴とイケナイ関係-RIO", re.I)
|
|
#
|
|
print(r.groupdict())
|
|
print(r.groupdict()['alpha'])
|
|
print(r.group(2))
|
|
import re
|
|
|
|
line = "Cats are smarter than dogs"
|
|
matchObj = re.search(r'(?<=a)(.*) are (.*?) .*', line, re.M | re.I)
|
|
if matchObj:
|
|
print("matchObj.group() : ", matchObj.group())
|
|
print("matchObj.group(1) : ", matchObj.group(1))
|
|
print("matchObj.group(2) : ", matchObj.group(2))
|
|
else:
|
|
print("No match!!")
|
|
|
|
# print(r[-1])
|
|
# print(newList)
|