mirror of
https://github.com/skoobasteeve/telegram-moviebot.git
synced 2026-03-20 03:28:57 +00:00
add debug env variable
This commit is contained in:
@@ -19,6 +19,7 @@ bot_token = os.environ.get("TG_BOT_TOKEN")
|
|||||||
|
|
||||||
country = os.environ.get("STREAMING_COUNTRY") or "us"
|
country = os.environ.get("STREAMING_COUNTRY") or "us"
|
||||||
filter_user = os.environ.get("TG_BOT_USER")
|
filter_user = os.environ.get("TG_BOT_USER")
|
||||||
|
logging_debug = os.environ.get("TG_DEBUG")
|
||||||
|
|
||||||
tmdb_url = "https://api.themoviedb.org/3"
|
tmdb_url = "https://api.themoviedb.org/3"
|
||||||
tmdb_headers = {
|
tmdb_headers = {
|
||||||
@@ -33,12 +34,19 @@ sa_headers = {
|
|||||||
'x-rapidapi-key': sa_api_token
|
'x-rapidapi-key': sa_api_token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updater = Updater(token=bot_token, use_context=True)
|
updater = Updater(token=bot_token, use_context=True)
|
||||||
dispatcher = updater.dispatcher
|
dispatcher = updater.dispatcher
|
||||||
|
|
||||||
logging.basicConfig(
|
|
||||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
if logging_debug:
|
||||||
level=logging.INFO)
|
logging.basicConfig(
|
||||||
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||||
|
level=logging.DEBUG)
|
||||||
|
else:
|
||||||
|
logging.basicConfig(
|
||||||
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||||
|
level=logging.INFO)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -119,6 +127,7 @@ def movie_lookup(movie, user_firstname):
|
|||||||
|
|
||||||
if not services or sa_response == "404":
|
if not services or sa_response == "404":
|
||||||
tg_reply = tg_reply + "\n\nStreaming not available :\("
|
tg_reply = tg_reply + "\n\nStreaming not available :\("
|
||||||
|
logger.info(f'{user_firstname}: No streaming available for "{movie_title}: ({movie_year})"')
|
||||||
else:
|
else:
|
||||||
for s in services:
|
for s in services:
|
||||||
leaving_epoch = sa_response["streamingInfo"][s]["us"]["leaving"]
|
leaving_epoch = sa_response["streamingInfo"][s]["us"]["leaving"]
|
||||||
|
|||||||
Reference in New Issue
Block a user