A python package to play and control media files
Project description
playmedia
playmedia python package helps you easily play and control media files. It uses multithreading technology ( playback run in a different thread ). It means after calling play_single( filepath )
or play_multiple( directoryPath, shuffle )
execution of program does not stop.
Example :-
play_single("C:\\\Users\\\Satvik\\\Music\\\Why do I.mp3")
print("This is printed as soon as play_single() is called. It does not wait for song to finish")
#Output :
This is printed as soon as play_single() is called. It does not wait for song to finish
It supports almost all popular formats :-
- .m4a
- .flac
- .mp3
- .mp4
- .wav
- .wma
- .aac
- .mkv
It has 2 major functions :-
- play_single()
- play_multiple()
1. play_single( filepath )
play_single( filepath )
- filepath ->full path of loaction of media eg.("C:\\Users\\Satvik\\Music\\Why do I.mp3"). Double backslash( \\ ) should be used as using others might throw unicode error.
It has 3 method inside it.
-
pause_single()
- Pauses the song. (callingpause_single()
again resumes it) -
set_volume_single(vol)
- Sets the volume of player to vol%. Eg.set_volume_single(60)
sets volume to 60% -
stop_single()
- Stops playing . Only it should be called to stop playing. Using other techniques might stop playing but not stop the thread
Example Usage :-
play_single("C:\\Users\\Satvik\\Music\\Why do I.mp3")
#playing started
pause_single()
#pauses
pause_single()
#calling pause_single() again resumes the song
set_volume_single(60)
#sets volume to 60%
stop_single()
#stops playing the song
2. play_multiple( directoryPath, shuffle )
play_multiple( directoryPath, shuffle )
- directoryPath ->full path of directory containing multiple media eg.("C:\\Users\\Satvik\\Music\"). Double backslash( \\ ) should be used as using others might throw unicode error. Also double backslash( \\ ) at the end is neccesary.
- shuffle ->True if you want the songs to be played in random order else False
It has 5 method inside it.
-
pause_multiple()
- Pauses the song. (callingpause_multiple()
again resumes it) -
set_volume_multiple(vol)
- Sets the volume of player to vol%. Eg.set_volume_multiple(60)
sets volume to 60% -
next_multiple()
- Plays next song in the list -
previous_multiple
- Plays previous song in the list -
stop_multiple()
- Stops playing . Only it should be called to stop playing. Using other techniques might stop playing but not stop the thread
Example Usage:-
play_multiple("C:\\Users\\Satvik\\Music\\", False)
#started playing
pause_multiple()
#pauses the current song
pause_multiple()
#calling pause_multiple() again resumes the current song
next_multiple()
#plays next song in the list
previous_multiple()
#plays previous song in the list
set_volume_multiple(60)
#sets volume to 60%
stop_multiple()
#stops playing the songs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file playmedia-0.0.1.tar.gz
.
File metadata
- Download URL: playmedia-0.0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b58df2e7877645312b29b70fa82422b03dca9be046949d34cb24fdbfcfdebd4c
|
|
MD5 |
e181e9e26724f32a188b9a78b25dece1
|
|
BLAKE2b-256 |
39c92e838fb07ae91039ce31a6d20d7f305f40fc657ab744359b086070e36a17
|
File details
Details for the file playmedia-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: playmedia-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
cf2fc53b71fe21c9b3cd07c2c3e7a0a7ca8971823c64facbcab5dc5d209e8c86
|
|
MD5 |
fe531cfb3e3a98bd23361546dcce9661
|
|
BLAKE2b-256 |
1c72716172374d778de497b03f76bb75b63992aad7d883b50f8361054b71a274
|