%global _empty_manifest_terminate_build 0 Name: python-mpyg321 Version: 2.1.1 Release: 1 Summary: mpg321 wrapper for python - command line music player License: MIT License URL: https://github.com/4br3mm0rd/mpyg321 Source0: https://mirrors.aliyun.com/pypi/web/packages/66/4b/00d5001125ea5e7499af28930391ec25a3d402791da8d6796649654891b5/mpyg321-2.1.1.tar.gz BuildArch: noarch Requires: python3-pexpect %description [![Downloads](https://pepy.tech/badge/mpyg321)](https://pepy.tech/project/mpyg321) [![Downloads](https://pepy.tech/badge/mpyg321/month)](https://pepy.tech/project/mpyg321) [![Downloads](https://pepy.tech/badge/mpyg321/week)](https://pepy.tech/project/mpyg321) # mpyg321 mpyg321 is a simple python wrapper for mpg321 and mpg123. It allows you to easily play mp3 sounds in python, do basic operations on the music and implement callbacks for events like the end of a sound. # Installation mpyg321 requires the installation of mpg123 (or mpg321 depending on your usage) software for reading mp3. This section describes the installation of the library on MacOS, Linux and Windows. **For now, the library has only been tested on mac, but it should work on any platform.** We recommend using mpg123 since the project is more up to date. However, you can also use this library with mpg321 (using the `MPyg321Player` class) ## MacOS ``` $ brew install mpg123 # or mpg321 $ pip3 install mpyg321 ``` ## Linux ``` $ sudo apt-get update $ sudo apt-get install mpg123 # or mpg321 $ pip3 install mpyg321 ``` ## Windows For windows installation, download mpg123 on the website: [mpg123's website](https://www.mpg123.de/download.shtml), and then run: ``` $ pip install mpyg321 ``` # Usage Usage is pretty straight forward, and all the functionnalities are easily shown in the examples folder. ``` from mpyg321.MPyg123Player import MPyg123Player # or MPyg321Player if you installed mpg321 player = MPyg123Player() player.play_song("/path/to/some_mp3.mp3") ``` ## Calbacks You can implement callbacks for several events such as: end of song, user paused the music, ... All the callbacks can be found inside the code of the `BasePlayer` class and the `MPyg123Player` class. Most of the callbacks are implemented in the `callbacks.py` example file. ## Loops In order to loop (replay the song when it ended), you can either set the loop mode when calling the `play_song` function: ``` player.play_song("/path/to/sample.mp3", loop=True) ``` or programmatically set the loop mode anywhere in the code: ``` player.play_song("/path/to/sample.mp3) // Do some stuff ... player.set_loop(True) ``` **Note:** when calling `player.set_loop(True)`, the loop mode will only be taken into account at the end of a song. If nothing is playing, this call will not replay the previous song. In order to replay the previous song, you should call: `player.play()` %package -n python3-mpyg321 Summary: mpg321 wrapper for python - command line music player Provides: python-mpyg321 BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-mpyg321 [![Downloads](https://pepy.tech/badge/mpyg321)](https://pepy.tech/project/mpyg321) [![Downloads](https://pepy.tech/badge/mpyg321/month)](https://pepy.tech/project/mpyg321) [![Downloads](https://pepy.tech/badge/mpyg321/week)](https://pepy.tech/project/mpyg321) # mpyg321 mpyg321 is a simple python wrapper for mpg321 and mpg123. It allows you to easily play mp3 sounds in python, do basic operations on the music and implement callbacks for events like the end of a sound. # Installation mpyg321 requires the installation of mpg123 (or mpg321 depending on your usage) software for reading mp3. This section describes the installation of the library on MacOS, Linux and Windows. **For now, the library has only been tested on mac, but it should work on any platform.** We recommend using mpg123 since the project is more up to date. However, you can also use this library with mpg321 (using the `MPyg321Player` class) ## MacOS ``` $ brew install mpg123 # or mpg321 $ pip3 install mpyg321 ``` ## Linux ``` $ sudo apt-get update $ sudo apt-get install mpg123 # or mpg321 $ pip3 install mpyg321 ``` ## Windows For windows installation, download mpg123 on the website: [mpg123's website](https://www.mpg123.de/download.shtml), and then run: ``` $ pip install mpyg321 ``` # Usage Usage is pretty straight forward, and all the functionnalities are easily shown in the examples folder. ``` from mpyg321.MPyg123Player import MPyg123Player # or MPyg321Player if you installed mpg321 player = MPyg123Player() player.play_song("/path/to/some_mp3.mp3") ``` ## Calbacks You can implement callbacks for several events such as: end of song, user paused the music, ... All the callbacks can be found inside the code of the `BasePlayer` class and the `MPyg123Player` class. Most of the callbacks are implemented in the `callbacks.py` example file. ## Loops In order to loop (replay the song when it ended), you can either set the loop mode when calling the `play_song` function: ``` player.play_song("/path/to/sample.mp3", loop=True) ``` or programmatically set the loop mode anywhere in the code: ``` player.play_song("/path/to/sample.mp3) // Do some stuff ... player.set_loop(True) ``` **Note:** when calling `player.set_loop(True)`, the loop mode will only be taken into account at the end of a song. If nothing is playing, this call will not replay the previous song. In order to replay the previous song, you should call: `player.play()` %package help Summary: Development documents and examples for mpyg321 Provides: python3-mpyg321-doc %description help [![Downloads](https://pepy.tech/badge/mpyg321)](https://pepy.tech/project/mpyg321) [![Downloads](https://pepy.tech/badge/mpyg321/month)](https://pepy.tech/project/mpyg321) [![Downloads](https://pepy.tech/badge/mpyg321/week)](https://pepy.tech/project/mpyg321) # mpyg321 mpyg321 is a simple python wrapper for mpg321 and mpg123. It allows you to easily play mp3 sounds in python, do basic operations on the music and implement callbacks for events like the end of a sound. # Installation mpyg321 requires the installation of mpg123 (or mpg321 depending on your usage) software for reading mp3. This section describes the installation of the library on MacOS, Linux and Windows. **For now, the library has only been tested on mac, but it should work on any platform.** We recommend using mpg123 since the project is more up to date. However, you can also use this library with mpg321 (using the `MPyg321Player` class) ## MacOS ``` $ brew install mpg123 # or mpg321 $ pip3 install mpyg321 ``` ## Linux ``` $ sudo apt-get update $ sudo apt-get install mpg123 # or mpg321 $ pip3 install mpyg321 ``` ## Windows For windows installation, download mpg123 on the website: [mpg123's website](https://www.mpg123.de/download.shtml), and then run: ``` $ pip install mpyg321 ``` # Usage Usage is pretty straight forward, and all the functionnalities are easily shown in the examples folder. ``` from mpyg321.MPyg123Player import MPyg123Player # or MPyg321Player if you installed mpg321 player = MPyg123Player() player.play_song("/path/to/some_mp3.mp3") ``` ## Calbacks You can implement callbacks for several events such as: end of song, user paused the music, ... All the callbacks can be found inside the code of the `BasePlayer` class and the `MPyg123Player` class. Most of the callbacks are implemented in the `callbacks.py` example file. ## Loops In order to loop (replay the song when it ended), you can either set the loop mode when calling the `play_song` function: ``` player.play_song("/path/to/sample.mp3", loop=True) ``` or programmatically set the loop mode anywhere in the code: ``` player.play_song("/path/to/sample.mp3) // Do some stuff ... player.set_loop(True) ``` **Note:** when calling `player.set_loop(True)`, the loop mode will only be taken into account at the end of a song. If nothing is playing, this call will not replay the previous song. In order to replay the previous song, you should call: `player.play()` %prep %autosetup -n mpyg321-2.1.1 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-mpyg321 -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Jun 20 2023 Python_Bot - 2.1.1-1 - Package Spec generated