mkpl
is a command line tool to create playlist files (M3U format).
To install mkpl
, see here:
$ pip install make_playlist # for python enviroment
$ git clone https://github.com/MatteoGuadrini/mkpl.git && cd mkpl
$ pip install . # for others
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 |
-f | --format | Select only a file format | Format of file. ex. mp3 |
-s | --size | Start size in bytes | Bytes number |
-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 local or remote 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 |
-
Create a playlist for one music album:
cd myalbum mkpl myalbum.m3u
-
Create a playlist of a film saga
mkpl -d HarryPotter -f mkv HP_saga.m3u
-
Create a shuffled playlist with my music collection
mkpl -d "my_mp3_collection" "my_mp4_collection" -rs "my music.m3u"
-
Create a shuffled playlist with my music collection and exclude dirs
mkpl -d "my_mp3_collection" "my_mp4_collection" -r -s -e "my_mp3_collection/metallica" "my_mp3_collection/dk" -- "my music.m3u"
-
Create a TV series playlist with max 15 tracks
mkpl -d "my_series/GOT" -m 15 "got_first_15.m3u"
-
Add into my music playlist new songs and don't add same file
mkpl -d "new_collection" -rsu "my music.m3u" -a
-
Create playlist with music and video files if files is greater then 10MB
mkpl -d "my_files" -r -z 10485760 "multimedia.m3u"
-
Create playlist with only number one and two tracks with regular expression
mkpl -d "my_mp3_collection" -r -p "^[12]|[012]{2}" "my music.m3u"
-
Create a playlist for one music album and set the title:
cd myalbum mkpl myalbum.m3u -t "My Album"
-
Create a playlist and add UTF-8 encoding
mkpl -d "new_collection" -r "my music.m3u" -g "UTF-8"
-
Create a playlist and set image
mkpl -d "new_collection" -r "my music.m3u" -I "new_collection/playlist_cover.jpg"
-
Create a playlist and add remote file links
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
-
Create a playlist and set Windows backslash (\) folder separator (for Windows OS)
mkpl -d "new_collection" -r "my music.m3u" -w
-
Split playlist into N playlists fon N directories
mkpl -d "folder1" "folder2" "folder3" -r "my_music.m3u" -S
Result:
$> ls my_music.m3u folder1.m3u folder2.m3u folder3.m3u ...
-
Sort playlist files by name (
-o
), by creation date (-O
), by track number (-T
), by year (-y
), by size (-Z
) or by length (-L
):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
-
Join the "First playlist.m3u" and "Second playlist.m3u8" with new "Third playlist.m3u":
mkpl -d "new_collection" -r "Third playlist" -j "First playlist.m3u" "Second playlist.m3u8"
-
Counts the multimedia files:
mkpl -d "new_collection" -r "My new collection" -C 4023
-
Asks confirmation for every file into folders:
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
mkpl
can also be used as a Python module to customize your scripts.
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)
mkpl is an open source project. Any contribute, It's welcome.
A great thanks.
For donations, press this
For me
For Telethon
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.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
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!