我使用python非常糟糕,但我正在努力学习。所以我有一个脚本,为我提取.zip和.rar文件,并且完美无缺,现在我唯一要实现的是,如果脚本提取.zip或.rar我希望它使用Pushbullet发送一个通知我的手机。这是通过pushbullet.py
实现的无论如何这里是脚本:
import os
from subprocess import check_call
from os.path import join
from pushbullet import Pushbullet
from pyunpack import Archive
pb = Pushbullet("APIkey")
path = "/mnt/synology/Torrents/completed"
for root, dirs, files in os.walk(path):
if not any(f.endswith(".mkv") for f in files):
for file in files:
pth = join(root, file)
found_r = False
try:
if file.endswith(".zip"):
push = pb.push_note("NUC", "Extracting")
Archive(pth).extractall(root)
found_zip = True
elif not found_r and file.endswith((".rar")):
push = pb.push_note("NUC", "Extracting")
Archive(pth).extractall(root)
found_r = True
break
except:
pass
所以现在它在发现的每场比赛中都推到我的手机上,这是很多比赛,而不是我想要的。我希望它能够成功推进提取。
有谁知道解决方案?