refactor
This commit is contained in:
parent
f45d07acd0
commit
53512e52f9
@ -1,5 +1,20 @@
|
|||||||
[
|
[
|
||||||
|
{ "name": "agraelus", "language": "cs" },
|
||||||
{ "name": "herdyn", "language": "cs" },
|
{ "name": "herdyn", "language": "cs" },
|
||||||
|
{ "name": "czechcloud", "language": "cs" },
|
||||||
|
{ "name": "duklock", "language": "cs" },
|
||||||
|
{ "name": "sterakdary", "language": "cs" },
|
||||||
|
{ "name": "therasablueberry", "language": "cs" },
|
||||||
|
{ "name": "marwex", "language": "cs" },
|
||||||
|
{ "name": "patrikturi", "language": "cs" },
|
||||||
|
{ "name": "artix", "language": "cs" },
|
||||||
|
{ "name": "spajkk", "language": "cs" },
|
||||||
|
{ "name": "liveoliverr", "language": "cs" },
|
||||||
|
{ "name": "fluffcz", "language": "cs" },
|
||||||
|
{ "name": "astatoro", "language": "cs" },
|
||||||
|
{ "name": "nestta", "language": "cs" },
|
||||||
|
{ "name": "cantzer", "language": "cs" },
|
||||||
|
{ "name": "kapesnik69", "language": "cs" },
|
||||||
{ "name": "marty_vole", "language": "cs" },
|
{ "name": "marty_vole", "language": "cs" },
|
||||||
{ "name": "kuruhs", "language": "en" },
|
{ "name": "kuruhs", "language": "en" },
|
||||||
{ "name": "esfandtv", "language": "en" }
|
{ "name": "esfandtv", "language": "en" }
|
||||||
|
@ -1,12 +1,320 @@
|
|||||||
services:
|
services:
|
||||||
scanner_esfandtv:
|
scanner_agraelus:
|
||||||
environment:
|
|
||||||
- CHANNEL_NAME=esfandtv
|
|
||||||
- CHANNEL_LANGUAGE=en
|
|
||||||
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
|
||||||
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=agraelus
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_artix:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=artix
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_astatoro:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=astatoro
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_cantzer:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=cantzer
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_czechcloud:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=czechcloud
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_duklock:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=duklock
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_esfandtv:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=esfandtv
|
||||||
|
- CHANNEL_LANGUAGE=en
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_fluffcz:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=fluffcz
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_herdyn:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=herdyn
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_kapesnik69:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=kapesnik69
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_kuruhs:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=kuruhs
|
||||||
|
- CHANNEL_LANGUAGE=en
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_liveoliverr:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=liveoliverr
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_marty_vole:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=marty_vole
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_marwex:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=marwex
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_nestta:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=nestta
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_patrikturi:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=patrikturi
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_spajkk:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=spajkk
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_sterakdary:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=sterakdary
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
|
volumes:
|
||||||
|
- /shared/transcriptor/clips:/app/clips
|
||||||
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
- /shared/transcriptor/audio:/app/audio
|
||||||
|
- /shared/transcriptor/chat:/app/chat
|
||||||
|
- /shared/transcriptor/models:/app/models
|
||||||
|
- /shared/transcriptor/transcripts:/app/transcripts
|
||||||
|
scanner_therasablueberry:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
- CHANNEL_NAME=therasablueberry
|
||||||
|
- CHANNEL_LANGUAGE=cs
|
||||||
|
- TIMEDELTA_DAYS=4
|
||||||
|
- TIMEDELTA_DAYS_EXACT=true
|
||||||
|
- TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov
|
||||||
|
- TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es
|
||||||
volumes:
|
volumes:
|
||||||
- /shared/transcriptor/clips:/app/clips
|
- /shared/transcriptor/clips:/app/clips
|
||||||
- /shared/transcriptor/vods:/app/vods
|
- /shared/transcriptor/vods:/app/vods
|
||||||
|
@ -13,10 +13,14 @@ compose = {
|
|||||||
for channel in channels:
|
for channel in channels:
|
||||||
service_name = f"scanner_{channel['name']}"
|
service_name = f"scanner_{channel['name']}"
|
||||||
compose["services"][service_name] = {
|
compose["services"][service_name] = {
|
||||||
"image": "twitch-scanner:latest",
|
"build": {
|
||||||
|
"context": "."
|
||||||
|
},
|
||||||
"environment": [
|
"environment": [
|
||||||
f"CHANNEL_NAME={channel['name']}",
|
f"CHANNEL_NAME={channel['name']}",
|
||||||
f"CHANNEL_LANGUAGE={channel['language']}",
|
f"CHANNEL_LANGUAGE={channel['language']}",
|
||||||
|
"TIMEDELTA_DAYS=4",
|
||||||
|
"TIMEDELTA_DAYS_EXACT=true",
|
||||||
"TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov",
|
"TWITCH_CLIENT_ID=a0fuj6tm5ct79clvim9816orphqkov",
|
||||||
"TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es"
|
"TWITCH_CLIENT_SECRET=h7whj3yspxgj1909sgcafx6iz1p1es"
|
||||||
],
|
],
|
||||||
|
27
main.py
27
main.py
@ -12,6 +12,8 @@ import json
|
|||||||
TWITCH_CLIENT_ID = os.environ.get("TWITCH_CLIENT_ID", "")
|
TWITCH_CLIENT_ID = os.environ.get("TWITCH_CLIENT_ID", "")
|
||||||
TWITCH_CLIENT_SECRET = os.environ.get("TWITCH_CLIENT_SECRET", "")
|
TWITCH_CLIENT_SECRET = os.environ.get("TWITCH_CLIENT_SECRET", "")
|
||||||
CHANNEL_NAME = os.environ.get("CHANNEL_NAME", "madmonq")
|
CHANNEL_NAME = os.environ.get("CHANNEL_NAME", "madmonq")
|
||||||
|
TIMEDELTA_DAYS = int(os.environ.get("TIMEDELTA_DAYS", "3"))
|
||||||
|
TIMEDELTA_DAYS_EXACT = os.environ.get("TIMEDELTA_DAYS_EXACT", "false").lower() in ("true", "1", "yes")
|
||||||
CHANNEL_LANGUAGE = os.environ.get("CHANNEL_LANGUAGE", "en")
|
CHANNEL_LANGUAGE = os.environ.get("CHANNEL_LANGUAGE", "en")
|
||||||
SEARCH_KEYWORDS = [
|
SEARCH_KEYWORDS = [
|
||||||
"madmonq",
|
"madmonq",
|
||||||
@ -79,16 +81,31 @@ def get_channel_id(channel_name, token):
|
|||||||
print("Channel not found.")
|
print("Channel not found.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_vods_from_yesterday(channel_id, token):
|
def get_vods(channel_id, token):
|
||||||
headers = {
|
headers = {
|
||||||
"Client-ID": TWITCH_CLIENT_ID,
|
"Client-ID": TWITCH_CLIENT_ID,
|
||||||
"Authorization": f"Bearer {token}"
|
"Authorization": f"Bearer {token}"
|
||||||
}
|
}
|
||||||
prague_tz = ZoneInfo("Europe/Prague")
|
prague_tz = ZoneInfo("Europe/Prague")
|
||||||
today_prague = datetime.now(prague_tz).date()
|
today_prague = datetime.now(prague_tz).date()
|
||||||
yesterday = today_prague - timedelta(days=1) # Change days as needed
|
|
||||||
start_time = datetime.combine(yesterday, time.min).replace(tzinfo=prague_tz)
|
# Define the search range based on TIMEDELTA_DAYS and TIMEDELTA_DAYS_EXACT
|
||||||
end_time = datetime.combine(yesterday, time.max).replace(tzinfo=prague_tz)
|
if TIMEDELTA_DAYS == 0:
|
||||||
|
# Only search for today
|
||||||
|
start_date = today_prague
|
||||||
|
end_date = today_prague
|
||||||
|
else:
|
||||||
|
if TIMEDELTA_DAYS_EXACT:
|
||||||
|
# Only search for the day exactly TIMEDELTA_DAYS ago
|
||||||
|
start_date = today_prague - timedelta(days=TIMEDELTA_DAYS)
|
||||||
|
end_date = start_date
|
||||||
|
else:
|
||||||
|
# Search from TIMEDELTA_DAYS ago up to yesterday
|
||||||
|
start_date = today_prague - timedelta(days=TIMEDELTA_DAYS)
|
||||||
|
end_date = today_prague - timedelta(days=1)
|
||||||
|
|
||||||
|
start_time = datetime.combine(start_date, time.min).replace(tzinfo=prague_tz)
|
||||||
|
end_time = datetime.combine(end_date, time.max).replace(tzinfo=prague_tz)
|
||||||
|
|
||||||
url = f"https://api.twitch.tv/helix/videos?user_id={channel_id}&type=archive&first=100"
|
url = f"https://api.twitch.tv/helix/videos?user_id={channel_id}&type=archive&first=100"
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
@ -237,7 +254,7 @@ def main():
|
|||||||
if not channel_id:
|
if not channel_id:
|
||||||
return
|
return
|
||||||
|
|
||||||
vods = get_vods_from_yesterday(channel_id, token)
|
vods = get_vods(channel_id, token)
|
||||||
if not vods:
|
if not vods:
|
||||||
print("No VODs from yesterday found.")
|
print("No VODs from yesterday found.")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user