fix watched on wrong file action
This commit is contained in:
parent
db888a8236
commit
bcde960a99
|
|
@ -15,26 +15,25 @@ class FileWatchdog(PatternMatchingEventHandler):
|
||||||
self.pattern = file_pattern
|
self.pattern = file_pattern
|
||||||
self.user_token = user_token
|
self.user_token = user_token
|
||||||
|
|
||||||
def on_created(self, event):
|
def on_moved(self, event):
|
||||||
self.upload_report(event)
|
self.upload_report(event)
|
||||||
|
|
||||||
def upload_report(self, event):
|
def upload_report(self, event):
|
||||||
report = open(os.path.join(event.src_path), 'rb')
|
report = open(os.path.join(event.dest_path), 'rb')
|
||||||
a = requests.post("https://dps.report/uploadContent?json=1&generator=ei&userToken={}".format(self.user_token),
|
a = requests.post("https://dps.report/uploadContent?json=1&generator=ei&userToken={}".format(self.user_token),
|
||||||
files={"file": report})
|
files={"file": report})
|
||||||
print(a.json())
|
print(a.json())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('user_token', action='store')
|
parser.add_argument('user_token', action='store')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
watch_path = os.path.join(Path.home(), "Documents", "Guild Wars 2", "addons", "arcdps", "arcdps.cbtlogs")
|
watch_path = os.path.join(Path.home(), "Documents", "Guild Wars 2", "addons", "arcdps", "arcdps.cbtlogs")
|
||||||
|
print(watch_path)
|
||||||
file_pattern = os.path.join("*.zevtc")
|
file_pattern = os.path.join("*.zevtc")
|
||||||
|
|
||||||
|
|
||||||
observer = Observer()
|
observer = Observer()
|
||||||
observer.schedule(FileWatchdog(file_pattern, args.user_token), watch_path, recursive=True)
|
observer.schedule(FileWatchdog(file_pattern, args.user_token), watch_path, recursive=True)
|
||||||
observer.start()
|
observer.start()
|
||||||
|
|
@ -42,5 +41,6 @@ def main():
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
if __name__ =='__main__':
|
|
||||||
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user