Как сделать переключатель скрипта python?
Я хочу создать скрипт который перемещает определенные файлы из одной директории в другую и всё что мне сейчас нужно это создать переключатель программы, я попытался создать его кодом ниже, но комбинация не всегда срабатывает, как можно это исправить?
import os
import shutil
from pathlib import Path
from playsound import playsound
from keyboard import read_key
file_source = r'C:\Users\Артём\Downloads'
file_destination_RPG = r'C:\Users\Артём\PycharmProjects\pythonProject1\RPG_resources'
file_destination_flac = r'C:\Users\Артём\Music\flac'
file_destination_mp3 = r'C:\Users\Артём\Music\mp3'
get_files = os.listdir(file_source)
status = True
while True:
if read_key() == '1' and (read_key() == '`' or read_key() == 'ё'):
if status is True:
playsound(r'C:\\Users\Артём\Documents\script\ON.mp3')
status = False
elif status is False:
playsound(r'C:\\Users\Артём\Documents\script\OFF.mp3')
status = True
if status is True:
get_files = os.listdir(file_source)
for file in get_files:
if 'RPG_' in file:
shutil.move(Path(file_source, file), file_destination_RPG)
elif Path(file_source, file).suffix == '.flac':
shutil.move(Path(file_source, file), file_destination_flac)
elif Path(file_source, file).suffix == '.mp3':
shutil.move(Path(file_source, file), file_destination_mp3)