Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First commit of the application - created methods for main and first …
…setup
  • Loading branch information
Javinator9889 committed Jun 18, 2018
1 parent 81ef91d commit 79d85e3
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
14 changes: 14 additions & 0 deletions App/.idea/deployment.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions App/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions App/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions 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())

0 comments on commit 79d85e3

Please sign in to comment.