from os import (access, F_OK, W_OK)
from os.path import (dirname, isfile, join, abspath)
-from lib.mpdutils import mconnect
+from lib.mpdutils import (mconnect, collapse_tags)
USAGE = """Usage:
self.current = self.cli.currentsong()
self.cli.disconnect()
self._consume_sopt()
- self._create_playlist()
self._controls_perm()
+ self._create_playlist()
self._run()
def _consume_sopt(self):
if not access(mpd_playlists, F_OK):
sys.stderr.write('Error: No access to "%s"' % self.pls_path)
sys.exit(1)
- genre = self.current.get('genre', None)
+ genre = collapse_tags(self.current.get('genre', None))
if not genre:
sys.stderr.write('Error: No genre set in %s\n' %
self.current.get('file'))
# TODO: controls either file is already in playlist or not
print >> sys.stdout, ('Writing to %s' % self.pls_path)
fd = open(self.pls_path, 'a')
- fd.write(self.current.get('file'))
+ fd.write(self.current.get('file') + '\n')
fd.close()
pass