Skip to content

Commit

Permalink
New stable release
Browse files Browse the repository at this point in the history
Add windows arguments.
  • Loading branch information
MatteoGuadrini committed Sep 28, 2022
2 parents d94ba30 + 50fef39 commit b0724f6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release notes

## 1.2.0
Sep 19, 2022

- Add _windows_ argument
- Fix file extension with UNICODE encode

## 1.1.0
Sep 19, 2022

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ $ python setup.py install # for others
| -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 | |

## Examples

Expand Down Expand Up @@ -113,6 +114,13 @@ $ python setup.py install # for others
```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
```
13. Create a playlist and set Windows backslash (\) folder separator (for Windows OS)
```bash
mkpl -d "new_collection" -r "my music.m3u" -w
```
## Open source
_mkpl_ is an open source project. Any contribute, It's welcome.
Expand Down
2 changes: 1 addition & 1 deletion __info__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

"""Information variable used by modules on this package."""

__version__ = '1.1.0'
__version__ = '1.2.0'
__author__ = 'Matteo Guadrini'
__email__ = 'matteo.guadrini@hotmail.it'
__homepage__ = 'https://github.com/MatteoGuadrini/mkpl'
14 changes: 10 additions & 4 deletions mkpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# region imports
import argparse
from re import findall
from re import findall, sub
from filecmp import cmp
from os.path import join
from pathlib import Path
Expand All @@ -35,7 +35,7 @@
# region globals
FILE_FORMAT = {'mp1', 'mp2', 'mp3', 'mp4', 'aac', 'ogg', 'wav', 'wma',
'avi', 'xvid', 'divx', 'mpeg', 'mpg', 'mov', 'wmv'}
__version__ = '1.1.0'
__version__ = '1.2.0'


# endregion
Expand Down Expand Up @@ -72,12 +72,16 @@ def get_args():
parser.add_argument("-s", "--shuffle", help="Casual order", action='store_true')
parser.add_argument("-u", "--unique", help="The same files are not placed in the playlist", action='store_true')
parser.add_argument("-c", "--append", help="Continue playlist instead of override it", action='store_true')
parser.add_argument("-w", "--windows", help="Windows style folder separator", action='store_true')

args = parser.parse_args()

# Check extension of playlist file
if not args.playlist.endswith('.m3u'):
args.playlist += '.m3u'
if args.encoding == 'UNICODE':
args.playlist += '.m3u8'
else:
args.playlist += '.m3u'

# Open playlist file
mode = 'at' if args.append else 'wt'
Expand Down Expand Up @@ -160,7 +164,9 @@ def main():
if findall(args.pattern, file):
# Check file size
if size >= args.size:
multimedia_files.append(file)
multimedia_files.append(
sub('/', r"\\", file) if args.windows else file
)

# Build a playlist
if multimedia_files:
Expand Down

0 comments on commit b0724f6

Please sign in to comment.