|
@@ -9,6 +9,7 @@
|
|
|
|
|
|
|
|
|
try:
|
|
|
+ from names import *
|
|
|
from config import *
|
|
|
from auth import *
|
|
|
from flask import Flask, jsonify, current_app, request
|
|
@@ -44,27 +45,38 @@ def get_now(): # This creates and returns a time stamp
|
|
|
|
|
|
logging.info(f'\n\n\n\n{get_now()} - Webhook called.\n')
|
|
|
|
|
|
-def change_t_name():
|
|
|
+def streaming_t_name():
|
|
|
get_t_info = twitter.verify_credentials()
|
|
|
current_t_name = f't_name = \'{get_t_info["name"]}\''
|
|
|
current_names.append(current_t_name)
|
|
|
logging.info(f'{get_now()} - Current Twitter name is \"{get_t_info["name"]}\".')
|
|
|
|
|
|
- set_t_name = twitter.update_profile(name=t_online_name)
|
|
|
+ set_t_name = twitter.update_profile(name=t_streaming_name)
|
|
|
|
|
|
- logging.info(f'{get_now()} - New Twitter name is {set_t_name["name"]}.')
|
|
|
+ logging.info(f'{get_now()} - Twitter name is now {set_t_name["name"]}.')
|
|
|
|
|
|
-def change_m_name():
|
|
|
+def streaming_m_name():
|
|
|
get_m_info = requests.get('https://fosstodon.org/api/v1/accounts/verify_credentials', headers={'Authorization': m_api_key, 'Accept': 'application/json'})
|
|
|
get_m_info = get_m_info.json()
|
|
|
current_m_name = f'm_name = \'{get_m_info["display_name"]}\''
|
|
|
current_names.append(current_m_name)
|
|
|
logging.info(f'{get_now()} - Current Mastodon name is \"{get_m_info["display_name"]}\".')
|
|
|
|
|
|
- set_m_name = requests.patch('https://fosstodon.org/api/v1/accounts/update_credentials', params={'display_name': m_online_name}, headers={'Authorization': m_api_key, 'Accept': 'application/json'})
|
|
|
+ set_m_name = requests.patch('https://fosstodon.org/api/v1/accounts/update_credentials', params={'display_name': m_streaming_name}, headers={'Authorization': m_api_key, 'Accept': 'application/json'})
|
|
|
set_m_name = set_m_name.json()
|
|
|
|
|
|
- logging.info(f'{get_now()} - New name is \"{set_m_name["display_name"]}\".')
|
|
|
+ logging.info(f'{get_now()} - Mastodon name is now \"{set_m_name["display_name"]}\".')
|
|
|
+
|
|
|
+def reg_t_name():
|
|
|
+ set_t_name = twitter.update_profile(name=t_name)
|
|
|
+
|
|
|
+ logging.info(f'{get_now()} - Twitter name is now {set_t_name["name"]}.')
|
|
|
+
|
|
|
+def reg_m_name():
|
|
|
+ set_m_name = requests.patch('https://fosstodon.org/api/v1/accounts/update_credentials', params={'display_name': m_name}, headers={'Authorization': m_api_key, 'Accept': 'application/json'})
|
|
|
+ set_m_name = set_m_name.json()
|
|
|
+
|
|
|
+ logging.info(f'{get_now()} - Mastodon name is now \"{set_m_name["display_name"]}\".')
|
|
|
|
|
|
def write_current_names():
|
|
|
logging.info(f'{get_now()} - Storing {current_names}.')
|
|
@@ -147,8 +159,8 @@ def start():
|
|
|
discmsg = f'DeadTOm is streaming on Owncast, at https://owncast.deadtom.me. {stream_title}'
|
|
|
if testing != 1:
|
|
|
social_post(msg, discmsg)
|
|
|
- change_m_name()
|
|
|
- change_t_name()
|
|
|
+ streaming_m_name()
|
|
|
+ streaming_t_name()
|
|
|
write_current_names()
|
|
|
else:
|
|
|
logging.info(f'-----------------------\n\n'
|