X-Git-Url: https://git.kaliko.me/?p=mpd-goodies.git;a=blobdiff_plain;f=bin%2Fmlast;h=1ea8958ecb56d9661da2f0058f049ff164a3a86b;hp=b664aebccf8ac5b2d32a750ac08dc03a6bccf3f8;hb=refs%2Fheads%2Fdev;hpb=dc5640157f0a108bfe671b7652241460dfd0b78e diff --git a/bin/mlast b/bin/mlast index b664aeb..1ea8958 100755 --- a/bin/mlast +++ b/bin/mlast @@ -1,21 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- - -# Copyright (c) 2009,2010,2012,2019 kaliko -# -# 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# +# SPDX-FileCopyrightText: 2009,2010,2012,2019 kaliko +# SPDX-License-Identifier: GPL-3.0-or-later import argparse import sys @@ -90,8 +76,8 @@ class MLast(musicpd.MPDClient): bucket = [] self.connect() version = self.mpd_version - if version[:4] not in ['0.21', '0.22']: - print('MPD version might be < 0.21, need filter') + if version[:4] in ['0.20', '0.19', '0.18', '0.17']: + print(f'MPD version might be < 0.21, need filter (got {version})') sys.exit(1) # Total number of tracks in library nb_files = int(self.stats()['songs']) @@ -112,7 +98,8 @@ class MLast(musicpd.MPDClient): _ = [(f.get('artist'),) for f in files] bucket = unic(bucket + _) elif self.args.track: - _ = [(f.get('artist'), f.get('album'), f.get('title')) for f in files] + _ = [(f.get('artist'), f.get('album'), f.get('title')) + for f in files] # bucket = unic(bucket + _) bucket = unic(_ + bucket) if len(bucket) >= self.args.n: