diff --git a/App/.idea/deployment.xml b/App/.idea/deployment.xml new file mode 100644 index 0000000..45d90b0 --- /dev/null +++ b/App/.idea/deployment.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App/.idea/inspectionProfiles/Project_Default.xml b/App/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..bb2ce98 --- /dev/null +++ b/App/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,27 @@ + + + + \ No newline at end of file diff --git a/App/.idea/vcs.xml b/App/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/App/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App/application.py b/App/application.py new file mode 100644 index 0000000..a36e67e --- /dev/null +++ b/App/application.py @@ -0,0 +1,47 @@ +from argparse import ArgumentParser, Namespace + + +def main(arguments: Namespace): + from os import path + token = arguments.token + youtube_api_key = arguments.youtube + creator_id = arguments.creator + must_show_version = arguments.version + if must_show_version: + print("Version") + exit(0) + if not path.exists("app_data.dict"): + if not token: + ValueError("You must add token at least the first time you execute this app") + elif not youtube_api_key: + ValueError("You must include the YouTube API Key at least the first time you execute this app") + elif not creator_id: + ValueError("You must include the creator ID (Telegram) at least the first time you execute this app") + else: + with open("app_data.dict", "wb") as app_data_file: + import pickle + app_data = {"TOKEN": token, + "YT_API": youtube_api_key, + "CREATOR_ID": creator_id} + pickle.dump(app_data, app_data_file, pickle.HIGHEST_PROTOCOL) + + +if __name__ == '__main__': + args = ArgumentParser() + args.add_argument("-t", + "--token", + help="Telegram token obtained via BotFather", + type=str) + args.add_argument("-y", + "--youtube", + help="YouTube API Key", + type=str) + args.add_argument("-c", + "--creator", + help="Telegram ID of the creator", + type=int) + args.add_argument("-v", + "--version", + help="Application version", + action="store_true") + main(args.parse_args())