The earliest beta version of pytgcalls on Linux x86_64 and ARM64! Use in production at your own risk!

Overview

Public beta test. Use in production at your own risk!

tgcalls - a python binding for tgcalls (c++ lib by Telegram);

pytgcalls - library connecting python binding for tgcalls and Pyrogram.

Notes

Only for Linux systems on x86_64 and ARM64 platform!

Features

  • Python solution
  • Join to voice chats
  • Payout from file
  • Output (recording) to file
  • Change files at runtime
  • Speaking status with levels inside and outside of VC
  • Stop payout/output
  • Multiply chat (CPU load)

TODO

  • Payout and output by bytes from Python
  • Incoming and Outgoing calls (already there and working, but not in beta)
  • Video calls (video from a file etc)
  • Additional things for working with ffmpeg
  • Convenient callbacks and methods
  • Mac OS builds
  • Maybe ARM support
  • Windows instruction how to build (maybe)

Audio file formats

RAW files are now used. You will have to convert to this format yourself using ffmpeg. This procedure may become easier in the future.

From mp3 to raw (to play in voice chat):

ffmpeg -i input.mp3 -f s16le -ac 2 -ar 48000 -acodec pcm_s16le input.raw

From raw to mp3 (files with recordings):

ffmpeg -f s16le -ac 2 -ar 48000 -acodec pcm_s16le -i output.raw clear_output.mp3

For playout live stream you can use this one:

ffmpeg -y -i http://stream2.cnmns.net/hope-mp3 -f s16le -ac 2 -ar 48000 -acodec pcm_s16le input.raw

And set input.raw as input filename.

Installing

-pre argument is necessary! --upgrade is necessary if you installed v1 beta

pip install --upgrade --pre pytgcalls

How to test

No docs, but example!

import os
import asyncio

import pytgcalls
import pyrogram

# EDIT VALUES!
API_HASH = None
API_ID = None
CHAT_ID = '@tgcallschat'
INPUT_FILENAME = 'input.raw'
OUTPUT_FILENAME = 'output.raw'


async def main(client):
    await client.start()
    while not client.is_connected:
        await asyncio.sleep(1)

    # you can pass init filenames in the constructor
    group_call = pytgcalls.GroupCall(client, INPUT_FILENAME, OUTPUT_FILENAME)
    await group_call.start(CHAT_ID)

    # to change audio file you can do this:
    # group_call.input_filename = 'input2.raw'

    # to change output file:
    # group_call.output_filename = 'output2.raw'

    # to restart play from start:
    # group_call.restart_playout()

    # to stop play:
    # group_call.stop_playout()

    # same with output (recording)
    # .restart_recording, .stop_output

    # to mute yourself:
    # group_call.set_is_mute(True)

    await pyrogram.idle()


if __name__ == '__main__':
    pyro_client = pyrogram.Client(
        os.environ.get('SESSION_NAME', 'pytgcalls'),
        api_hash=os.environ.get('API_HASH', API_HASH),
        api_id=os.environ.get('API_ID', API_ID)
    )

    loop = asyncio.get_event_loop()
    loop.run_until_complete(main(pyro_client))

Issues, bugs, questions

I know that debug logs are enabled.

License

You may copy, distribute and modify the software provided that modifications are described and licensed for free under LGPL-3. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.

You might also like...
edgetest is a tox-inspired python library that will loop through your project's dependencies, and check if your project is compatible with the latest version of each dependency

Bleeding edge dependency testing Full Documentation edgetest is a tox-inspired python library that will loop through your project's dependencies, and

Run-Your-Own Firefox Sync Server

Run-Your-Own Firefox Sync Server This is an all-in-one package for running a self-hosted Firefox Sync server. It bundles the "tokenserver" project for

This is a method to build your own qgis configuration packages using osgeo4W.

This is a method to build your own qgis configuration packages using osgeo4W. Then you can automate deployment in your organization with a controled and trusted environnement.

Build your own Etherscan with web3.py

Build your own Etherscan with web3.py Video Tutorial: Run it pip3 install -r requirements.txt export FLASK_APP=app export FLASK_ENV=development flask

Provides guideline on how to configure pre-commit hooks in your own python project
Provides guideline on how to configure pre-commit hooks in your own python project

Pre-commit Configuration Guide The main aim of this repository is to act as a guide on how to configure the pre-commit hooks in your existing python p

Run CodeServer on Google Colab using Inlets in less than 60 secs using your own domain.

Inlets Colab Run CodeServer on Colab using Inlets in less than 60 secs using your own domain. Features Optimized for Inlets/InletsPro Use your own Cus

Procedurally generated Oblique Strategies for writing your own Oblique Strategies

Procedurally generated Oblique Strategies for writing your own Oblique Strategies.

Python Create Your Own Tool Series

Python Create Your Own Tool Series Hey there! This is an additional Github repository that contains the final product files for each video in my Youtu

The refactoring tutorial I wrote for PyConDE 2022. You can also work through the exercises on your own.
The refactoring tutorial I wrote for PyConDE 2022. You can also work through the exercises on your own.

Refactoring 101 planet images by Justin Nichol on opengameart.org CC-BY 3.0 Goal of this Tutorial In this tutorial, you will refactor a space travel t

Comments
  • Not working in common(not super) groups

    Not working in common(not super) groups

    Starting group call not working in not super groups

    Reproduce steps:

    1. try to start group call in common(not super) group await GroupCall(...).start(505051194)
    2. get pyrogram error about invalid argument

    Fix: Check GroupCall.chat_peer type in GroupCall.get_group_call method. If it is raw.types.InputPeerChannel, then use functions.channels.GetFullChannel(channel=self.chat_peer) else use functions.messages.GetFullChat(chat_id=self.chat_peer.chat_id).

    It can also be InputPeerUser and InputPeerSelf, but imo this shouldn't be handled by this library.

    bug 
    opened by L3Nya 2
  • Can't install pytgcalls on Windows 7

    Can't install pytgcalls on Windows 7

    pip install pytgcalls

    Collecting pytgcalls
      Using cached pytgcalls-0.0.1b3.tar.gz (3.7 kB)
      Using cached pytgcalls-0.0.1b2.tar.gz (3.7 kB)
      Using cached pytgcalls-0.0.1b1.tar.gz (3.6 kB)
      Using cached pytgcalls-0.0.1b0.tar.gz (3.6 kB)
    ERROR: Cannot install pytgcalls==0.0.1b0, pytgcalls==0.0.1b1, pytgcalls==0.0.1b2
     and pytgcalls==0.0.1b3 because these package versions have conflicting dependen
    cies.
    
    The conflict is caused by:
        pytgcalls 0.0.1b3 depends on tgcalls==0.0.1b2
        pytgcalls 0.0.1b2 depends on tgcalls==0.0.1b1
        pytgcalls 0.0.1b1 depends on tgcalls==0.0.1b0
        pytgcalls 0.0.1b0 depends on tgcalls==0.0.1b0
    
    To fix this you could try to:
    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict
    
    
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_g
    uide/#fixing-conflicting-dependencies
    
    opened by rushkii 1
  • Segmentation fault if changing input_filename/output_filename attribute before starting GroupCall

    Segmentation fault if changing input_filename/output_filename attribute before starting GroupCall

    Segfault happens if you change input_filename or output_filename attribute of GroupCall before starting it.

    Steps to reproduce:

    1. create GroupCall instance. gc = pytgcalls.GroupCall(client, "", "")
    2. set its input_filename attribute to anything before starting gc.input_filename = "input.raw"
    3. catch lovely segfault.
    bug 
    opened by L3Nya 0
Owner
Il'ya
Telegram: https://t.me/MarshalX
Il'ya
Singularity Containers on Apple M1 (ARM64)

Singularity Containers on Apple M1 (ARM64) This is a repository containing a ready-to-use environment for singularity in arm64 (M1). It has been prepa

Manuel Parra 4 Nov 14, 2022
Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends.

Quiz Application Its a simple and fun to use application. You can make your own quizes and send the lik of the quiz to your friends. When they would a

Atharva Parkhe 1 Feb 23, 2022
Myrepo - A tool to create your own Arch Linux repository

myrepo A (experimental) tool to create your own Arch Linux repository Example We

Anton Hvornum 5 Feb 19, 2022
python package to showcase, test and build your own version of Pickhardt Payments

Pickhardt Payments Package The pickhardtpayments package is a collection of classes and interfaces that help you to test and implement your dialect of

Rene Pickhardt 37 Dec 18, 2022
Organize seu linux - organize your linux

OrganizeLinux Organize seu linux - organize your linux Organize seu linux Uma forma rápida de separar arquivos dispersos em pastas. formatos a serem c

Marcus Vinícius Ribeiro Andrade 1 Nov 30, 2021
Simple AoC helper program you can use to develop your own solutions in python.

AoC-Compabion Simple AoC helper program you can use to develop your own solutions in python. Simply install it in your python environment using pip fr

Alexander Vollmer 1 Dec 20, 2021
LSO, also known as Linux Swap Operator, is a software with both GUI and terminal versions that you can manage the Swap area for Linux operating systems.

LSO - Linux Swap Operator Türkçe - LSO Nedir? LSO, diğer adıyla Linux Swap Operator Linux işletim sistemleri için Swap alanını yönetebileceğiniz hem G

Eren İnce 4 Feb 9, 2022
List of Linux Tools I put on almost every linux / Debian host

Linux-Tools List of Linux Tools I put on almost every Linux / Debian host Installed: geany --> GUI editor/ notepad++ like chkservice --> TUI Linux ser

Stew Alexander 20 Jan 2, 2023
A program that lets you use your tablet's tilting to emulate an actual joystick on a Linux computer.

Tablet Tilt Joystick A program that lets you use your tablet's tilting to emulate an actual joystick on a Linux computer. It's called tablet tilt joys

null 1 Feb 7, 2022
Connect Playground - easy way to fill in your account with production-like objects

Just set of scripts to initialise accpunt with production-like data: A - Basic Distributor Account Initialization INPUT Distributor Account Token ACTI

CloudBlue 5 Jun 25, 2021