diff --git a/CHANGES.md b/CHANGES.md index 1967973..f3da0e8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/README.md b/README.md index c8b7ba5..cdd37a8 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/__info__.py b/__info__.py index d60446a..0a98655 100644 --- a/__info__.py +++ b/__info__.py @@ -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' diff --git a/mkpl.py b/mkpl.py index 66c1058..f75b5fb 100644 --- a/mkpl.py +++ b/mkpl.py @@ -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 @@ -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 @@ -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' @@ -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: