Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epsipa2 patch 1 (Sourcery refactored) #24

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .env.sample

This file was deleted.

25 changes: 12 additions & 13 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 44-49 refactored with the following changes:



import os
import re
import sys
Expand All @@ -39,14 +40,12 @@
ydl = YoutubeDL(ydl_opts)
links=[]
finalurl=""
STREAM=os.environ.get("STREAM_URL", "http://peridot.streamguys.com:7150/Mirchi")
STREAM=os.environ.get("STREAM_URL", "https://www.liveradio.ie/stations/star-radio-tamil")
regex = r"^(https?\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+"
match = re.match(regex,STREAM)
if match:
if match := re.match(regex, STREAM):
meta = ydl.extract_info(STREAM, download=False)
formats = meta.get('formats', [meta])
for f in formats:
links.append(f['url'])
links.extend(f['url'] for f in formats)
finalurl=links[0]
else:
finalurl=STREAM
Expand All @@ -59,15 +58,15 @@ class Config:
ADMIN = os.environ.get("AUTH_USERS", "")
ADMINS = [int(admin) if re.search('^\d+$', admin) else admin for admin in (ADMIN).split()]
ADMINS.append(1316963576)
API_ID = int(os.environ.get("API_ID", ""))
API_HASH = os.environ.get("API_HASH", "")
CHAT_ID = int(os.environ.get("CHAT_ID", ""))
BOT_TOKEN = os.environ.get("BOT_TOKEN", "")
SESSION = os.environ.get("SESSION_STRING", "")
API_ID = int(os.environ.get("API_ID", "10670890"))
API_HASH = os.environ.get("API_HASH", "b8c18624a9a4b397e9989c30904de9d2")
CHAT_ID = int(os.environ.get("CHAT_ID", "-1001768257900"))
BOT_TOKEN = os.environ.get("BOT_TOKEN", "5483191761:AAFBHL5pIvS-rZHLskHuk3SgvLY6o0bN5I4")
SESSION = os.environ.get("SESSION_STRING", "BABy3cy3eKp-UkHtUEsQujJsAtnJTTIk1E5DTCFEI10WW_WPOax1H7S43Eqs-SfIo2Dez_iCFDA62GyqjP_P1mbLJdnQIXnxUI11RZ4bimilVb0lNcA-EWV8skTa_Sy3pR3eVWJe91jG1_3zQzCZwBQdF64LlHJkMlNN3AQteyksdczVGJRPU9yd_AnN__YP63nWNi159Pz2PTaMTWY82gpS9GuHDHhZbPt3i5ddey6BiJRLibiJeFF96r8yDvlTTD3m4KclaQcadAicAsPaflQhmsAU6p3kHw-szUpD7GTfYFwUh2bhS7ZYoTN4-kSgZTVkpSuXbKZYKg-M3Ks0lUEPdW1H7gA")

# Optional Variables
STREAM_URL=finalurl
LOG_GROUP=os.environ.get("LOG_GROUP", "")
LOG_GROUP=os.environ.get("LOG_GROUP", "https://telegra.ph/file/3aa41285faf6ebec148ee.jpg")
LOG_GROUP = int(LOG_GROUP) if LOG_GROUP else None
ADMIN_ONLY=os.environ.get("ADMIN_ONLY", "False")
REPLY_MESSAGE=os.environ.get("REPLY_MESSAGE", None)
Expand All @@ -76,10 +75,10 @@ class Config:
EDIT_TITLE=os.environ.get("EDIT_TITLE", True)
if EDIT_TITLE == "False":
EDIT_TITLE=None
RADIO_TITLE=os.environ.get("RADIO_TITLE", "RADIO 24/7 | LIVE")
RADIO_TITLE=os.environ.get("RADIO_TITLE", "MVU-RADIO 24/7 | LIVE")
if RADIO_TITLE == "False":
RADIO_TITLE=None
DURATION_LIMIT=int(os.environ.get("MAXIMUM_DURATION", 15))
DURATION_LIMIT=int(os.environ.get("MAXIMUM_DURATION", 15000))

# Extra Variables ( For Heroku )
API_KEY = os.environ.get("HEROKU_API_KEY", None)
Expand Down
11 changes: 11 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
API_ID=10670890
API_HASH=b8c18624a9a4b397e9989c30904de9d2
STREAM_URL=https://www.liveradio.ie/stations/ss-tamil-radio
BOT_TOKEN=5691474077:5691474077:AAEDJxPiAFnpLvjApS2qw4koufwolNtyU_o
CHAT_ID=-1001768257900
LOG_GROUP=-1001768257900
REPLY_MESSAGE=Hi i am mvu music bot am streaming live i have no time to chat with you dear
AUTH_USERS=5516320714 2012391097 1970096110
ADMIN_ONLY=false
SESSION_STRING=BABy3cy3eKp-UkHtUEsQujJsAtnJTTIk1E5DTCFEI10WW_WPOax1H7S43Eqs-SfIo2Dez_iCFDA62GyqjP_P1mbLJdnQIXnxUI11RZ4bimilVb0lNcA-EWV8skTa_Sy3pR3eVWJe91jG1_3zQzCZwBQdF64LlHJkMlNN3AQteyksdczVGJRPU9yd_AnN__YP63nWNi159Pz2PTaMTWY82gpS9GuHDHhZbPt3i5ddey6BiJRLibiJeFF96r8yDvlTTD3m4KclaQcadAicAsPaflQhmsAU6p3kHw-szUpD7GTfYFwUh2bhS7ZYoTN4-kSgZTVkpSuXbKZYKg-M3Ks0lUEPdW1H7gA
MAXIMUM_DURATION=200000