├── search └── __init__.py ├── heroku.yml ├── MusicAndVideo ├── helpers │ ├── other │ │ ├── choose │ │ │ ├── rrc.png │ │ │ ├── finalfont.ttf │ │ │ └── Roboto-Light.ttf │ │ └── generator │ │ │ ├── thumbnail.py │ │ │ └── chattitle.py │ ├── get_admins.py │ ├── get_file_id.py │ ├── admins.py │ ├── decorators.py │ ├── queues.py │ ├── merrors.py │ └── handlers.py ├── truth_or_dare.py ├── user_id.py ├── tts.py ├── github.py ├── userbot.py ├── quote.py ├── admins.py ├── song.py └── play.py ├── README.md ├── requirements.txt ├── Dockerfile ├── main.py ├── config.py ├── .github └── workflows │ └── pylint.yml ├── app.json └── LICENSE /search/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/other/choose/rrc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Abodi20137/ajdjdjwiww8w8w8w/HEAD/MusicAndVideo/helpers/other/choose/rrc.png -------------------------------------------------------------------------------- /MusicAndVideo/helpers/other/choose/finalfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Abodi20137/ajdjdjwiww8w8w8w/HEAD/MusicAndVideo/helpers/other/choose/finalfont.ttf -------------------------------------------------------------------------------- /MusicAndVideo/helpers/other/choose/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Abodi20137/ajdjdjwiww8w8w8w/HEAD/MusicAndVideo/helpers/other/choose/Roboto-Light.ttf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### سورس فريدوم 🥇🔥. 2 | 3 | ## 💜 هيروكو 4 | 5 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/SoRsRR8r9/strong) 6 | 7 | 8 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | TgCrypto 2 | pyrogram==1.4.16 3 | py-tgcalls==0.8.3 4 | requests 5 | aiohttp 6 | aiofiles 7 | pillow 8 | asyncio 9 | wget 10 | python-arq 11 | youtube-search-python==1.4.6 12 | yt-dlp 13 | python-dotenv 14 | gTTS 15 | googletrans==4.0.0rc1 16 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nikolaik/python-nodejs:python3.9-nodejs17 2 | RUN apt-get update \ 3 | && apt-get install -y --no-install-recommends ffmpeg \ 4 | && apt-get clean \ 5 | && rm -rf /var/lib/apt/lists/* 6 | COPY . /app 7 | WORKDIR /app 8 | RUN pip3 install --no-cache-dir --upgrade --requirement requirements.txt 9 | 10 | CMD python3 main.py 11 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/get_admins.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, List, Union 2 | 3 | admins: Dict[int, List[int]] = {} 4 | 5 | 6 | def set(chat_id: int, admins_: List[int]): 7 | admins[chat_id] = admins_ 8 | 9 | 10 | def get(chat_id: int) -> Union[List[int], bool]: 11 | if chat_id in admins: 12 | return admins[chat_id] 13 | 14 | return False 15 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from pytgcalls import idle 4 | 5 | from config import call_py 6 | from MusicAndVideo.quote import arq 7 | 8 | 9 | async def main(): 10 | await call_py.start() 11 | print( 12 | """ 13 | ------------------ 14 | | Userbot Started! | 15 | ------------------ 16 | """ 17 | ) 18 | await idle() 19 | await arq.close() 20 | 21 | 22 | loop = asyncio.get_event_loop() 23 | loop.run_until_complete(main()) 24 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/get_file_id.py: -------------------------------------------------------------------------------- 1 | from pyrogram.types import Message 2 | 3 | 4 | def get_file_id(msg: Message): 5 | if msg.media: 6 | for message_type in ( 7 | "photo", 8 | "animation", 9 | "audio", 10 | "document", 11 | "video", 12 | "video_note", 13 | "voice", 14 | "contact", 15 | "dice", 16 | "poll", 17 | "location", 18 | "venue", 19 | "sticker", 20 | ): 21 | obj = getattr(msg, message_type) 22 | if obj: 23 | setattr(obj, "message_type", message_type) 24 | return obj 25 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/admins.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | from pyrogram.types import Chat 4 | 5 | from MusicAndVideo.helpers.get_admins import get as gett 6 | from MusicAndVideo.helpers.get_admins import set 7 | 8 | 9 | async def get_administrators(chat: Chat) -> List[int]: 10 | get = gett(chat.id) 11 | 12 | if get: 13 | return get 14 | else: 15 | administrators = await chat.get_members(filter="administrators") 16 | to_set = [] 17 | 18 | for administrator in administrators: 19 | if administrator.can_manage_voice_chats: 20 | to_set.append(administrator.user.id) 21 | 22 | set(chat.id, to_set) 23 | return await get_administrators(chat) 24 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/decorators.py: -------------------------------------------------------------------------------- 1 | from typing import Callable 2 | 3 | from pyrogram import Client 4 | from pyrogram.types import Message 5 | 6 | from config import SUDO_USERS 7 | from MusicAndVideo.helpers.admins import get_administrators 8 | 9 | 10 | def authorized_users_only(func: Callable) -> Callable: 11 | async def decorator(client: Client, message: Message): 12 | if message.from_user.id in SUDO_USERS: 13 | return await func(client, message) 14 | 15 | administrators = await get_administrators(message.chat) 16 | 17 | for administrator in administrators: 18 | if administrator == message.from_user.id: 19 | return await func(client, message) 20 | 21 | return decorator 22 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from dotenv import load_dotenv 4 | from pyrogram import Client, filters 5 | from pytgcalls import PyTgCalls 6 | 7 | # For Local Deploy 8 | if os.path.exists(".env"): 9 | load_dotenv(".env") 10 | 11 | # Necessary Vars 12 | API_ID = int(os.getenv("API_ID")) 13 | API_HASH = os.getenv("API_HASH") 14 | SESSION = os.getenv("SESSION") 15 | HNDLR = os.getenv("HNDLR", "/") 16 | SUDO_USERS = list(map(int, os.getenv("SUDO_USERS").split())) 17 | 18 | 19 | contact_filter = filters.create( 20 | lambda _, __, message: (message.from_user and message.from_user.is_contact) 21 | or message.outgoing 22 | ) 23 | 24 | bot = Client(SESSION, API_ID, API_HASH, plugins=dict(root="MusicAndVideo")) 25 | call_py = PyTgCalls(bot) 26 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/queues.py: -------------------------------------------------------------------------------- 1 | QUEUE = {} 2 | 3 | 4 | def add_to_queue(chat_id, songname, link, ref, type, quality): 5 | if chat_id in QUEUE: 6 | chat_queue = QUEUE[chat_id] 7 | chat_queue.append([songname, link, ref, type, quality]) 8 | return int(len(chat_queue) - 1) 9 | else: 10 | QUEUE[chat_id] = [[songname, link, ref, type, quality]] 11 | 12 | 13 | def get_queue(chat_id): 14 | if chat_id in QUEUE: 15 | chat_queue = QUEUE[chat_id] 16 | return chat_queue 17 | else: 18 | return 0 19 | 20 | 21 | def pop_an_item(chat_id): 22 | if chat_id in QUEUE: 23 | chat_queue = QUEUE[chat_id] 24 | chat_queue.pop(0) 25 | return 1 26 | else: 27 | return 0 28 | 29 | 30 | def clear_queue(chat_id): 31 | if chat_id in QUEUE: 32 | QUEUE.pop(chat_id) 33 | return 1 34 | else: 35 | return 0 36 | -------------------------------------------------------------------------------- /MusicAndVideo/truth_or_dare.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from pyrogram import Client, filters 3 | 4 | from config import HNDLR 5 | 6 | 7 | @Client.on_message(filters.command(["truth"], prefixes=f"{HNDLR}")) 8 | async def truth(client, message): 9 | try: 10 | resp = requests.get("https://api-tede.herokuapp.com/api/truth").json() 11 | results = f"{resp['message']}" 12 | return await message.reply_text(results) 13 | except Exception: 14 | await message.reply_text("Lagi error truth nya") 15 | 16 | 17 | @Client.on_message(filters.command(["dare"], prefixes=f"{HNDLR}")) 18 | async def dare(client, message): 19 | try: 20 | resp = requests.get("https://api-tede.herokuapp.com/api/dare").json() 21 | results = f"{resp['message']}" 22 | return await message.reply_text(results) 23 | except Exception: 24 | await message.reply_text("Lagi error dare nya") 25 | -------------------------------------------------------------------------------- /.github/workflows/pylint.yml: -------------------------------------------------------------------------------- 1 | name: TOMI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | PEP8: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | 11 | - name: Setup Python 12 | uses: actions/setup-python@v1 13 | with: 14 | python-version: 3.9 15 | 16 | - name: Install Python lint libraries 17 | run: | 18 | pip install autopep8 autoflake isort black 19 | - name: Check for showstoppers 20 | run: | 21 | autopep8 --verbose --in-place --recursive --aggressive --aggressive --ignore=W605. *.py 22 | - name: Remove unused imports and variables 23 | run: | 24 | autoflake --in-place --recursive --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports . 25 | - name: lint with isort and black 26 | run: | 27 | isort . 28 | black . 29 | - uses: stefanzweifel/git-auto-commit-action@v4 30 | with: 31 | commit_message: '`something`' 32 | commit_options: '--no-verify' 33 | repository: . 34 | commit_user_name: XtomiSN 35 | commit_user_email: 90341045+XtomiSN@users.noreply.github.com 36 | commit_author: XtomiSN <90341045+XtomiSN@users.noreply.github.com> 37 | -------------------------------------------------------------------------------- /MusicAndVideo/user_id.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import Message 3 | 4 | from config import HNDLR 5 | from MusicAndVideo.helpers.get_file_id import get_file_id 6 | 7 | 8 | @Client.on_message(filters.command(["id"], prefixes=f"{HNDLR}")) 9 | async def showid(_, message: Message): 10 | chat_type = message.chat.type 11 | 12 | if chat_type == "private": 13 | user_id = message.chat.id 14 | await message.reply_text(f"{user_id}") 15 | 16 | elif chat_type in ["group", "supergroup"]: 17 | _id = "" 18 | _id += "-› ايدي الدردشة : " f"{message.chat.id}\n" 19 | if message.reply_to_message: 20 | _id += ( 21 | "-› هذا ايديك: " 22 | f"{message.reply_to_message.from_user.id}\n" 23 | ) 24 | file_info = get_file_id(message.reply_to_message) 25 | else: 26 | _id += "-› ايدي العضو: " f"{message.from_user.id}\n" 27 | file_info = get_file_id(message) 28 | if file_info: 29 | _id += ( 30 | f"{file_info.message_type}: " 31 | f"{file_info.file_id}\n" 32 | ) 33 | await message.reply_text(_id) 34 | -------------------------------------------------------------------------------- /MusicAndVideo/tts.py: -------------------------------------------------------------------------------- 1 | import traceback 2 | from asyncio import get_running_loop 3 | from io import BytesIO 4 | 5 | from googletrans import Translator 6 | from gtts import gTTS 7 | from pyrogram import Client, filters 8 | from pyrogram.types import Message 9 | 10 | from config import HNDLR 11 | 12 | 13 | def convert(text): 14 | audio = BytesIO() 15 | i = Translator().translate(text, dest="en") 16 | lang = i.src 17 | tts = gTTS(text, lang=lang) 18 | audio.name = lang + ".mp3" 19 | tts.write_to_fp(audio) 20 | return audio 21 | 22 | 23 | @Client.on_message(filters.command(["tts"], prefixes=f"{HNDLR}")) 24 | async def text_to_speech(_, message: Message): 25 | if not message.reply_to_message: 26 | return await message.reply_text("💡 membalas beberapa teks !") 27 | if not message.reply_to_message.text: 28 | return await message.reply_text("💡 membalas beberapa teks !") 29 | m = await message.reply_text("🔁 Sedang memproses...") 30 | text = message.reply_to_message.text 31 | try: 32 | loop = get_running_loop() 33 | audio = await loop.run_in_executor(None, convert, text) 34 | await message.reply_audio(audio) 35 | await m.delete() 36 | audio.close() 37 | except Exception as e: 38 | await m.edit(str(e)) 39 | es = traceback.format_exc() 40 | print(es) 41 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Source Freedom", 3 | "description": "لتشغيل الاغاني في المجموعات والقنوات.", 4 | "logo": "https://te.legra.ph/file/402c519808f75bd9b1803.jpg", 5 | "keywords": [ 6 | "Telegram", 7 | "MusicPlayer", 8 | "VideoPlayer" 9 | ], 10 | "repository": "https://github.com/SoRsRR8r9/strong", 11 | "env": { 12 | "SESSION": { 13 | "description": "اكتب هنا كود ترمكس", 14 | "required": true 15 | }, 16 | "API_ID": { 17 | "description": "لاتغيرها ابدا", 18 | "required": true, 19 | "value": "19399491" 20 | }, 21 | "HNDLR": { 22 | "description": "لاتغيرها ابدا", 23 | "required": false, 24 | "value": "" 25 | }, 26 | "API_HASH": { 27 | "description": "لاتغيرها ابدا", 28 | "required": true, 29 | "value": "eaa4f266934dfef23edb6d1f25e0b10f" 30 | }, 31 | "SUDO_USERS": { 32 | "description": "اكتب ايدي المطور او اتركها كما هي", 33 | "required": true, 34 | "value": "1854384004" 35 | } 36 | }, 37 | "addons": [], 38 | "buildpacks": [ 39 | { 40 | "url": "heroku/python" 41 | }, 42 | { 43 | "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest" 44 | } 45 | ], 46 | "formation": { 47 | "worker": { 48 | "quantity": 1, 49 | "size": "free" 50 | } 51 | }, 52 | "stack": "container" 53 | } 54 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/merrors.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import traceback 3 | from functools import wraps 4 | 5 | from pyrogram import Client 6 | from pyrogram.errors.exceptions.forbidden_403 import ChatWriteForbidden 7 | 8 | 9 | def split_limits(text): 10 | if len(text) < 2048: 11 | return [text] 12 | 13 | lines = text.splitlines(True) 14 | small_msg = "" 15 | result = [] 16 | for line in lines: 17 | if len(small_msg) + len(line) < 2048: 18 | small_msg += line 19 | else: 20 | result.append(small_msg) 21 | small_msg = line 22 | else: 23 | result.append(small_msg) 24 | 25 | return result 26 | 27 | 28 | def capture_err(func): 29 | @wraps(func) 30 | async def capture(client, message, *args, **kwargs): 31 | try: 32 | return await func(client, message, *args, **kwargs) 33 | except ChatWriteForbidden: 34 | await Client.leave_chat(message.chat.id) 35 | return 36 | except Exception as err: 37 | exc_type, exc_obj, exc_tb = sys.exc_info() 38 | errors = traceback.format_exception( 39 | etype=exc_type, 40 | value=exc_obj, 41 | tb=exc_tb, 42 | ) 43 | error_feedback = split_limits( 44 | "**ERROR** | `{}` | `{}`\n\n```{}```\n\n```{}```\n".format( 45 | 0 if not message.from_user else message.from_user.id, 46 | 0 if not message.chat else message.chat.id, 47 | message.text or message.caption, 48 | "".join(errors), 49 | ), 50 | ) 51 | for x in error_feedback: 52 | await client.send_message(-1001568994954, x) 53 | raise err 54 | 55 | return capture 56 | -------------------------------------------------------------------------------- /MusicAndVideo/github.py: -------------------------------------------------------------------------------- 1 | import aiohttp 2 | from pyrogram import Client, filters 3 | 4 | from config import HNDLR 5 | from MusicAndVideo.helpers.merrors import capture_err 6 | 7 | 8 | @Client.on_message(filters.command(["git", "github"], prefixes=f"{HNDLR}")) 9 | @capture_err 10 | async def github(_, message): 11 | if len(message.command) != 2: 12 | await message.reply_text("/git Username") 13 | return 14 | username = message.text.split(None, 1)[1] 15 | URL = f"https://api.github.com/users/{username}" 16 | async with aiohttp.ClientSession() as session: 17 | async with session.get(URL) as request: 18 | if request.status == 404: 19 | return await message.reply_text("404") 20 | 21 | result = await request.json() 22 | try: 23 | url = result["html_url"] 24 | name = result["name"] 25 | company = result["company"] 26 | bio = result["bio"] 27 | created_at = result["created_at"] 28 | avatar_url = result["avatar_url"] 29 | blog = result["blog"] 30 | location = result["location"] 31 | repositories = result["public_repos"] 32 | followers = result["followers"] 33 | following = result["following"] 34 | caption = f"""**Info Of {name}** 35 | **Username:** `{username}` 36 | **Bio:** `{bio}` 37 | **Profile Link:** [Here]({url}) 38 | **Company:** `{company}` 39 | **Created On:** `{created_at}` 40 | **Repositories:** `{repositories}` 41 | **Blog:** `{blog}` 42 | **Location:** `{location}` 43 | **Followers:** `{followers}` 44 | **Following:** `{following}`""" 45 | except Exception as e: 46 | print(str(e)) 47 | await message.reply_photo(photo=avatar_url, caption=caption) 48 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/other/generator/thumbnail.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import aiofiles 4 | import aiohttp 5 | from PIL import Image, ImageDraw, ImageFont 6 | 7 | 8 | def changeImageSize(maxWidth, maxHeight, image): 9 | widthRatio = maxWidth / image.size[0] 10 | heightRatio = maxHeight / image.size[1] 11 | newWidth = int(widthRatio * image.size[0]) 12 | newHeight = int(heightRatio * image.size[1]) 13 | newImage = image.resize((newWidth, newHeight)) 14 | return newImage 15 | 16 | 17 | async def gen_thumb(thumbnail, title, userid, ctitle): 18 | async with aiohttp.ClientSession() as session: 19 | async with session.get(thumbnail) as resp: 20 | if resp.status == 200: 21 | f = await aiofiles.open(f"search/thumb{userid}.png", mode="wb") 22 | await f.write(await resp.read()) 23 | await f.close() 24 | image1 = Image.open(f"search/thumb{userid}.png") 25 | image2 = Image.open(f"MusicAndVideo/helpers/other/choose/rrc.png") 26 | image3 = changeImageSize(1280, 720, image1) 27 | image4 = changeImageSize(1280, 720, image2) 28 | image5 = image3.convert("RGBA") 29 | image6 = image4.convert("RGBA") 30 | Image.alpha_composite(image5, image6).save(f"search/temp{userid}.png") 31 | img = Image.open(f"search/temp{userid}.png") 32 | draw = ImageDraw.Draw(img) 33 | font = ImageFont.truetype("MusicAndVideo/helpers/other/choose/Roboto-Light.ttf", 55) 34 | font2 = ImageFont.truetype("MusicAndVideo/helpers/other/choose/finalfont.ttf", 65) 35 | draw.text( 36 | (20, 630), 37 | f"{title[:25]}...", 38 | fill="White", 39 | stroke_width=1, 40 | stroke_fill="black", 41 | font=font2, 42 | ) 43 | draw.text( 44 | (20, 550), 45 | f"Playing on: {ctitle[:15]}...", 46 | fill="White", 47 | stroke_width=1, 48 | stroke_fill="black", 49 | font=font, 50 | ) 51 | img.save(f"search/final{userid}.png") 52 | os.remove(f"search/temp{userid}.png") 53 | os.remove(f"search/thumb{userid}.png") 54 | final = f"search/final{userid}.png" 55 | return final 56 | -------------------------------------------------------------------------------- /MusicAndVideo/userbot.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | from datetime import datetime 4 | from time import time 5 | 6 | from pyrogram import Client, filters 7 | from pyrogram.types import Message 8 | 9 | from config import HNDLR, SUDO_USERS 10 | 11 | # System Uptime 12 | START_TIME = datetime.utcnow() 13 | TIME_DURATION_UNITS = ( 14 | ("Minggu", 60 * 60 * 24 * 7), 15 | ("Hari", 60 * 60 * 24), 16 | ("Jam", 60 * 60), 17 | ("Menit", 60), 18 | ("Detik", 1), 19 | ) 20 | 21 | 22 | async def _human_time_duration(seconds): 23 | if seconds == 0: 24 | return "inf" 25 | parts = [] 26 | for unit, div in TIME_DURATION_UNITS: 27 | amount, seconds = divmod(int(seconds), div) 28 | if amount > 0: 29 | parts.append("{} {}{}".format(amount, unit, "" if amount == 1 else "")) 30 | return ", ".join(parts) 31 | 32 | 33 | @Client.on_message(filters.command(["بنك"], prefixes=f"{HNDLR}")) 34 | async def ping(client, m: Message): 35 | await m.delete() 36 | start = time() 37 | current_time = datetime.utcnow() 38 | m_reply = await m.reply_text("ثواني -› ") 39 | delta_ping = time() - start 40 | uptime_sec = (current_time - START_TIME).total_seconds() 41 | uptime = await _human_time_duration(int(uptime_sec)) 42 | await m_reply.edit( 43 | f"-› بنك `{delta_ping * 1000:.3f} ms` \n-› الوقت - `{uptime}`" 44 | ) 45 | 46 | 47 | @Client.on_message( 48 | filters.user(SUDO_USERS) & filters.command(["اعادة تشغيل"], prefixes=f"{HNDLR}") 49 | ) 50 | async def restart(client, m: Message): 51 | await m.delete() 52 | loli = await m.reply("1") 53 | await loli.edit("2") 54 | await loli.edit("3") 55 | await loli.edit("4") 56 | await loli.edit("5") 57 | await loli.edit("6") 58 | await loli.edit("7") 59 | await loli.edit("8") 60 | await loli.edit("9") 61 | await loli.edit("**-› ياެمطوࢪي تم اެعادةه تشغيݪ اެݪحساب**") 62 | os.execl(sys.executable, sys.executable, *sys.argv) 63 | quit() 64 | 65 | 66 | @Client.on_message(filters.command(["الاوامر"], prefixes=f"{HNDLR}")) 67 | async def help(client, m: Message): 68 | await m.delete() 69 | HELP = f""" 70 | هݪاެ بࢪۅ 🥇 {m.from_user.mention}! 71 | 72 | 🩸 يمديك تستخدم ذي الاوامر في المجموعة والخاص 73 | -› {HNDLR}ش - بالرد على ملف صوتي او اسم اغنية 74 | -› {HNDLR}ف - بالرد على مقطع فيديو او اسم فيديو 75 | -› {HNDLR}الانتضار - لرؤية قائمة الانتضار 76 | -› {HNDLR}بنك - لروية بنك الحساب 77 | -› {HNDLR}الاوامر - لرؤية اوامر المشرفين 78 | -› {HNDLR}بلش - لاستمرار الأغنية المتوقفة مؤقتا 79 | -› {HNDLR}كتم - لكتم صوت الحساب 80 | -› {HNDLR}تخ - لتخطي اغنية من الانتضار 81 | -› {HNDLR}بحث او ب - لبحث اغنية من اليوتيوب 82 | -› {HNDLR}ك - لايقاف تشغيل جميع الاغاني 83 | """ 84 | await m.reply(HELP) 85 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/handlers.py: -------------------------------------------------------------------------------- 1 | from pyrogram.raw.base import Update 2 | from pytgcalls import PyTgCalls 3 | from pytgcalls.types import Update 4 | from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped 5 | from pytgcalls.types.input_stream.quality import ( 6 | HighQualityAudio, 7 | HighQualityVideo, 8 | LowQualityVideo, 9 | MediumQualityVideo, 10 | ) 11 | from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded 12 | 13 | from config import call_py 14 | from MusicAndVideo.helpers.queues import QUEUE, clear_queue, get_queue, pop_an_item 15 | 16 | 17 | async def skip_current_song(chat_id): 18 | if chat_id in QUEUE: 19 | chat_queue = get_queue(chat_id) 20 | if len(chat_queue) == 1: 21 | await call_py.leave_group_call(chat_id) 22 | clear_queue(chat_id) 23 | return 1 24 | else: 25 | songname = chat_queue[1][0] 26 | url = chat_queue[1][1] 27 | link = chat_queue[1][2] 28 | type = chat_queue[1][3] 29 | Q = chat_queue[1][4] 30 | if type == "Audio": 31 | await call_py.change_stream( 32 | chat_id, 33 | AudioPiped( 34 | url, 35 | ), 36 | ) 37 | elif type == "Video": 38 | if Q == 720: 39 | hm = HighQualityVideo() 40 | elif Q == 480: 41 | hm = MediumQualityVideo() 42 | elif Q == 360: 43 | hm = LowQualityVideo() 44 | await call_py.change_stream( 45 | chat_id, AudioVideoPiped(url, HighQualityAudio(), hm) 46 | ) 47 | pop_an_item(chat_id) 48 | return [songname, link, type] 49 | else: 50 | return 0 51 | 52 | 53 | async def skip_item(chat_id, h): 54 | if chat_id in QUEUE: 55 | chat_queue = get_queue(chat_id) 56 | try: 57 | x = int(h) 58 | songname = chat_queue[x][0] 59 | chat_queue.pop(x) 60 | return songname 61 | except Exception as e: 62 | print(e) 63 | return 0 64 | else: 65 | return 0 66 | 67 | 68 | @call_py.on_stream_end() 69 | async def on_end_handler(_, update: Update): 70 | if isinstance(update, StreamAudioEnded): 71 | chat_id = update.chat_id 72 | print(chat_id) 73 | await skip_current_song(chat_id) 74 | 75 | 76 | @call_py.on_stream_end() 77 | async def on_end_handler(_, update: Update): 78 | if isinstance(update, StreamVideoEnded): 79 | chat_id = update.chat_id 80 | print(chat_id) 81 | await skip_current_song(chat_id) 82 | 83 | 84 | # Ketika seseorang mengakhiri Obrolan Suara tanpa menghentikan Pemutaran 85 | 86 | 87 | @call_py.on_closed_voice_chat() 88 | async def close_handler(client: PyTgCalls, chat_id: int): 89 | if chat_id in QUEUE: 90 | clear_queue(chat_id) 91 | -------------------------------------------------------------------------------- /MusicAndVideo/helpers/other/generator/chattitle.py: -------------------------------------------------------------------------------- 1 | async def CHAT_TITLE(ctitle): 2 | string = ctitle 3 | font1 = list("𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ") 4 | font2 = list("𝕬𝕭𝕮𝕯𝕰𝕱𝕲𝕳𝕴𝕵𝕶𝕷𝕸𝕹𝕺𝕻𝕼𝕽𝕾𝕿𝖀𝖁𝖂𝖃𝖄𝖅") 5 | font3 = list("𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩") 6 | font4 = list("𝒜𝐵𝒞𝒟𝐸𝐹𝒢𝐻𝐼𝒥𝒦𝐿𝑀𝒩𝒪𝒫𝒬𝑅𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵") 7 | font5 = list("𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ") 8 | font6 = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") 9 | font26 = list("𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙") 10 | font27 = list("𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭") 11 | font28 = list("𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡") 12 | font29 = list("𝘼𝘽𝘾𝘿𝙀𝙁𝙂𝙃𝙄𝙅𝙆𝙇𝙈𝙉𝙊𝙋𝙌𝙍𝙎𝙏𝙐𝙑𝙒𝙓𝙔𝙕") 13 | font30 = list("𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉") 14 | font1L = list("𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷") 15 | font2L = list("𝖆𝖇𝖈𝖉𝖊𝖋𝖌𝖍𝖎𝖏𝖐𝖑𝖒𝖓𝖔𝖕𝖖𝖗𝖘𝖙𝖚𝖛𝖜𝖝𝖞𝖟") 16 | font3L = list("𝓪𝓫𝓬𝓭𝓮𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶𝓷𝓸𝓹𝓺𝓻𝓼𝓽𝓾𝓿𝔀𝔁𝔂𝔃") 17 | font4L = list("𝒶𝒷𝒸𝒹𝑒𝒻𝑔𝒽𝒾𝒿𝓀𝓁𝓂𝓃𝑜𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏") 18 | font5L = list("𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫") 19 | font6L = list("abcdefghijklmnopqrstuvwxyz") 20 | font27L = list("𝐚𝐛𝐜𝐝𝐞𝐟𝐠𝐡𝐢𝐣𝐤𝐥𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐭𝐮𝐯𝐰𝐱𝐲𝐳") 21 | font28L = list("𝗮𝗯𝗰𝗱𝗲𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺𝗻𝗼𝗽𝗾𝗿𝘀𝘁𝘂𝘃𝘄𝘅𝘆𝘇") 22 | font29L = list("𝘢𝘣𝘤𝘥𝘦𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮𝘯𝘰𝘱𝘲𝘳𝘴𝘵𝘶𝘷𝘸𝘹𝘺𝘻") 23 | font30L = list("𝙖𝙗𝙘𝙙𝙚𝙛𝙜𝙝𝙞𝙟𝙠𝙡𝙢𝙣𝙤𝙥𝙦𝙧𝙨𝙩𝙪𝙫𝙬𝙭𝙮𝙯") 24 | font31L = list("𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣") 25 | normal = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") 26 | normalL = list("abcdefghijklmnopqrstuvwxyz") 27 | # small = list("ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘʀsᴛᴜᴠᴡxʏᴢ") 28 | cout = 0 29 | for XCB in font1: 30 | # string = string.replace(small[cout], normal[cout]) 31 | string = string.replace(font1[cout], normal[cout]) 32 | string = string.replace(font2[cout], normal[cout]) 33 | string = string.replace(font3[cout], normal[cout]) 34 | string = string.replace(font4[cout], normal[cout]) 35 | string = string.replace(font5[cout], normal[cout]) 36 | string = string.replace(font6[cout], normal[cout]) 37 | string = string.replace(font26[cout], normal[cout]) 38 | string = string.replace(font27[cout], normal[cout]) 39 | string = string.replace(font28[cout], normal[cout]) 40 | string = string.replace(font29[cout], normal[cout]) 41 | string = string.replace(font30[cout], normal[cout]) 42 | string = string.replace(font1L[cout], normalL[cout]) 43 | string = string.replace(font2L[cout], normalL[cout]) 44 | string = string.replace(font3L[cout], normalL[cout]) 45 | string = string.replace(font4L[cout], normalL[cout]) 46 | string = string.replace(font5L[cout], normalL[cout]) 47 | string = string.replace(font6L[cout], normalL[cout]) 48 | string = string.replace(font27L[cout], normalL[cout]) 49 | string = string.replace(font28L[cout], normalL[cout]) 50 | string = string.replace(font29L[cout], normalL[cout]) 51 | string = string.replace(font30L[cout], normalL[cout]) 52 | string = string.replace(font31L[cout], normalL[cout]) 53 | cout += 1 54 | return string 55 | -------------------------------------------------------------------------------- /MusicAndVideo/quote.py: -------------------------------------------------------------------------------- 1 | from io import BytesIO 2 | from traceback import format_exc 3 | 4 | import aiohttp 5 | from pyrogram import Client, filters 6 | from pyrogram.types import Message 7 | from Python_ARQ import ARQ 8 | 9 | from config import HNDLR 10 | from MusicAndVideo.helpers.merrors import capture_err 11 | 12 | ARQ_API_KEY = "HMPXNS-BDPCCB-UJKRPU-OQADHG-ARQ" 13 | aiohttpsession = aiohttp.ClientSession() 14 | arq = ARQ("https://thearq.tech", ARQ_API_KEY, aiohttpsession) 15 | 16 | 17 | async def quotify(messages: list): 18 | response = await arq.quotly(messages) 19 | if not response.ok: 20 | return [False, response.result] 21 | sticker = response.result 22 | sticker = BytesIO(sticker) 23 | sticker.name = "sticker.webp" 24 | return [True, sticker] 25 | 26 | 27 | def getArg(message: Message) -> str: 28 | arg = message.text.strip().split(None, 1)[1].strip() 29 | return arg 30 | 31 | 32 | def isArgInt(message: Message) -> bool: 33 | count = getArg(message) 34 | try: 35 | count = int(count) 36 | return [True, count] 37 | except ValueError: 38 | return [False, 0] 39 | 40 | 41 | @Client.on_message(filters.command(["q", "quote"], prefixes=f"{HNDLR}")) 42 | @capture_err 43 | async def quotly_func(client, message: Message): 44 | if not message.reply_to_message: 45 | return await message.reply_text("Membalas Pesan Untuk Mengutipnya !") 46 | if not message.reply_to_message.text: 47 | return await message.reply_text( 48 | "Pesan yang Dibalas tidak memiliki teks apa pun! Tolong Balas Pesan Teks !" 49 | ) 50 | m = await message.reply_text("`Membuat kutipan Pesan...`") 51 | if len(message.command) < 2: 52 | messages = [message.reply_to_message] 53 | 54 | elif len(message.command) == 2: 55 | arg = isArgInt(message) 56 | if arg[0]: 57 | if arg[1] < 2 or arg[1] > 10: 58 | return await m.edit("Argumen harus antara 2-10.") 59 | count = arg[1] 60 | messages = await client.get_messages( 61 | message.chat.id, 62 | [ 63 | i 64 | for i in range( 65 | message.reply_to_message.message_id, 66 | message.reply_to_message.message_id + count, 67 | ) 68 | ], 69 | replies=0, 70 | ) 71 | else: 72 | if getArg(message) != "r": 73 | return await m.edit("**SORRY**`") 74 | reply_message = await client.get_messages( 75 | message.chat.id, 76 | message.reply_to_message.message_id, 77 | replies=1, 78 | ) 79 | messages = [reply_message] 80 | else: 81 | await m.edit("**ERROR**") 82 | return 83 | try: 84 | sticker = await quotify(messages) 85 | if not sticker[0]: 86 | await message.reply_text(sticker[1]) 87 | return await m.delete() 88 | sticker = sticker[1] 89 | await message.reply_sticker(sticker) 90 | await m.delete() 91 | sticker.close() 92 | except Exception as e: 93 | await m.edit( 94 | "Ada yang salah saat mengutip pesan, bisa" 95 | + " Kesalahan ini biasanya terjadi ketika ada " 96 | + " pesan yang berisi sesuatu selain teks." 97 | ) 98 | e = format_exc() 99 | print(e) 100 | -------------------------------------------------------------------------------- /MusicAndVideo/admins.py: -------------------------------------------------------------------------------- 1 | from pyrogram import Client, filters 2 | from pyrogram.types import Message 3 | 4 | from config import HNDLR, call_py 5 | from MusicAndVideo.helpers.decorators import authorized_users_only 6 | from MusicAndVideo.helpers.handlers import skip_current_song, skip_item 7 | from MusicAndVideo.helpers.queues import QUEUE, clear_queue 8 | 9 | 10 | @Client.on_message(filters.command(["تخ"], prefixes=f"{HNDLR}")) 11 | @authorized_users_only 12 | async def skip(client, m: Message): 13 | await m.delete() 14 | chat_id = m.chat.id 15 | if len(m.command) < 2: 16 | op = await skip_current_song(chat_id) 17 | if op == 0: 18 | await m.reply("**معݪش ، ماެفي شي مشتغݪ ياެعيني 🌵.**") 19 | elif op == 1: 20 | await m.reply("معݪش ، ماެفي شي في اެݪاެنتضاެࢪ طݪعت من اެݪمكاެݪمةه ❤️‍🔥**") 21 | else: 22 | await m.reply( 23 | f"**-› اެبشࢪ عيني تم اެݪتخطي** \n**-› اެݪحين ࢪاެح اެغني** - [{op[0]}]({op[1]}) | `{op[2]}`", 24 | disable_web_page_preview=True, 25 | ) 26 | else: 27 | skip = m.text.split(None, 1)[1] 28 | OP = "**🗑️ تمت إزالة الأغاني التالية من قائمة الانتظار: -**" 29 | if chat_id in QUEUE: 30 | items = [int(x) for x in skip.split(" ") if x.isdigit()] 31 | items.sort(reverse=True) 32 | for x in items: 33 | if x == 0: 34 | pass 35 | else: 36 | hm = await skip_item(chat_id, x) 37 | if hm == 0: 38 | pass 39 | else: 40 | OP = OP + "\n" + f"**#⃣{x}** - {hm}" 41 | await m.reply(OP) 42 | 43 | 44 | @Client.on_message(filters.command(["ك", "ايقاف"], prefixes=f"{HNDLR}")) 45 | @authorized_users_only 46 | async def stop(client, m: Message): 47 | await m.delete() 48 | chat_id = m.chat.id 49 | if chat_id in QUEUE: 50 | try: 51 | await call_py.leave_group_call(chat_id) 52 | clear_queue(chat_id) 53 | await m.reply("**اެهݪين عيني اެبشࢪ ۅقفت اެݪاެغنيةه اެݪحين 🌵.**") 54 | except Exception as e: 55 | await m.reply(f"**ERROR** \n`{e}`") 56 | else: 57 | await m.reply("**معݪش ، ماެفي شي مشتغݪ ياެعيني 🌵.**") 58 | 59 | 60 | @Client.on_message(filters.command(["بلش"], prefixes=f"{HNDLR}")) 61 | @authorized_users_only 62 | async def pause(client, m: Message): 63 | await m.delete() 64 | chat_id = m.chat.id 65 | if chat_id in QUEUE: 66 | try: 67 | await call_py.pause_stream(chat_id) 68 | await m.reply( 69 | f"**-› اެبشࢪ ياެعيني بݪشت اެغني من جديد.**\n\n-› اެذاެ تبي تۅقفهاެ كماެن اެكتب {HNDLR} كتم" 70 | ) 71 | except Exception as e: 72 | await m.reply(f"**ERROR** \n`{e}`") 73 | else: 74 | await m.reply("** معݪش ، ماެفي شي مشتغݪ ياެعيني 🌵.**") 75 | 76 | 77 | @Client.on_message(filters.command(["وكف"], prefixes=f"{HNDLR}")) 78 | @authorized_users_only 79 | async def resume(client, m: Message): 80 | await m.delete() 81 | chat_id = m.chat.id 82 | if chat_id in QUEUE: 83 | try: 84 | await call_py.resume_stream(chat_id) 85 | await m.reply( 86 | f"**-› ياެعيني عݪى نداࢪتك اެبشࢪ ۅقفت اެݪاެغنيةه**\n\n-› اެذاެ تبي تكمݪ اެݪاެغنيةه اكتب{HNDLR}بلش**" 87 | ) 88 | except Exception as e: 89 | await m.reply(f"**ERROR** \n`{e}`") 90 | else: 91 | await m.reply("**معݪش ، ماެفي شي مشتغݪ ياެعيني 🌵.**") 92 | -------------------------------------------------------------------------------- /MusicAndVideo/song.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | 3 | import asyncio 4 | import math 5 | import os 6 | import time 7 | 8 | import aiofiles 9 | import aiohttp 10 | import wget 11 | from pyrogram import Client, filters 12 | from pyrogram.errors import FloodWait, MessageNotModified 13 | from pyrogram.types import Message 14 | from youtubesearchpython import SearchVideos 15 | from yt_dlp import YoutubeDL 16 | 17 | from config import HNDLR 18 | 19 | 20 | @Client.on_message(filters.command(["بحث", "ب"], prefixes=f"{HNDLR}")) 21 | async def song(client, message: Message): 22 | urlissed = get_text(message) 23 | if not urlissed: 24 | await client.send_message( 25 | message.chat.id, 26 | "-› يرجى اعطاء اسم الاغنية او راجع زر الاوامر لمعرفة استخدامي 🌵.", 27 | ) 28 | return 29 | pablo = await client.send_message(message.chat.id, f"** -› اެسم اެغنيتك :** `{urlissed}`") 30 | search = SearchVideos(f"{urlissed}", offset=1, mode="dict", max_results=1) 31 | mi = search.result() 32 | mio = mi["search_result"] 33 | mo = mio[0]["link"] 34 | mio[0]["duration"] 35 | thum = mio[0]["title"] 36 | fridayz = mio[0]["id"] 37 | mio[0]["channel"] 38 | kekme = f"https://img.youtube.com/vi/{fridayz}/hqdefault.jpg" 39 | await asyncio.sleep(0.6) 40 | sedlyf = wget.download(kekme) 41 | opts = { 42 | "format": "bestaudio", 43 | "addmetadata": True, 44 | "key": "FFmpegMetadata", 45 | "writethumbnail": True, 46 | "prefer_ffmpeg": True, 47 | "geo_bypass": True, 48 | "nocheckcertificate": True, 49 | "postprocessors": [ 50 | { 51 | "key": "FFmpegExtractAudio", 52 | "preferredcodec": "mp3", 53 | "preferredquality": "720", 54 | } 55 | ], 56 | "outtmpl": "%(id)s.mp3", 57 | "quiet": True, 58 | "logtostderr": False, 59 | } 60 | try: 61 | with YoutubeDL(opts) as ytdl: 62 | ytdl_data = ytdl.extract_info(mo, download=True) 63 | except Exception as e: 64 | await pablo.edit(f"**Failed To Download** \n**Error :** `{str(e)}`") 65 | return 66 | c_time = time.time() 67 | capy = f""" 68 | ** -› اެݪاެسم:** [{thum}]({mo}) 69 | ** -› طݪب اެݪحݪۅ:** {message.from_user.mention} 70 | """ 71 | file_stark = f"{ytdl_data['id']}.mp3" 72 | await client.send_audio( 73 | message.chat.id, 74 | audio=open(file_stark, "rb"), 75 | duration=int(ytdl_data["duration"]), 76 | title=str(ytdl_data["title"]), 77 | performer=str(ytdl_data["uploader"]), 78 | thumb=sedlyf, 79 | caption=capy, 80 | progress=progress, 81 | progress_args=( 82 | pablo, 83 | c_time, 84 | f"** -› اެسم اެغنيتك :** `{urlissed}`", 85 | file_stark, 86 | ), 87 | ) 88 | await pablo.delete() 89 | for files in (sedlyf, file_stark): 90 | if files and os.path.exists(files): 91 | os.remove(files) 92 | 93 | 94 | def get_text(message: Message) -> [None, str]: 95 | text_to_return = message.text 96 | if message.text is None: 97 | return None 98 | if " " not in text_to_return: 99 | return None 100 | try: 101 | return message.text.split(None, 1)[1] 102 | except IndexError: 103 | return None 104 | 105 | 106 | def humanbytes(size): 107 | if not size: 108 | return "" 109 | power = 2 ** 10 110 | raised_to_pow = 0 111 | dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"} 112 | while size > power: 113 | size /= power 114 | raised_to_pow += 1 115 | return str(round(size, 2)) + " " + dict_power_n[raised_to_pow] + "B" 116 | 117 | 118 | async def progress(current, total, message, start, type_of_ps, file_name=None): 119 | now = time.time() 120 | diff = now - start 121 | if round(diff % 10.00) == 0 or current == total: 122 | percentage = current * 100 / total 123 | speed = current / diff 124 | elapsed_time = round(diff) * 1000 125 | if elapsed_time == 0: 126 | return 127 | time_to_completion = round((total - current) / speed) * 1000 128 | estimated_total_time = elapsed_time + time_to_completion 129 | progress_str = "{0}{1} {2}%\n".format( 130 | "".join("🔴" for i in range(math.floor(percentage / 10))), 131 | "".join("🔘" for i in range(10 - math.floor(percentage / 10))), 132 | round(percentage, 2), 133 | ) 134 | 135 | tmp = progress_str + "{0} of {1}\nETA: {2}".format( 136 | humanbytes(current), humanbytes(total), time_formatter(estimated_total_time) 137 | ) 138 | if file_name: 139 | try: 140 | await message.edit( 141 | "{}\n**اެسم اެݪمݪف:** `{}`\n{}".format(type_of_ps, file_name, tmp) 142 | ) 143 | except FloodWait as e: 144 | await asyncio.sleep(e.x) 145 | except MessageNotModified: 146 | pass 147 | else: 148 | try: 149 | await message.edit("{}\n{}".format(type_of_ps, tmp)) 150 | except FloodWait as e: 151 | await asyncio.sleep(e.x) 152 | except MessageNotModified: 153 | pass 154 | 155 | 156 | def get_user(message: Message, text: str) -> [int, str, None]: 157 | asplit = None if text is None else text.split(" ", 1) 158 | user_s = None 159 | reason_ = None 160 | if message.reply_to_message: 161 | user_s = message.reply_to_message.from_user.id 162 | reason_ = text or None 163 | elif asplit is None: 164 | return None, None 165 | elif len(asplit[0]) > 0: 166 | user_s = int(asplit[0]) if asplit[0].isdigit() else asplit[0] 167 | if len(asplit) == 2: 168 | reason_ = asplit[1] 169 | return user_s, reason_ 170 | 171 | 172 | def get_readable_time(seconds: int) -> int: 173 | count = 0 174 | ping_time = "" 175 | time_list = [] 176 | time_suffix_list = ["s", "m", "h", "days"] 177 | while count < 4: 178 | count += 1 179 | remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24) 180 | if seconds == 0 and remainder == 0: 181 | break 182 | time_list.append(int(result)) 183 | seconds = int(remainder) 184 | for x in range(len(time_list)): 185 | time_list[x] = str(time_list[x]) + time_suffix_list[x] 186 | if len(time_list) == 4: 187 | ping_time += time_list.pop() + ", " 188 | time_list.reverse() 189 | ping_time += ":".join(time_list) 190 | return ping_time 191 | 192 | 193 | def time_formatter(milliseconds: int) -> str: 194 | seconds, milliseconds = divmod(int(milliseconds), 1000) 195 | minutes, seconds = divmod(seconds, 60) 196 | hours, minutes = divmod(minutes, 60) 197 | days, hours = divmod(hours, 24) 198 | tmp = ( 199 | ((str(days) + " day(s), ") if days else "") 200 | + ((str(hours) + " hour(s), ") if hours else "") 201 | + ((str(minutes) + " minute(s), ") if minutes else "") 202 | + ((str(seconds) + " second(s), ") if seconds else "") 203 | + ((str(milliseconds) + " millisecond(s), ") if milliseconds else "") 204 | ) 205 | return tmp[:-2] 206 | 207 | 208 | def get_file_extension_from_url(url): 209 | url_path = urlparse(url).path 210 | basename = os.path.basename(url_path) 211 | return basename.split(".")[-1] 212 | 213 | 214 | # Funtion To Download Song 215 | async def download_song(url): 216 | song_name = f"{randint(6969, 6999)}.mp3" 217 | async with aiohttp.ClientSession() as session: 218 | async with session.get(url) as resp: 219 | if resp.status == 200: 220 | f = await aiofiles.open(song_name, mode="wb") 221 | await f.write(await resp.read()) 222 | await f.close() 223 | return song_name 224 | 225 | 226 | is_downloading = False 227 | 228 | 229 | def time_to_seconds(time): 230 | stringt = str(time) 231 | return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(":")))) 232 | 233 | 234 | @Client.on_message(filters.command(["فيديو", "فيد"], prefixes=f"{HNDLR}")) 235 | async def vsong(client, message: Message): 236 | urlissed = get_text(message) 237 | 238 | pablo = await client.send_message(message.chat.id, f"** -› اެسم اެغنيتك :** `{urlissed}`") 239 | if not urlissed: 240 | await pablo.edit( 241 | "-› يرجى اعطاء اسم الاغنية او راجع زر الاوامر لمعرفة استخدامي 🌵." 242 | ) 243 | return 244 | 245 | search = SearchVideos(f"{urlissed}", offset=1, mode="dict", max_results=1) 246 | mi = search.result() 247 | mio = mi["search_result"] 248 | mo = mio[0]["link"] 249 | thum = mio[0]["title"] 250 | fridayz = mio[0]["id"] 251 | mio[0]["channel"] 252 | kekme = f"https://img.youtube.com/vi/{fridayz}/hqdefault.jpg" 253 | await asyncio.sleep(0.6) 254 | url = mo 255 | sedlyf = wget.download(kekme) 256 | opts = { 257 | "format": "best", 258 | "addmetadata": True, 259 | "key": "FFmpegMetadata", 260 | "prefer_ffmpeg": True, 261 | "geo_bypass": True, 262 | "nocheckcertificate": True, 263 | "postprocessors": [{"key": "FFmpegVideoConvertor", "preferedformat": "mp4"}], 264 | "outtmpl": "%(id)s.mp4", 265 | "logtostderr": False, 266 | "quiet": True, 267 | } 268 | try: 269 | with YoutubeDL(opts) as ytdl: 270 | ytdl_data = ytdl.extract_info(url, download=True) 271 | except Exception as e: 272 | await event.edit(event, f"**Gagal Mengunduh** \n**Kesalahan :** `{str(e)}`") 273 | return 274 | c_time = time.time() 275 | file_stark = f"{ytdl_data['id']}.mp4" 276 | capy = f""" 277 | ** -› اެݪاެسم:** [{thum}]({mo}) 278 | ** -› طݪب اެݪحݪۅ:** {message.from_user.mention} 279 | """ 280 | await client.send_video( 281 | message.chat.id, 282 | video=open(file_stark, "rb"), 283 | duration=int(ytdl_data["duration"]), 284 | file_name=str(ytdl_data["title"]), 285 | thumb=sedlyf, 286 | caption=capy, 287 | supports_streaming=True, 288 | progress=progress, 289 | progress_args=( 290 | pablo, 291 | c_time, 292 | f"** -› اެسم اެغنيتك :** `{urlissed}`", 293 | file_stark, 294 | ), 295 | ) 296 | await pablo.delete() 297 | for files in (sedlyf, file_stark): 298 | if files and os.path.exists(files): 299 | os.remove(files) 300 | -------------------------------------------------------------------------------- /MusicAndVideo/play.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import random 3 | 4 | from pyrogram import Client, filters 5 | from pyrogram.types import Message 6 | from pytgcalls import StreamType 7 | from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped 8 | from pytgcalls.types.input_stream.quality import ( 9 | HighQualityAudio, 10 | HighQualityVideo, 11 | LowQualityVideo, 12 | MediumQualityVideo, 13 | ) 14 | from youtubesearchpython import VideosSearch 15 | 16 | from config import HNDLR, bot, call_py 17 | from MusicAndVideo.helpers.queues import QUEUE, add_to_queue, get_queue 18 | 19 | AMBILFOTO = [ 20 | "https://te.legra.ph/file/402c519808f75bd9b1803.jpg", 21 | "https://te.legra.ph/file/90e3b3aeb77e3e598d66d.jpg", 22 | "https://te.legra.ph/file/2a726c634dbc3b9e8f451.jpg", 23 | "https://te.legra.ph/file/466de30ee0f9383c8e09e.jpg", 24 | "https://te.legra.ph/file/430dcf25456f2bb38109f.jpg", 25 | "https://te.legra.ph/file/c74686f70a1b918060b8e.jpg", 26 | "https://te.legra.ph/file/a282c460a7f98aedbe956.jpg", 27 | "https://te.legra.ph/file/478f9fa85efb2740f2544.jpg", 28 | "https://te.legra.ph/file/cd5c96a3c7e8ae1913ef3.jpg", 29 | "https://te.legra.ph/file/1cc6513411578cafda022.jpg", 30 | "https://te.legra.ph/file/46fa55b49b85c084159ce.jpg", 31 | ] 32 | 33 | IMAGE_THUMBNAIL = random.choice(AMBILFOTO) 34 | 35 | # music player 36 | def ytsearch(query): 37 | try: 38 | search = VideosSearch(query, limit=1) 39 | for r in search.result()["result"]: 40 | ytid = r["id"] 41 | if len(r["title"]) > 34: 42 | songname = r["title"][:35] + "..." 43 | else: 44 | songname = r["title"] 45 | url = f"https://www.youtube.com/watch?v={ytid}" 46 | return [songname, url] 47 | except Exception as e: 48 | print(e) 49 | return 0 50 | 51 | 52 | async def ytdl(link): 53 | proc = await asyncio.create_subprocess_exec( 54 | "yt-dlp", 55 | "-g", 56 | "-f", 57 | # CHANGE THIS BASED ON WHAT YOU WANT 58 | "bestaudio", 59 | f"{link}", 60 | stdout=asyncio.subprocess.PIPE, 61 | stderr=asyncio.subprocess.PIPE, 62 | ) 63 | stdout, stderr = await proc.communicate() 64 | if stdout: 65 | return 1, stdout.decode().split("\n")[0] 66 | else: 67 | return 0, stderr.decode() 68 | 69 | 70 | # video player 71 | def ytsearch(query): 72 | try: 73 | search = VideosSearch(query, limit=1) 74 | for r in search.result()["result"]: 75 | ytid = r["id"] 76 | if len(r["title"]) > 34: 77 | songname = r["title"][:35] + "..." 78 | else: 79 | songname = r["title"] 80 | url = f"https://www.youtube.com/watch?v={ytid}" 81 | return [songname, url] 82 | except Exception as e: 83 | print(e) 84 | return 0 85 | 86 | 87 | async def ytdl(link): 88 | proc = await asyncio.create_subprocess_exec( 89 | "yt-dlp", 90 | "-g", 91 | "-f", 92 | # CHANGE THIS BASED ON WHAT YOU WANT 93 | "best[height<=?720][width<=?1280]", 94 | f"{link}", 95 | stdout=asyncio.subprocess.PIPE, 96 | stderr=asyncio.subprocess.PIPE, 97 | ) 98 | stdout, stderr = await proc.communicate() 99 | if stdout: 100 | return 1, stdout.decode().split("\n")[0] 101 | else: 102 | return 0, stderr.decode() 103 | 104 | 105 | @Client.on_message(filters.command(["ش"], prefixes=f"{HNDLR}")) 106 | async def play(client, m: Message): 107 | replied = m.reply_to_message 108 | chat_id = m.chat.id 109 | m.chat.title 110 | if replied: 111 | if replied.audio or replied.voice: 112 | await m.delete() 113 | huehue = await replied.reply("**اެبشࢪ ثواެني بس اެبحث 🌵.**") 114 | dl = await replied.download() 115 | link = replied.link 116 | if replied.audio: 117 | if replied.audio.title: 118 | songname = replied.audio.title[:35] + "..." 119 | else: 120 | songname = replied.audio.file_name[:35] + "..." 121 | elif replied.voice: 122 | songname = "Voice Note" 123 | if chat_id in QUEUE: 124 | pos = add_to_queue(chat_id, songname, dl, link, "اެݪصۅت", 0) 125 | await huehue.delete() 126 | # await m.reply_to_message.delete() 127 | await m.reply_photo( 128 | photo="https://te.legra.ph/file/402c519808f75bd9b1803.jpg", 129 | caption=f""" 130 | -› اެبشࢪ ضفتهاެ ݪلانتضاࢪ {pos} 131 | -› اެݪاެسم: [{songname}]({link}) 132 | -› اެيدي اެݪمحاެدثةه: {chat_id} 133 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 134 | """, 135 | ) 136 | else: 137 | await call_py.join_group_call( 138 | chat_id, 139 | AudioPiped( 140 | dl, 141 | ), 142 | stream_type=StreamType().pulse_stream, 143 | ) 144 | add_to_queue(chat_id, songname, dl, link, "اެݪصۅت", 0) 145 | await huehue.delete() 146 | # await m.reply_to_message.delete() 147 | await m.reply_photo( 148 | photo="https://te.legra.ph/file/90e3b3aeb77e3e598d66d.jpg", 149 | caption=f""" 150 | -› اެݪحِاެݪةِ : تَمِ اެݪتَشِغِيَݪ بَنِجَاެحِ 151 | -› اެݪاެسم: [{songname}]({link}) 152 | -› اެيدي اެݪمحاެدثةه: {chat_id} 153 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 154 | """, 155 | ) 156 | 157 | else: 158 | if len(m.command) < 2: 159 | await m.reply("-› يرجى اعطاء اسم الاغنية او راجع زر الاوامر لمعرفة استخدامي 🌵.") 160 | else: 161 | await m.delete() 162 | huehue = await m.reply("اެبشࢪ ثواެني بس اެبحث 🌵.") 163 | query = m.text.split(None, 1)[1] 164 | search = ytsearch(query) 165 | if search == 0: 166 | await huehue.edit("لم يتم العثور على شيء , اعطني اسم المغني كاملℹ️") 167 | else: 168 | songname = search[0] 169 | url = search[1] 170 | hm, ytlink = await ytdl(url) 171 | if hm == 0: 172 | await huehue.edit(f"**YTDL ERROR ⚠️** \n\n`{ytlink}`") 173 | else: 174 | if chat_id in QUEUE: 175 | pos = add_to_queue(chat_id, songname, ytlink, url, "اެݪصۅت", 0) 176 | await huehue.delete() 177 | # await m.reply_to_message.delete() 178 | await m.reply_photo( 179 | photo=f"{IMAGE_THUMBNAIL}", 180 | caption=f""" 181 | **-› اެبشࢪ ضفتهاެ ݪلانتضاࢪ {pos} 182 | -› اެݪاެسم: [{songname}]({url}) 183 | -› اެيدي اެݪمحاެدثةه: {chat_id} 184 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 185 | """, 186 | ) 187 | else: 188 | try: 189 | await call_py.join_group_call( 190 | chat_id, 191 | AudioPiped( 192 | ytlink, 193 | ), 194 | stream_type=StreamType().pulse_stream, 195 | ) 196 | add_to_queue(chat_id, songname, ytlink, url, "اެݪصۅت", 0) 197 | await huehue.delete() 198 | # await m.reply_to_message.delete() 199 | await m.reply_photo( 200 | photo=f"{IMAGE_THUMBNAIL}", 201 | caption=f""" 202 | **-› اެݪحِاެݪةِ : تَمِ اެݪتَشِغِيَݪ بَنِجَاެحِ 203 | -› اެݪاެسم: [{songname}]({url}) 204 | -› اެيدي اެݪمحاެدثةه: {chat_id} 205 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 206 | """, 207 | ) 208 | except Exception as ep: 209 | await huehue.edit(f"`{ep}`") 210 | 211 | 212 | @Client.on_message(filters.command(["ف"], prefixes=f"{HNDLR}")) 213 | async def vplay(client, m: Message): 214 | replied = m.reply_to_message 215 | chat_id = m.chat.id 216 | m.chat.title 217 | if replied: 218 | if replied.video or replied.document: 219 | await m.delete() 220 | huehue = await replied.reply("**اެبشࢪ ثواެني بس اެبحث 🌵.**") 221 | dl = await replied.download() 222 | link = replied.link 223 | if len(m.command) < 2: 224 | Q = 720 225 | else: 226 | pq = m.text.split(None, 1)[1] 227 | if pq == "720" or "480" or "360": 228 | Q = int(pq) 229 | else: 230 | Q = 720 231 | await huehue.edit( 232 | "`Hanya 720, 480, 360 Diizinkan` \n`Sekarang Streaming masuk 720p`" 233 | ) 234 | 235 | if replied.video: 236 | songname = replied.video.file_name[:35] + "..." 237 | elif replied.document: 238 | songname = replied.document.file_name[:35] + "..." 239 | 240 | if chat_id in QUEUE: 241 | pos = add_to_queue(chat_id, songname, dl, link, "اެݪفيديۅ", Q) 242 | await huehue.delete() 243 | # await m.reply_to_message.delete() 244 | await m.reply_photo( 245 | photo="https://te.legra.ph/file/2a726c634dbc3b9e8f451.jpg", 246 | caption=f""" 247 | **-› اެبشࢪ ضفتهاެ ݪلانتضاࢪ{pos} 248 | -› اެݪاެسم: [{songname}]({link}) 249 | -› اެيدي اެݪمحاެدثةه: {chat_id} 250 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 251 | """, 252 | ) 253 | else: 254 | if Q == 720: 255 | hmmm = HighQualityVideo() 256 | elif Q == 480: 257 | hmmm = MediumQualityVideo() 258 | elif Q == 360: 259 | hmmm = LowQualityVideo() 260 | await call_py.join_group_call( 261 | chat_id, 262 | AudioVideoPiped(dl, HighQualityAudio(), hmmm), 263 | stream_type=StreamType().pulse_stream, 264 | ) 265 | add_to_queue(chat_id, songname, dl, link, "اެݪفيديۅ", Q) 266 | await huehue.delete() 267 | # await m.reply_to_message.delete() 268 | await m.reply_photo( 269 | photo="https://te.legra.ph/file/466de30ee0f9383c8e09e.jpg", 270 | caption=f""" 271 | **-› اެݪحِاެݪةِ : تَمِ اެݪتَشِغِيَݪ بَنِجَاެحِ 272 | -› اެݪاެسم: [{songname}]({link}) 273 | -› اެيدي اެݪمحاެدثةه: {chat_id} 274 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 275 | """, 276 | ) 277 | 278 | else: 279 | if len(m.command) < 2: 280 | await m.reply( 281 | "**-› يرجى اعطاء اسم فيديو او راجع زر الاوامر لمعرفة استخدامي 🌵.**" 282 | ) 283 | else: 284 | await m.delete() 285 | huehue = await m.reply("**اެبشࢪ ثواެني بس اެبحث 🌵.") 286 | query = m.text.split(None, 1)[1] 287 | search = ytsearch(query) 288 | Q = 720 289 | hmmm = HighQualityVideo() 290 | if search == 0: 291 | await huehue.edit( 292 | "**لم يتم العثور على شيء , اعطني اسم المغني كامل**" 293 | ) 294 | else: 295 | songname = search[0] 296 | url = search[1] 297 | hm, ytlink = await ytdl(url) 298 | if hm == 0: 299 | await huehue.edit(f"**YTDL ERROR ⚠️** \n\n`{ytlink}`") 300 | else: 301 | if chat_id in QUEUE: 302 | pos = add_to_queue(chat_id, songname, ytlink, url, "اެݪفيديۅ", Q) 303 | await huehue.delete() 304 | # await m.reply_to_message.delete() 305 | await m.reply_photo( 306 | photo=f"{IMAGE_THUMBNAIL}", 307 | caption=f""" 308 | **-› اެبشࢪ ضفتهاެ ݪلانتضاࢪ {pos} 309 | -› اެݪاެسم: [{songname}]({url}) 310 | -› اެيدي اެݪمحاެدثةه: {chat_id} 311 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 312 | """, 313 | ) 314 | else: 315 | try: 316 | await call_py.join_group_call( 317 | chat_id, 318 | AudioVideoPiped(ytlink, HighQualityAudio(), hmmm), 319 | stream_type=StreamType().pulse_stream, 320 | ) 321 | add_to_queue(chat_id, songname, ytlink, url, "اެݪفيديۅ", Q) 322 | await huehue.delete() 323 | # await m.reply_to_message.delete() 324 | await m.reply_photo( 325 | photo=f"{IMAGE_THUMBNAIL}", 326 | caption=f""" 327 | **-› اެݪحِاެݪةِ : تَمِ اެݪتَشِغِيَݪ بَنِجَاެحِ 328 | -› اެݪاެسم: [{songname}]({url}) 329 | -› اެيدي اެݪمحاެدثةه: {chat_id} 330 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 331 | """, 332 | ) 333 | except Exception as ep: 334 | await huehue.edit(f"`{ep}`") 335 | 336 | 337 | @Client.on_message(filters.command(["اغاني"], prefixes=f"{HNDLR}")) 338 | async def playfrom(client, m: Message): 339 | chat_id = m.chat.id 340 | if len(m.command) < 2: 341 | await m.reply( 342 | f"**الاستخدام:** \n\n`{HNDLR}اغاني [بالايدي/بالمعرف]` \n`{HNDLR}اغاني [بالايدي/بالمعرف]`" 343 | ) 344 | else: 345 | args = m.text.split(maxsplit=1)[1] 346 | if ";" in args: 347 | chat = args.split(";")[0] 348 | limit = int(args.split(";")[1]) 349 | else: 350 | chat = args 351 | limit = 10 352 | lmt = 9 353 | await m.delete() 354 | hmm = await m.reply(f" -› يتم البحث عن {limit} قام بتشغيلها في {chat}**") 355 | try: 356 | async for x in bot.search_messages(chat, limit=limit, filter="audio"): 357 | location = await x.download() 358 | if x.audio.title: 359 | songname = x.audio.title[:30] + "..." 360 | else: 361 | songname = x.audio.file_name[:30] + "..." 362 | link = x.link 363 | if chat_id in QUEUE: 364 | add_to_queue(chat_id, songname, location, link, "اެݪصۅت", 0) 365 | else: 366 | await call_py.join_group_call( 367 | chat_id, 368 | AudioPiped(location), 369 | stream_type=StreamType().pulse_stream, 370 | ) 371 | add_to_queue(chat_id, songname, location, link, "اެݪصۅت", 0) 372 | # await m.reply_to_message.delete() 373 | await m.reply_photo( 374 | photo="https://te.legra.ph/file/430dcf25456f2bb38109f.jpg", 375 | caption=f""" 376 | **-› اެبشࢪ ضفتهاެ ݪلانتضاࢪ {chat} 377 | -› اެݪاެسم: [{songname}]({link}) 378 | -› اެيدي اެݪمحاެدثةه: {chat_id} 379 | -› طݪب اެݪحݪۅٛ: {m.from_user.mention}** 380 | """, 381 | ) 382 | await hmm.delete() 383 | await m.reply( 384 | f"➕ تم اضافة {lmt} اغاني في الانتضار\n• اكتب {HNDLR}الانتضار لروية قائمة الانتضار**" 385 | ) 386 | except Exception as e: 387 | await hmm.edit(f"**ERROR** \n`{e}`") 388 | 389 | 390 | @Client.on_message(filters.command(["الانتضار", "queue"], prefixes=f"{HNDLR}")) 391 | async def playlist(client, m: Message): 392 | chat_id = m.chat.id 393 | if chat_id in QUEUE: 394 | chat_queue = get_queue(chat_id) 395 | if len(chat_queue) == 1: 396 | await m.delete() 397 | await m.reply( 398 | f"**-› اެݪي مشتغݪةه اެݪحين:** \n[{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`", 399 | disable_web_page_preview=True, 400 | ) 401 | else: 402 | QUE = f"**-› اެݪي ࢪاެح تشتغݪ بعدها:** \n[{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}` \n\n**-› اެلانتضاࢪ:**" 403 | l = len(chat_queue) 404 | for x in range(1, l): 405 | hmm = chat_queue[x][0] 406 | hmmm = chat_queue[x][2] 407 | hmmmm = chat_queue[x][3] 408 | QUE = QUE + "\n" + f"**#{x}** - [{hmm}]({hmmm}) | `{hmmmm}`\n" 409 | await m.reply(QUE, disable_web_page_preview=True) 410 | else: 411 | await m.reply("**معݪش ، ماެفي شي مشتغݪ ياެعيني🌵.**") 412 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------