# ``make_playlist``: Playlist maker
<img src="img/mkpl_logo.svg" alt="mkpl" title="mkpl" width="200" height="200" />
``mkpl`` is a _command line tool_ to create playlist files (**[M3U](https://en.wikipedia.org/wiki/M3U) format**).
## Installation
To install ``mkpl``, see here:
```console
$ pip install make_playlist # for python enviroment
$ git clone https://github.com/MatteoGuadrini/mkpl.git && cd mkpl
$ pip install . # for others
```
## Command arguments
``mkpl`` have many command line arguments. They are explained in this table:
| short | long | description | args |
|-------|-------------------|-----------------------------------------------|---------------------------|
| -d | --directories | Directories that contains multimedia file | Path of directories |
| -e | --exclude-dirs | Exclude directory paths | Path of directories |
| -i | --include | Include other file format | Format of file. ex. mp3 |
| -p | --pattern | Regular expression inclusion pattern | Regular expression string |
| -P | --exclude-pattern | Regular expression exclusion pattern | Regular expression string |
| -f | --format | Select only a file format | Format of file. ex. mp3 |
| -s | --size | Minimum size (bytes, kb, mb, ...) | Bytes (kb, mb, gb, ...) |
| -m | --max-tracks | Maximum number of tracks | Number |
| -t | --title | Playlist title | Title string |
| -g | --encoding | Text encoding | UTF-8,ASCII,UNICODE |
| -I | --image | Playlist image | Image path |
| -l | --link | Add remote file links | Http links |
| -F | --file | Add files | Files |
| -j | --join | Join one or more other playlist files | Playlist files |
| -n | --cache | Cache playlist results | Seconds |
| -U | --url-chars | Substitute some chars with URL Encoding | |
| -r | --recursive | Recursive search | |
| -a | --absolute | Absolute file name | |
| -s | --shuffle | Casual order | |
| -u | --unique | The same files are not placed in the playlist | |
| -c | --append | Continue playlist instead of override it | |
| -w | --windows | Windows style folder separator | |
| -v | --verbose | Enable verbosity (debug mode) | |
| -S | --split | Split playlist by directories | |
| -R | --interactive | Asks each file for confirmation | |
| -C | --count | Count elements into playlist | |
| -o | --orderby-name | Order playlist files by name | |
| -O | --orderby-date | Order playlist files by creation date | |
| -T | --orderby-track | Order playlist files by track | |
| -y | --orderby-year | Order playlist files by year | |
| -Z | --orderby-size | Order playlist files by size | |
| -L | --orderby-length | Order playlist files by length | |
## Examples
1. Create a playlist for one music album:
```bash
cd myalbum
mkpl myalbum.m3u
```
2. Create a playlist for one music album and add other multimedia files (`-F` option):
```bash
cd myalbum_special
mkpl myalbum_special.m3u -F music_video.mp4 other_stuff/song1.mp3 other_stuff/song2.mp3
```
3. Create a playlist of a film saga
```bash
mkpl -d HarryPotter -f mkv HP_saga.m3u
```
4. Create a shuffled playlist with my music collection; include only files with minimum size of 2 Megabyte
```bash
mkpl -d "my_mp3_collection" "my_mp4_collection" -rs -z 2mb "my music.m3u"
```
5. Create a shuffled playlist with my music collection and exclude dirs
```bash
mkpl -d "my_mp3_collection" "my_mp4_collection" -r -s -e "my_mp3_collection/metallica" "my_mp3_collection/dk" -- "my music.m3u"
```
6. Create a TV series playlist with max 15 tracks
```bash
mkpl -d "my_series/GOT" -m 15 "got_first_15.m3u"
```
7. Add into _my music_ playlist new songs and don't add same file
```bash
mkpl -d "new_collection" -rsu "my music.m3u" -a
```
8. Create playlist with music and video files if files is greater then 10MB
```bash
mkpl -d "my_files" -r -z 10485760 "multimedia.m3u"
```
9. Create playlist with only number one and two tracks with regular expression
```bash
mkpl -d "my_mp3_collection" -r -p "^[12]|[012]{2}" "my music.m3u"
```
10. Create a playlist for one music album and set the title:
```bash
cd myalbum
mkpl myalbum.m3u -t "My Album"
```
11. Create a playlist and add _UTF-8_ encoding
```bash
mkpl -d "new_collection" -r "my music.m3u" -g "UTF-8"
```
12. Create a playlist and set image
```bash
mkpl -d "new_collection" -r "my music.m3u" -I "new_collection/playlist_cover.jpg"
```
13. Create a playlist and add remote file links
```bash
mkpl -d "new_collection" -r "my music.m3u" -l http://192.168.1.123/mp3/song1.mp3, http://192.168.1.123/mp3/song2.mp4
```
14. Create a playlist and set Windows backslash (\\) folder separator (for Windows OS)
```bash
mkpl -d "new_collection" -r "my music.m3u" -w
```
15. Split playlist into _N_ playlists fon _N_ directories
```bash
mkpl -d "folder1" "folder2" "folder3" -r "my_music.m3u" -S
```
Result:
```console
$> ls
my_music.m3u
folder1.m3u
folder2.m3u
folder3.m3u
...
```
16. Sort playlist files by name (`-o`), by creation date (`-O`), by track number (`-T`), by year (`-y`), by size (`-Z`) or by length (`-L`):
```bash
mkpl -d "new_collection" -r "my music.m3u" -o
mkpl -d "new_collection" -r "my music.m3u" -O
mkpl -d "new_collection" -r "my music.m3u" -T
mkpl -d "new_collection" -r "my music.m3u" -y
mkpl -d "new_collection" -r "my music.m3u" -Z
mkpl -d "new_collection" -r "my music.m3u" -L
```
17. Join the _"First playlist.m3u"_ and _"Second playlist.m3u8"_ with new **"Third playlist.m3u"**:
```bash
mkpl -d "new_collection" -r "Third playlist" -j "First playlist.m3u" "Second playlist.m3u8"
```
18. Counts the multimedia files:
```console
mkpl -d "new_collection" -r "My new collection" -C
4023
```
19. Asks confirmation for every file into folders:
```console
mkpl -d "new_collection" -r "My new collection" -R
Add file new_collection/sample1.mp3 to playlist? [Y/n]:y
Add file new_collection/sample2.mp3 to playlist? [Y/n]:Y
Add file new_collection/sample3.mp3 to playlist? [Y/n]:n
Add file new_collection/sample4.mp3 to playlist? [Y/n]:N
```
## Use it like Python module
`mkpl` can also be used as a Python module to customize your scripts.
```python
from make_playlist import *
# Prepare playlist list: find multimedia files with name starts between a and f
playlist = make_playlist('/Music/collections',
('mp3', 'mp4', 'aac'),
'^[a-f].*',
recursive=True,
unique=True)
# Write playlist to file
write_playlist('/Music/AtoF.m3u', 'wt', playlist)
```
## Open source
_mkpl_ is an open source project. Any contribute, It's welcome.
**A great thanks**.
For donations, press this
For me
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/guos)
For [Telethon](http://www.telethon.it/)
The Telethon Foundation is a non-profit organization recognized by the Ministry of University and Scientific and Technological Research.
They were born in 1990 to respond to the appeal of patients suffering from rare diseases.
Come today, we are organized to dare to listen to them and answers, every day of the year.
[Adopt the future](https://www.ioadottoilfuturo.it/)
## Treeware
This package is [Treeware](https://treeware.earth). If you use it in production,
then we ask that you [**buy the world a tree**](https://plant.treeware.earth/matteoguadrini/mkpl) to thank us for our work.
By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
[![Treeware](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=Treeware&query=%24.total&url=https%3A%2F%2Fpublic.offset.earth%2Fusers%2Ftreeware%2Ftrees)](https://treeware.earth)
## Acknowledgments
Thanks to Mark Lutz for writing the _Learning Python_ and _Programming Python_ books that make up my python foundation.
Thanks to Kenneth Reitz and Tanya Schlusser for writing the _The Hitchhiker’s Guide to Python_ books.
Thanks to Dane Hillard for writing the _Practices of the Python Pro_ books.
Special thanks go to my wife, who understood the hours of absence for this development.
Thanks to my children, for the daily inspiration they give me and to make me realize, that life must be simple.
Thanks, Python!
Raw data
{
"_id": null,
"home_page": null,
"name": "make-playlist",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Matteo Guadrini <matteo.guadrini@hotmail.it>",
"keywords": "playlist, multimedia, file, maker, make, m3u, m3u8",
"author": null,
"author_email": "Matteo Guadrini <matteo.guadrini@hotmail.it>",
"download_url": "https://files.pythonhosted.org/packages/26/82/4df14a7f5b585c93427f877d3d1332df4ef8fc0cce87bead6a68e044db3f/make_playlist-1.11.0.tar.gz",
"platform": null,
"description": "# ``make_playlist``: Playlist maker\n\n<img src=\"img/mkpl_logo.svg\" alt=\"mkpl\" title=\"mkpl\" width=\"200\" height=\"200\" />\n\n``mkpl`` is a _command line tool_ to create playlist files (**[M3U](https://en.wikipedia.org/wiki/M3U) format**).\n\n## Installation\n\nTo install ``mkpl``, see here:\n\n```console\n$ pip install make_playlist # for python enviroment\n\n$ git clone https://github.com/MatteoGuadrini/mkpl.git && cd mkpl\n$ pip install . # for others\n```\n\n## Command arguments\n\n``mkpl`` have many command line arguments. They are explained in this table:\n\n| short | long | description | args |\n|-------|-------------------|-----------------------------------------------|---------------------------|\n| -d | --directories | Directories that contains multimedia file | Path of directories |\n| -e | --exclude-dirs | Exclude directory paths | Path of directories |\n| -i | --include | Include other file format | Format of file. ex. mp3 |\n| -p | --pattern | Regular expression inclusion pattern | Regular expression string |\n| -P | --exclude-pattern | Regular expression exclusion pattern | Regular expression string |\n| -f | --format | Select only a file format | Format of file. ex. mp3 |\n| -s | --size | Minimum size (bytes, kb, mb, ...) | Bytes (kb, mb, gb, ...) |\n| -m | --max-tracks | Maximum number of tracks | Number |\n| -t | --title | Playlist title | Title string |\n| -g | --encoding | Text encoding | UTF-8,ASCII,UNICODE |\n| -I | --image | Playlist image | Image path |\n| -l | --link | Add remote file links | Http links |\n| -F | --file | Add files | Files |\n| -j | --join | Join one or more other playlist files | Playlist files |\n| -n | --cache | Cache playlist results | Seconds |\n| -U | --url-chars | Substitute some chars with URL Encoding | |\n| -r | --recursive | Recursive search | |\n| -a | --absolute | Absolute file name | |\n| -s | --shuffle | Casual order | |\n| -u | --unique | The same files are not placed in the playlist | |\n| -c | --append | Continue playlist instead of override it | |\n| -w | --windows | Windows style folder separator | |\n| -v | --verbose | Enable verbosity (debug mode) | |\n| -S | --split | Split playlist by directories | |\n| -R | --interactive | Asks each file for confirmation | |\n| -C | --count | Count elements into playlist | |\n| -o | --orderby-name | Order playlist files by name | |\n| -O | --orderby-date | Order playlist files by creation date | |\n| -T | --orderby-track | Order playlist files by track | |\n| -y | --orderby-year | Order playlist files by year | |\n| -Z | --orderby-size | Order playlist files by size | |\n| -L | --orderby-length | Order playlist files by length | |\n\n## Examples\n\n1. Create a playlist for one music album:\n\n ```bash\n cd myalbum\n mkpl myalbum.m3u\n ```\n \n2. Create a playlist for one music album and add other multimedia files (`-F` option):\n\n ```bash\n cd myalbum_special\n mkpl myalbum_special.m3u -F music_video.mp4 other_stuff/song1.mp3 other_stuff/song2.mp3\n ```\n\n3. Create a playlist of a film saga\n\n ```bash\n mkpl -d HarryPotter -f mkv HP_saga.m3u\n ```\n\n4. Create a shuffled playlist with my music collection; include only files with minimum size of 2 Megabyte\n\n ```bash\n mkpl -d \"my_mp3_collection\" \"my_mp4_collection\" -rs -z 2mb \"my music.m3u\"\n ```\n \n5. Create a shuffled playlist with my music collection and exclude dirs\n\n ```bash\n mkpl -d \"my_mp3_collection\" \"my_mp4_collection\" -r -s -e \"my_mp3_collection/metallica\" \"my_mp3_collection/dk\" -- \"my music.m3u\"\n ```\n \n6. Create a TV series playlist with max 15 tracks\n\n ```bash\n mkpl -d \"my_series/GOT\" -m 15 \"got_first_15.m3u\"\n ```\n \n7. Add into _my music_ playlist new songs and don't add same file\n\n ```bash\n mkpl -d \"new_collection\" -rsu \"my music.m3u\" -a\n ```\n \n8. Create playlist with music and video files if files is greater then 10MB\n\n ```bash\n mkpl -d \"my_files\" -r -z 10485760 \"multimedia.m3u\"\n ```\n \n9. Create playlist with only number one and two tracks with regular expression\n\n ```bash\n mkpl -d \"my_mp3_collection\" -r -p \"^[12]|[012]{2}\" \"my music.m3u\"\n ```\n\n10. Create a playlist for one music album and set the title:\n\n ```bash\n cd myalbum\n mkpl myalbum.m3u -t \"My Album\"\n ```\n \n11. Create a playlist and add _UTF-8_ encoding\n\n ```bash\n mkpl -d \"new_collection\" -r \"my music.m3u\" -g \"UTF-8\"\n ```\n\n12. Create a playlist and set image\n\n ```bash\n mkpl -d \"new_collection\" -r \"my music.m3u\" -I \"new_collection/playlist_cover.jpg\"\n ```\n\n13. Create a playlist and add remote file links\n\n ```bash\n mkpl -d \"new_collection\" -r \"my music.m3u\" -l http://192.168.1.123/mp3/song1.mp3, http://192.168.1.123/mp3/song2.mp4\n ```\n \n14. Create a playlist and set Windows backslash (\\\\) folder separator (for Windows OS)\n\n ```bash\n mkpl -d \"new_collection\" -r \"my music.m3u\" -w\n ```\n\n15. Split playlist into _N_ playlists fon _N_ directories\n\n ```bash\n mkpl -d \"folder1\" \"folder2\" \"folder3\" -r \"my_music.m3u\" -S\n ```\n Result:\n ```console\n $> ls\n my_music.m3u\n folder1.m3u\n folder2.m3u\n folder3.m3u\n ...\n ```\n\n16. Sort playlist files by name (`-o`), by creation date (`-O`), by track number (`-T`), by year (`-y`), by size (`-Z`) or by length (`-L`):\n\n ```bash\n mkpl -d \"new_collection\" -r \"my music.m3u\" -o\n mkpl -d \"new_collection\" -r \"my music.m3u\" -O\n mkpl -d \"new_collection\" -r \"my music.m3u\" -T\n mkpl -d \"new_collection\" -r \"my music.m3u\" -y\n mkpl -d \"new_collection\" -r \"my music.m3u\" -Z\n mkpl -d \"new_collection\" -r \"my music.m3u\" -L\n ```\n\n17. Join the _\"First playlist.m3u\"_ and _\"Second playlist.m3u8\"_ with new **\"Third playlist.m3u\"**:\n\n ```bash\n mkpl -d \"new_collection\" -r \"Third playlist\" -j \"First playlist.m3u\" \"Second playlist.m3u8\"\n ```\n\n18. Counts the multimedia files:\n\n ```console\n mkpl -d \"new_collection\" -r \"My new collection\" -C\n 4023\n ```\n\n19. Asks confirmation for every file into folders:\n\n ```console\n mkpl -d \"new_collection\" -r \"My new collection\" -R\n Add file new_collection/sample1.mp3 to playlist? [Y/n]:y\n Add file new_collection/sample2.mp3 to playlist? [Y/n]:Y\n Add file new_collection/sample3.mp3 to playlist? [Y/n]:n\n Add file new_collection/sample4.mp3 to playlist? [Y/n]:N\n ```\n\n## Use it like Python module\n\n`mkpl` can also be used as a Python module to customize your scripts.\n\n```python\nfrom make_playlist import *\n\n# Prepare playlist list: find multimedia files with name starts between a and f\nplaylist = make_playlist('/Music/collections',\n ('mp3', 'mp4', 'aac'),\n '^[a-f].*',\n recursive=True,\n unique=True)\n\n# Write playlist to file\nwrite_playlist('/Music/AtoF.m3u', 'wt', playlist)\n```\n \n## Open source\n_mkpl_ is an open source project. Any contribute, It's welcome.\n\n**A great thanks**.\n\nFor donations, press this\n\nFor me\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/guos)\n\nFor [Telethon](http://www.telethon.it/)\n\nThe Telethon Foundation is a non-profit organization recognized by the Ministry of University and Scientific and Technological Research.\nThey were born in 1990 to respond to the appeal of patients suffering from rare diseases.\nCome today, we are organized to dare to listen to them and answers, every day of the year.\n\n[Adopt the future](https://www.ioadottoilfuturo.it/)\n\n\n## Treeware \n\nThis package is [Treeware](https://treeware.earth). If you use it in production, \nthen we ask that you [**buy the world a tree**](https://plant.treeware.earth/matteoguadrini/mkpl) to thank us for our work. \nBy contributing to the Treeware forest you\u2019ll be creating employment for local families and restoring wildlife habitats.\n\n[![Treeware](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=Treeware&query=%24.total&url=https%3A%2F%2Fpublic.offset.earth%2Fusers%2Ftreeware%2Ftrees)](https://treeware.earth)\n\n\n## Acknowledgments\n\nThanks to Mark Lutz for writing the _Learning Python_ and _Programming Python_ books that make up my python foundation.\n\nThanks to Kenneth Reitz and Tanya Schlusser for writing the _The Hitchhiker\u2019s Guide to Python_ books.\n\nThanks to Dane Hillard for writing the _Practices of the Python Pro_ books.\n\nSpecial thanks go to my wife, who understood the hours of absence for this development. \nThanks to my children, for the daily inspiration they give me and to make me realize, that life must be simple.\n\nThanks, Python!\n",
"bugtrack_url": null,
"license": null,
"summary": "Make M3U format playlist from command line.",
"version": "1.11.0",
"project_urls": {
"changelog": "https://github.com/MatteoGuadrini/mkpl/blob/master/CHANGES.md",
"documentation": "https://matteoguadrini.github.io/mkpl/",
"homepage": "https://github.com/MatteoGuadrini/mkpl"
},
"split_keywords": [
"playlist",
" multimedia",
" file",
" maker",
" make",
" m3u",
" m3u8"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "49ff23a3d72b64cdd425179fb87596d53139d51bbaa765358b031f852febc944",
"md5": "8c51d123604326a77637cb4ff3cc9afe",
"sha256": "6640eb7b43042f965adeb17cdef153f651ea4e03216f5d2b51ec359595f7cd32"
},
"downloads": -1,
"filename": "make_playlist-1.11.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8c51d123604326a77637cb4ff3cc9afe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 23808,
"upload_time": "2024-11-22T09:37:40",
"upload_time_iso_8601": "2024-11-22T09:37:40.703974Z",
"url": "https://files.pythonhosted.org/packages/49/ff/23a3d72b64cdd425179fb87596d53139d51bbaa765358b031f852febc944/make_playlist-1.11.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "26824df14a7f5b585c93427f877d3d1332df4ef8fc0cce87bead6a68e044db3f",
"md5": "7a649a457c7f94279d91e0c420763c43",
"sha256": "79638b65cddef150e5fbceca7bbf9863309c754df83a3060391f6b1b6a10c17b"
},
"downloads": -1,
"filename": "make_playlist-1.11.0.tar.gz",
"has_sig": false,
"md5_digest": "7a649a457c7f94279d91e0c420763c43",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 23340,
"upload_time": "2024-11-22T09:37:41",
"upload_time_iso_8601": "2024-11-22T09:37:41.963842Z",
"url": "https://files.pythonhosted.org/packages/26/82/4df14a7f5b585c93427f877d3d1332df4ef8fc0cce87bead6a68e044db3f/make_playlist-1.11.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-22 09:37:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MatteoGuadrini",
"github_project": "mkpl",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "make-playlist"
}