Skip to content

Commit

Permalink
chore: bump libs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmaialva33 committed Sep 26, 2024
1 parent 1e5bee0 commit 826537c
Show file tree
Hide file tree
Showing 75 changed files with 435 additions and 479 deletions.
12 changes: 6 additions & 6 deletions WinxMusic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
from pytgcalls.exceptions import NoActiveGroupCall

import config
from config import BANNED_USERS
from WinxMusic import HELPABLE, LOGGER, app, userbot
from WinxMusic.core.call import Winx
from WinxMusic.plugins import ALL_MODULES
from WinxMusic.utils.database import get_banned_users, get_gbanned
from config import BANNED_USERS


async def init():
if (
not config.STRING1
and not config.STRING2
and not config.STRING3
and not config.STRING4
and not config.STRING5
not config.STRING1
and not config.STRING2
and not config.STRING3
and not config.STRING4
and not config.STRING5
):
LOGGER("WinxMusic").error(
"No Assistant Clients Vars Defined!.. Exiting Process."
Expand Down
24 changes: 12 additions & 12 deletions WinxMusic/core/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
)

import config
from strings import get_string
from WinxMusic import LOGGER, YouTube, app
from WinxMusic.misc import db
from WinxMusic.utils.database import (
Expand All @@ -36,6 +35,7 @@
from WinxMusic.utils.inline.play import stream_markup, telegram_markup
from WinxMusic.utils.stream.autoclear import auto_clean
from WinxMusic.utils.thumbnails import gen_thumb
from strings import get_string


async def _clear_(chat_id):
Expand Down Expand Up @@ -145,11 +145,11 @@ async def force_stop_stream(self, chat_id: int):
pass

async def skip_stream(
self,
chat_id: int,
link: str,
video: Union[bool, str] = None,
image: Union[bool, str] = None,
self,
chat_id: int,
link: str,
video: Union[bool, str] = None,
image: Union[bool, str] = None,
):
assistant = await group_assistant(self, chat_id)
audio_stream_quality = await get_audio_bitrate(chat_id)
Expand Down Expand Up @@ -206,12 +206,12 @@ async def stream_call(self, link):
await assistant.leave_call(config.LOG_GROUP_ID)

async def join_call(
self,
chat_id: int,
original_chat_id: int,
link,
video: Union[bool, str] = None,
image: Union[bool, str] = None,
self,
chat_id: int,
original_chat_id: int,
link,
video: Union[bool, str] = None,
image: Union[bool, str] = None,
):
assistant = await group_assistant(self, chat_id)
audio_stream_quality = await get_audio_bitrate(chat_id)
Expand Down
3 changes: 1 addition & 2 deletions WinxMusic/core/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import shlex
from typing import Tuple

from git import Repo
from git.exc import GitCommandError, InvalidGitRepositoryError

import config

from git import Repo
from ..logging import LOGGER

loop = asyncio.get_event_loop_policy().get_event_loop()
Expand Down
1 change: 0 additions & 1 deletion WinxMusic/core/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pyrogram import Client

import config

from ..logging import LOGGER

TEMP_MONGODB = "mongodb+srv://adityapatel:[email protected]/?retryWrites=true&w=majority"
Expand Down
1 change: 0 additions & 1 deletion WinxMusic/core/userbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pyrogram import Client

import config

from ..logging import LOGGER

assistants = []
Expand Down
1 change: 0 additions & 1 deletion WinxMusic/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import config
from WinxMusic.core.mongo import pymongodb

from .logging import LOGGER

SUDOERS = filters.user()
Expand Down
2 changes: 1 addition & 1 deletion WinxMusic/platforms/Carbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self):

async def generate(self, text: str, user_id):
async with aiohttp.ClientSession(
headers={"Content-Type": "application/json"},
headers={"Content-Type": "application/json"},
) as ses:
params = {
"code": text,
Expand Down
59 changes: 29 additions & 30 deletions WinxMusic/platforms/Telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Voice

import config
from config import lyrical
from WinxMusic import app

from config import lyrical
from ..utils.formatters import convert_bytes, get_readable_time, seconds_to_min

downloader = {}
Expand All @@ -23,13 +22,13 @@ def __init__(self):

async def send_split_text(self, message, string):
n = self.chars_limit
out = [(string[i : i + n]) for i in range(0, len(string), n)]
out = [(string[i: i + n]) for i in range(0, len(string), n)]
j = 0
for x in out:
if j <= 2:
j += 1
await message.reply_text(x)
return True
return True

async def get_link(self, message):
if message.chat.username:
Expand All @@ -43,42 +42,42 @@ async def get_filename(self, file, audio: Union[bool, str] = None):
try:
file_name = file.file_name
if file_name is None:
file_name = "ᴛᴇʟᴇɢʀᴀᴍ ᴀᴜᴅɪᴏ ғɪʟᴇ" if audio else "ᴛᴇʟᴇɢʀᴀᴍ ᴠɪᴅᴇᴏ ғɪʟᴇ"
file_name = "Arquivo de áudio do Telegram" if audio else "Arquivo de vídeo do Telegram"

except:
file_name = "ᴛᴇʟᴇɢʀᴀᴍ ᴀᴜᴅɪᴏ ғɪʟᴇ" if audio else "ᴛᴇʟᴇɢʀᴀᴍ ᴠɪᴅᴇᴏ ғɪʟᴇ"
file_name = "Arquivo de áudio do Telegram" if audio else "Arquivo de vídeo do Telegram"
return file_name

async def get_duration(self, file):
try:
dur = seconds_to_min(file.duration)
except:
dur = "Unknown"
dur = "Desconhecido"
return dur

async def get_filepath(
self,
audio: Union[bool, str] = None,
video: Union[bool, str] = None,
self,
audio: Union[bool, str] = None,
video: Union[bool, str] = None,
):
if audio:
try:
file_name = (
audio.file_unique_id
+ "."
+ (
(audio.file_name.split(".")[-1])
if (not isinstance(audio, Voice))
else "ogg"
)
audio.file_unique_id
+ "."
+ (
(audio.file_name.split(".")[-1])
if (not isinstance(audio, Voice))
else "ogg"
)
)
except:
file_name = audio.file_unique_id + "." + ".ogg"
file_name = os.path.join(os.path.realpath("downloads"), file_name)
if video:
try:
file_name = (
video.file_unique_id + "." + (video.file_name.split(".")[-1])
video.file_unique_id + "." + (video.file_name.split(".")[-1])
)
except:
file_name = video.file_unique_id + "." + "mp4"
Expand All @@ -92,8 +91,8 @@ async def is_streamable_url(self, url: str) -> bool:
if response.status_code == 200:
content_type = response.headers.get("Content-Type", "")
if (
"application/vnd.apple.mpegurl" in content_type
or "application/x-mpegURL" in content_type
"application/vnd.apple.mpegurl" in content_type
or "application/x-mpegURL" in content_type
):
return True
if url.endswith(".m3u8") or url.endswith(".index"):
Expand All @@ -119,7 +118,7 @@ async def progress(current, total):
[
[
InlineKeyboardButton(
text="🚦 ᴄᴀɴᴄᴇʟ ᴅᴏᴡɴʟᴏᴀᴅɪɴɢ",
text="🚦 Cancelar Download",
callback_data="stop_downloading",
),
]
Expand All @@ -133,19 +132,19 @@ async def progress(current, total):
downloader[message.id] = eta
eta = get_readable_time(eta)
if not eta:
eta = "0 sec"
eta = "0 seg"
total_size = convert_bytes(total)
completed_size = convert_bytes(current)
speed = convert_bytes(speed)
text = f"""
**{app.mention} ᴛᴇʟᴇɢʀᴀᴍ ᴍᴇᴅɪᴀ ᴅᴏᴡɴʟᴏᴀᴅᴇʀ**
**{app.mention} Downloader de Mídia do Telegram**
**ᴛᴏᴛᴀʟ ғɪʟᴇ sɪᴢᴇ:** {total_size}
**ᴄᴏᴍᴘʟᴇᴛᴇᴅ:** {completed_size}
**ᴘᴇʀᴄᴇɴᴛᴀɢᴇ:** {percentage[:5]}%
**Tamanho total do arquivo:** {total_size}
**Concluído:** {completed_size}
**Porcentagem:** {percentage[:5]}%
**sᴘᴇᴇᴅ:** {speed}/s
**ᴇʟᴘᴀsᴇᴅ ᴛɪᴍᴇ:** {eta}"""
**Velocidade:** {speed}/s
**Tempo restante:** {eta}"""
try:
await mystic.edit_text(text, reply_markup=upl)
except:
Expand All @@ -164,7 +163,7 @@ async def progress(current, total):
progress=progress,
)
await mystic.edit_text(
"sᴜᴄᴄᴇssғᴜʟʟʏ ᴅᴏᴡɴʟᴏᴀᴅᴇᴅ...\n ᴘʀᴏᴄᴇssɪɴɢ ғɪʟᴇ ɴᴏᴡ"
"Download concluído com sucesso...\nProcessando arquivo agora"
)
downloader.pop(message.id)
except:
Expand All @@ -178,7 +177,7 @@ async def progress(current, total):
low = min(timers)
eta = get_readable_time(low)
except:
eta = "Unknown"
eta = "Desconhecido"
await mystic.edit_text(_["tg_1"].format(eta))
return False

Expand Down
28 changes: 14 additions & 14 deletions WinxMusic/platforms/Youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def url(self, message_1: Message) -> Union[str, None]:
return entity.url
if offset in (None,):
return None
return text[offset : offset + length]
return text[offset: offset + length]

async def details(self, link: str, videoid: Union[bool, str] = None):
if videoid:
Expand Down Expand Up @@ -309,10 +309,10 @@ async def formats(self, link: str, videoid: Union[bool, str] = None):
return formats_available, link

async def slider(
self,
link: str,
query_type: int,
videoid: Union[bool, str] = None,
self,
link: str,
query_type: int,
videoid: Union[bool, str] = None,
):
if videoid:
link = self.base + link
Expand All @@ -327,15 +327,15 @@ async def slider(
return title, duration_min, thumbnail, vidid

async def download(
self,
link: str,
mystic,
video: Union[bool, str] = None,
videoid: Union[bool, str] = None,
songaudio: Union[bool, str] = None,
songvideo: Union[bool, str] = None,
format_id: Union[bool, str] = None,
title: Union[bool, str] = None,
self,
link: str,
mystic,
video: Union[bool, str] = None,
videoid: Union[bool, str] = None,
songaudio: Union[bool, str] = None,
songvideo: Union[bool, str] = None,
format_id: Union[bool, str] = None,
title: Union[bool, str] = None,
) -> str:
if videoid:
vidid = link
Expand Down
2 changes: 1 addition & 1 deletion WinxMusic/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import sys
from os.path import abspath, dirname, isfile, join

from config import EXTRA_PLUGINS, EXTRA_PLUGINS_FOLDER, EXTRA_PLUGINS_REPO
from WinxMusic import LOGGER
from config import EXTRA_PLUGINS, EXTRA_PLUGINS_FOLDER, EXTRA_PLUGINS_REPO

logger = LOGGER(__name__)

Expand Down
4 changes: 2 additions & 2 deletions WinxMusic/plugins/admins/auth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pyrogram import Client, filters
from pyrogram.types import Message

from config import BANNED_USERS, adminlist
from strings import get_command
from WinxMusic import app
from WinxMusic.utils.database import (
delete_authuser,
Expand All @@ -12,6 +10,8 @@
)
from WinxMusic.utils.decorators import AdminActual, language
from WinxMusic.utils.formatters import int_to_alpha
from config import BANNED_USERS, adminlist
from strings import get_command

AUTH_COMMAND = get_command("AUTH_COMMAND")
UNAUTH_COMMAND = get_command("UNAUTH_COMMAND")
Expand Down
18 changes: 9 additions & 9 deletions WinxMusic/plugins/admins/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
from pyrogram import Client, filters
from pyrogram.types import CallbackQuery, InlineKeyboardMarkup

from config import (
BANNED_USERS,
SOUNCLOUD_IMG_URL,
STREAM_IMG_URL,
SUPPORT_GROUP,
TELEGRAM_AUDIO_URL,
TELEGRAM_VIDEO_URL,
adminlist,
)
from WinxMusic import YouTube, app
from WinxMusic.core.call import Winx
from WinxMusic.misc import SUDOERS, db
Expand All @@ -31,6 +22,15 @@
from WinxMusic.utils.inline.play import stream_markup, telegram_markup
from WinxMusic.utils.stream.autoclear import auto_clean
from WinxMusic.utils.thumbnails import gen_thumb
from config import (
BANNED_USERS,
SOUNCLOUD_IMG_URL,
STREAM_IMG_URL,
SUPPORT_GROUP,
TELEGRAM_AUDIO_URL,
TELEGRAM_VIDEO_URL,
adminlist,
)

wrong = {}
down_vote = {}
Expand Down
4 changes: 2 additions & 2 deletions WinxMusic/plugins/admins/loop.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from pyrogram import Client, filters
from pyrogram.types import Message

from config import BANNED_USERS
from strings import get_command
from WinxMusic import app
from WinxMusic.utils.database.memorydatabase import get_loop, set_loop
from WinxMusic.utils.decorators import AdminRightsCheck
from config import BANNED_USERS
from strings import get_command

LOOP_COMMAND = get_command("LOOP_COMMAND")

Expand Down
Loading

0 comments on commit 826537c

Please sign in to comment.