xspf2m3u

simple XSPF to M3U conversion
git clone https://git.ce9e.org/xspf2m3u.git

commit
92e8580598551428e58adc86eb9b60e20198f056
parent
cae577fdaa20650dd7b8d6985862264bfe0141e7
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-09-12 13:09
package

Diffstat

A README.rst 20 ++++++++++++++++++++
A setup.py 31 +++++++++++++++++++++++++++++++
M xspf2m3u.py 2 ++

3 files changed, 53 insertions, 0 deletions


diff --git a/README.rst b/README.rst

@@ -0,0 +1,20 @@
   -1     1 xspf2m3u - simple XSPF to M3U conversion
   -1     2 
   -1     3 Playlists tend to break whenever you reorder your music collection. The
   -1     4 `XSPF <http://www.xspf.org/xspf-v1.html>`_ format allows to specify songs by
   -1     5 metadata rather than file location, so it theoretically solves that problem.
   -1     6 Unfortnately, most audio players do not support that format.
   -1     7 
   -1     8 This script allows to convert XSPF to M3U by finding file locations that match
   -1     9 the given metadata. It is *not* a full content resolver. In fact, it is rather
   -1    10 dumb. It uses the following strategies:
   -1    11 
   -1    12 -   If the input file specifies a location, use that.
   -1    13 -   If the path of a file on the local computer looks like it could match, use
   -1    14     that.
   -1    15 -   If youtube-dl is installed, use it to search youtube. The resulting URL
   -1    16     will expire after 6 hours.
   -1    17 
   -1    18 Usage::
   -1    19 
   -1    20     xspf2m3u input.xspf /my/music > output.m3u

diff --git a/setup.py b/setup.py

@@ -0,0 +1,31 @@
   -1     1 #!/usr/bin/env python
   -1     2 
   -1     3 import os
   -1     4 import re
   -1     5 from setuptools import setup
   -1     6 
   -1     7 DIRNAME = os.path.abspath(os.path.dirname(__file__))
   -1     8 rel = lambda *parts: os.path.join(DIRNAME, *parts)
   -1     9 
   -1    10 README = open(rel('README.rst')).read()
   -1    11 CODE = open(rel('xspf2m3u.py')).read()
   -1    12 VERSION = re.search("__version__ = '([^']+)'", CODE).group(1)
   -1    13 NAME, DESCRIPTION = README.split('\n')[0].split(' - ')
   -1    14 
   -1    15 
   -1    16 setup(
   -1    17     name=NAME,
   -1    18     version=VERSION,
   -1    19     description=DESCRIPTION,
   -1    20     long_description=README,
   -1    21     url='https://github.com/xi/xspf2m3u',
   -1    22     author='Tobias Bengfort',
   -1    23     author_email='tobias.bengfort@posteo.de',
   -1    24     py_modules=['xspf2m3u'],
   -1    25     extras_require={
   -1    26         'youtube': ['youtube_dl'],
   -1    27     },
   -1    28     entry_points={'console_scripts': [
   -1    29         'xspf2m3u=xspf2m3u:main',
   -1    30     ]},
   -1    31     license='GPLv2+')

diff --git a/xspf2m3u.py b/xspf2m3u.py

@@ -19,6 +19,8 @@ NS = '{http://xspf.org/ns/0/}'
   19    19 EXTS = ['mp3', 'ogg', 'opus', 'mp4', 'm4a', 'wav', 'flac', 'wma']
   20    20 CHARS = re.compile('[^a-z0-9 ]')
   21    21 
   -1    22 __version__ = '0.0.0'
   -1    23 
   22    24 
   23    25 def iter_files(folder):
   24    26 	for dirpath, dirnames, filenames in os.walk(folder):