File indexing completed on 2024-05-19 15:54:39

0001 // SPDX-FileCopyrightText: 2021 Jonah BrĂ¼chert <jbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #include "playlistutils.h"
0006 
0007 #include <QString>
0008 
0009 #include <numeric>
0010 
0011 #include <ytmusic.h>
0012 
0013 namespace PlaylistUtils {
0014 
0015 QString artistsToString(const std::vector<meta::Artist> &artists)
0016 {
0017     if (!artists.empty()) {
0018         QString string = QString::fromStdString(artists.front().name);
0019         std::for_each(artists.begin() + 1, artists.end(),
0020                                [&string](const meta::Artist &artist) {
0021             string.append(QStringLiteral(", %1").arg(QString::fromStdString(artist.name)));
0022         });
0023         return string;
0024     }
0025 
0026     return {};
0027 }
0028 
0029 }