X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=mtopls;h=78476c60b72b0bc18da9a44d63612b3f97eb143a;hb=86013a2622c1f21cc64ef81733d48023caaf75a9;hp=169ff805aacc2d4042a5876c51808101697a01e1;hpb=8e106468de2f526a5d15ef8de885ad79dd553847;p=mpd-goodies.git diff --git a/mtopls b/mtopls index 169ff80..78476c6 100755 --- a/mtopls +++ b/mtopls @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (c) 2009 Efrim {{{ +# Copyright (c) 2009, 2010 Efrim {{{ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ import sys 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: @@ -56,8 +56,8 @@ class MtoPls(object): 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): @@ -85,7 +85,7 @@ class MtoPls(object): 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')) @@ -117,7 +117,7 @@ class MtoPls(object): # 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