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.user_token = user_token
|
||||
|
||||
def on_created(self, event):
|
||||
def on_moved(self, event):
|
||||
self.upload_report(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),
|
||||
files={"file": report})
|
||||
print(a.json())
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('user_token', action='store')
|
||||
args = parser.parse_args()
|
||||
|
||||
watch_path = os.path.join(Path.home(), "Documents", "Guild Wars 2", "addons", "arcdps", "arcdps.cbtlogs")
|
||||
print(watch_path)
|
||||
file_pattern = os.path.join("*.zevtc")
|
||||
|
||||
|
||||
observer = Observer()
|
||||
observer.schedule(FileWatchdog(file_pattern, args.user_token), watch_path, recursive=True)
|
||||
observer.start()
|
||||
|
|
@ -42,5 +41,6 @@ def main():
|
|||
while True:
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user