Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
AsmSafone committed Jun 20, 2024
1 parent cfe3aec commit 0ff8093
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from core.song import Song
from core.admins import is_sudo, is_admin
from core.stream import app, ydl, safone, pytgcalls, start_stream
from core.stream import app, ytdl, safone, pytgcalls, start_stream
from core.groups import (
get_group, get_queue, set_group, set_title, all_groups, clear_queue,
set_default, shuffle_queue)
Expand Down
10 changes: 8 additions & 2 deletions core/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@
"geo_bypass": True,
"nocheckcertificate": True,
}
ydl = YoutubeDL(ydl_opts)
app = Client(config.SESSION, api_id=config.API_ID, api_hash=config.API_HASH)
app = Client(
"MusicPlayerUB",
api_id=config.API_ID,
api_hash=config.API_HASH,
session_string=config.SESSION,
in_memory=True,
)
ytdl = YoutubeDL(ydl_opts)
pytgcalls = PyTgCalls(app)


Expand Down
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded
from core.decorators import language, register, only_admins, handle_error
from core import (
app, ydl, safone, search, is_sudo, is_admin, get_group, get_queue,
app, ytdl, safone, search, is_sudo, is_admin, get_group, get_queue,
pytgcalls, set_group, set_title, all_groups, clear_queue, check_yt_url,
extract_args, start_stream, shuffle_queue, delete_messages,
get_spotify_playlist, get_youtube_playlist)
Expand All @@ -47,6 +47,7 @@
api_id=config.API_ID,
api_hash=config.API_HASH,
bot_token=config.BOT_TOKEN,
in_memory=True,
)
client = bot
else:
Expand Down Expand Up @@ -135,7 +136,7 @@ async def live_stream(_, message: Message, lang):
else:
is_yt_url, url = check_yt_url(args)
if is_yt_url:
meta = ydl.extract_info(url, download=False)
meta = ytdl.extract_info(url, download=False)
formats = meta.get("formats", [meta])
for f in formats:
ytstreamlink = f["url"]
Expand Down
11 changes: 10 additions & 1 deletion startup.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/bash

echo ">> FETCHING UPSTREAM..."
git clone -b dev https://github.com/AsmSafone/MusicPlayer /MusicPlayer
if [ -d "/MusicPlayer" ]; then
echo "Directory exists. Pulling the latest changes..."
cd /MusicPlayer && git pull
else
echo "Directory does not exist. Cloning the repository..."
git clone -b dev https://github.com/AsmSafone/MusicPlayer /MusicPlayer

echo ">> INSTALLING REQUIREMENTS..."
cd /MusicPlayer
pip3 install -U -r requirements.txt

echo ">> STARTING MUSIC PLAYER USERBOT..."
clear
echo "
Expand Down

0 comments on commit 0ff8093

Please sign in to comment.