Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes to work out of box on macOS Sierra itunes .m3u #2

Open
idcrook opened this issue Apr 4, 2017 · 0 comments
Open

fixes to work out of box on macOS Sierra itunes .m3u #2

idcrook opened this issue Apr 4, 2017 · 0 comments

Comments

@idcrook
Copy link

idcrook commented Apr 4, 2017

I needed to make a few tweaks for this to work "as advertised" on macOS, Python 2.7.13, with a .m3u file generated from iTunes playlist export on macOS.

The 'U' in the open statement stands for universal line ending support. The .m3u from iTunes has \r/^M as its line separator characters.

Found here: http://stackoverflow.com/questions/4158645/make-the-readline-method-of-python-recognize-both-end-of-line-variations

Don't have time to make real PR at the moment.

--- orig/m3uparser.py	2017-04-04 13:57:55.000000000 -0600
+++ m3uparser.py	2017-04-04 13:57:14.000000000 -0600
@@ -1,5 +1,6 @@
 # more info on the M3U file format available here:
 # http://n4k3d.com/the-m3u-file-format/
+# from https://github.com/dvndrsn/M3uParser/raw/master/m3uparser.py

 import sys

@@ -18,11 +19,11 @@
     ..\Minus The Bear - Planet of Ice\Minus The Bear_Planet of Ice_01_Burying Luck.mp3
 """

-def parsem3u(infile):
+def parseM3U(infile):
     try:
         assert(type(infile) == '_io.TextIOWrapper')
     except AssertionError:
-        infile = open(infile,'r')
+        infile = open(infile,'rU')

     """
         All M3U files start with #EXTM3U.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant