diff --git a/youtube/accounts.py b/youtube/accounts.py index bc0e017..6959fb2 100644 --- a/youtube/accounts.py +++ b/youtube/accounts.py @@ -16,6 +16,9 @@ except FileNotFoundError: # global var for temporary storage of account info accounts = {} +def username_list(): + return accounts.keys() + def save_accounts(): to_save = {username: account for username, account in accounts.items() if account['save']} with open(os.path.join(settings.data_dir, 'accounts.txt'), 'w', encoding='utf-8') as f: diff --git a/youtube/comments.css b/youtube/comments.css index 79d88c3..5fd9063 100644 --- a/youtube/comments.css +++ b/youtube/comments.css @@ -23,15 +23,29 @@ width: 100%; } +.comment-form{ + display: grid; + align-content: start; + justify-items: start; + align-items: start; +} + #comment-account-options{ + display:grid; + grid-auto-flow: column; + grid-column-gap: 10px; + margin-top:10px; + margin-bottom:10px; + } + #comment-account-options a{ + margin-left:10px; + } + .comments-area{ display:grid; } - .comment-form{ - display:contents; - } .comments-area textarea{ resize: vertical; - margin-top:10px; + justify-self:stretch; } .post-comment-button{ margin-top:10px; diff --git a/youtube/comments.py b/youtube/comments.py index abc0a79..1b22d24 100644 --- a/youtube/comments.py +++ b/youtube/comments.py @@ -1,5 +1,5 @@ import json -from youtube import proto, common +from youtube import proto, common, accounts import base64 from youtube.common import uppercase_escape, default_multi_get, format_text_runs, URL_ORIGIN, fetch_url from string import Template @@ -311,8 +311,21 @@ video_metadata_template = Template('''
''') +account_option_template = Template(''' + ''') + +def comment_box_account_options(): + return ''.join(account_option_template.substitute(username=username) for username in accounts.username_list()) + comment_box_template = Template('''