Compare commits

..
Author SHA1 Message Date
Suraj Kumar Mahto c42e2f3b42 initiate mpris work from elisa 2021-05-11 01:11:56 +05:30
51 changed files with 1166 additions and 510 deletions

No files matched your search

+1 -4
View File
@@ -1,6 +1,3 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
CMakeLists.txt.user
flatpak/flatpak-builder-tools/
build/
-6
View File
@@ -1,6 +0,0 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
include:
- 'https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-reuse.yml'
-4
View File
@@ -1,4 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: AudioTube
Upstream-Contact: Jonah Brüchert <[email protected]>
Source: https://invent.kde.org/plasma-mobile/audiotube
+3 -9
View File
@@ -1,8 +1,4 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
cmake_minimum_required(VERSION 3.16.0)
cmake_minimum_required(VERSION 3.14)
project(audiotube)
@@ -16,7 +12,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
include(KDEInstallDirs)
include(KDECMakeSettings)
@@ -28,10 +24,8 @@ include(ECMPoQmTools)
kde_enable_exceptions()
find_package(Qt5 ${QT5_MIN_VERSION} REQUIRED COMPONENTS Core Gui Qml QuickControls2 Svg)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n CoreAddons Crash)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n)
find_package(pybind11 REQUIRED)
find_package(YoutubeDL REQUIRED RUNTIME)
find_package(YTMusicAPI REQUIRED RUNTIME)
add_subdirectory(src)
-22
View File
@@ -1,22 +0,0 @@
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-119
View File
@@ -1,119 +0,0 @@
Creative Commons Legal Code
CC0 1.0 Universal CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES
NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE
AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION
ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE
OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS
LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION
OR WORKS PROVIDED HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer exclusive
Copyright and Related Rights (defined below) upon the creator and subsequent
owner(s) (each and all, an "owner") of an original work of authorship and/or
a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later claims
of infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further production
of creative, cultural and scientific works, or to gain reputation or greater
distribution for their Work in part through the use and efforts of others.
For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with
a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or
her Copyright and Related Rights in the Work and the meaning and intended
legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be protected
by copyright and related or neighboring rights ("Copyright and Related Rights").
Copyright and Related Rights include, but are not limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work, subject
to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal protection
of databases, and under any national implementation thereof, including any
amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time extensions),
(iii) in any current or future medium and for any number of copies, and (iv)
for any purpose whatsoever, including without limitation commercial, advertising
or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the
benefit of each member of the public at large and to the detriment of Affirmer's
heirs and successors, fully intending that such Waiver shall not be subject
to revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account Affirmer's
express Statement of Purpose. In addition, to the extent the Waiver is so
judged Affirmer hereby grants to each affected person a royalty-free, non
transferable, non sublicensable, non exclusive, irrevocable and unconditional
license to exercise Affirmer's Copyright and Related Rights in the Work (i)
in all territories worldwide, (ii) for the maximum duration provided by applicable
law or treaty (including future time extensions), (iii) in any current or
future medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional purposes
(the "License"). The License shall be deemed effective as of the date CC0
was applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder of
the License, and in such case Affirmer hereby affirms that he or she will
not (i) exercise any of his or her remaining Copyright and Related Rights
in the Work or (ii) assert any associated claims and causes of action with
respect to the Work, in either case contrary to Affirmer's express Statement
of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered,
licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or other
defects, accuracy, or the present or absence of errors, whether or not discoverable,
all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims
responsibility for obtaining any necessary consents, permissions or other
rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a party
to this document and has no duty or obligation with respect to this CC0 or
use of the Work.
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: CC0-1.0
-4
View File
@@ -1,4 +0,0 @@
[Project]
CreatedFrom=CMakeLists.txt
Manager=KDevCMakeManager
Name=audiotube
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: CC0-1.0
-11
View File
@@ -1,11 +0,0 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
find_package(Python3 REQUIRED COMPONENTS Interpreter)
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import ytmusicapi" RESULT_VARIABLE YTMUSICAPI_CHECK_RESULT)
if (${YTMUSICAPI_CHECK_RESULT} EQUAL 0)
set(YTMusicAPI_FOUND TRUE)
endif()
-11
View File
@@ -1,11 +0,0 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
find_package(Python3 REQUIRED COMPONENTS Interpreter)
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import youtube_dl" RESULT_VARIABLE YTDL_CHECK_RESULT)
if (${YTDL_CHECK_RESULT} EQUAL 0)
set(YoutubeDL_FOUND TRUE)
endif()
+2 -2
View File
@@ -7,8 +7,8 @@
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/12/67/a37eb6231ff26b4a4bc7cee2568d44e11ffeddb84a9b0798869a4392f3ce/youtube_dl-2021.5.16.tar.gz",
"sha256": "4e569cb0477428fd96ee6f7e7a6640b7c9416be626ed708ac4b8ada6c5a6ffbe"
"url": "https://files.pythonhosted.org/packages/94/a0/b8325b524700daae1c04a6156473ab7091d44071353f1d7c9e66b9c7f019/youtube_dl-2021.4.26.tar.gz",
"sha256": "6f311ffaf8b88cdcf27a2301a2272455e213bdb780aa447246933a3da4532879"
}
]
}
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
+6 -6
View File
@@ -7,8 +7,8 @@
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/94/40/c396b5b212533716949a4d295f91a4c100d51ba95ea9e2d96b6b0517e5a5/urllib3-1.26.5.tar.gz",
"sha256": "a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098"
"url": "https://files.pythonhosted.org/packages/cb/cf/871177f1fc795c6c10787bc0e1f27bb6cf7b81dbde399fd35860472cecbc/urllib3-1.26.4.tar.gz",
"sha256": "e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"
},
{
"type": "file",
@@ -22,8 +22,8 @@
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/6d/78/f8db8d57f520a54f0b8a438319c342c61c22759d8f9a1cd2e2180b5e5ea9/certifi-2021.5.30.tar.gz",
"sha256": "2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee"
"url": "https://files.pythonhosted.org/packages/06/a9/cd1fd8ee13f73a4d4f491ee219deeeae20afefa914dfb4c130cfc9dc397a/certifi-2020.12.5.tar.gz",
"sha256": "1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"
},
{
"type": "file",
@@ -32,8 +32,8 @@
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/1b/8e/2bc4c8160083bbfaac215637f1e9f4a43263833c2e81212cba3073aeaa25/ytmusicapi-0.17.3.tar.gz",
"sha256": "9a249cc53efd6408034f401a9a4375272a9b339e8eb64f3a2e713a1ccd06d55b"
"url": "https://files.pythonhosted.org/packages/61/b5/da439d5f75db7ff17790b19136c835f9a315530436ee7bc9d75aeea2f6e5/ytmusicapi-0.16.0.tar.gz",
"sha256": "ffde3fb5a78123ac59dee37fc1f32793f34f9a4fa3d3e69a1fc08064112c2b5d"
}
]
}
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-4
View File
@@ -1,9 +1,5 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
set -e
export GIT_CLONE_ARGS="--depth 1 --single-branch"
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Mathis Brüchert <[email protected]>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-85
View File
@@ -1,97 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: CC0-1.0
-->
<component type="desktop-application">
<id>org.kde.audiotube</id>
<name>AudioTube</name>
<name xml:lang="ca">AudioTube</name>
<name xml:lang="ca-valencia">AudioTube</name>
<name xml:lang="cs">AudioTube</name>
<name xml:lang="de">AudioTube</name>
<name xml:lang="es">AudioTube</name>
<name xml:lang="fi">AudioTube</name>
<name xml:lang="fr">AudioTube</name>
<name xml:lang="it">AudioTube</name>
<name xml:lang="ko">AudioTube</name>
<name xml:lang="nl">AudioTube</name>
<name xml:lang="pl">AudioTube</name>
<name xml:lang="pt">AudioTube</name>
<name xml:lang="sk">AudioTube</name>
<name xml:lang="sl">AudioTube</name>
<name xml:lang="sv">AudioTube</name>
<name xml:lang="uk">AudioTube</name>
<name xml:lang="x-test">xxAudioTubexx</name>
<summary>Convergent YouTube Music client</summary>
<summary xml:lang="ca">Client convergent per a la música de YouTube</summary>
<summary xml:lang="ca-valencia">Client convergent per a la música de YouTube</summary>
<summary xml:lang="de">Konvergentes YouTube-Musikprogramm</summary>
<summary xml:lang="es">Cliente de música de YouTube convergente</summary>
<summary xml:lang="fi">Mukautuva YouTube Music -asiakas</summary>
<summary xml:lang="fr">Client convergent pour musique sur YouTube</summary>
<summary xml:lang="it">Client YouTube Music convergente</summary>
<summary xml:lang="ko">올인원 YouTube Music 클라이언트</summary>
<summary xml:lang="nl">Convergente muziekclient van YouTube</summary>
<summary xml:lang="pl">Całościowy program do muzyki z YouTube</summary>
<summary xml:lang="pt">Cliente de música do YouTube convergente</summary>
<summary xml:lang="sl">Konvergentni odjemalec glasbe YouTube</summary>
<summary xml:lang="sv">Konvergent YouTube-musikprogram</summary>
<summary xml:lang="uk">Зручний музичний клієнт YouTube</summary>
<summary xml:lang="x-test">xxConvergent YouTube Music clientxx</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+</project_license>
<developer_name>KDE Community</developer_name>
<developer_name xml:lang="ca">La comunitat KDE</developer_name>
<developer_name xml:lang="ca-valencia">La comunitat KDE</developer_name>
<developer_name xml:lang="cs">Komunita KDE</developer_name>
<developer_name xml:lang="de">KDE-Gemeinschaft</developer_name>
<developer_name xml:lang="es">Comunidad KDE</developer_name>
<developer_name xml:lang="fi">KDE-yhteisö</developer_name>
<developer_name xml:lang="fr">Communauté de KDE</developer_name>
<developer_name xml:lang="it">Comunità KDE</developer_name>
<developer_name xml:lang="ko">KDE 커뮤니티</developer_name>
<developer_name xml:lang="nl">KDE-gemeenschap</developer_name>
<developer_name xml:lang="pl">Społeczność KDE</developer_name>
<developer_name xml:lang="pt">Comunidade do KDE</developer_name>
<developer_name xml:lang="sk">KDE komunita</developer_name>
<developer_name xml:lang="sl">Skupnost KDE</developer_name>
<developer_name xml:lang="sv">KDE-gemenskapen</developer_name>
<developer_name xml:lang="uk">Спільнота KDE</developer_name>
<developer_name xml:lang="x-test">xxKDE Communityxx</developer_name>
<content_rating type="oars-1.0"/>
<url type="homepage">https://apps.kde.org/en/audiotube</url>
<launchable type="desktop-id">org.kde.audiotube.desktop</launchable>
<screenshots>
<screenshot>
<image>https://cdn.kde.org/screenshots/audiotube/desktop.png</image>
</screenshot>
<screenshot>
<image>https://cdn.kde.org/screenshots/audiotube/mobile_playlist.png</image>
</screenshot>
</screenshots>
<recommends>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
</recommends>
<description>
<p>AudioTube can search YouTube Music, list albums and artists, play automatically generated playlists, albums and allows to put your own playlist together.</p>
<p xml:lang="ca">L'AudioTube pot cercar música a YouTube, llistar àlbums i artistes, reproduir llistes de reproducció generades automàticament, àlbums i permet crear la vostra pròpia llista de reproducció.</p>
<p xml:lang="ca-valencia">L'AudioTube pot cercar música a YouTube, llistar àlbums i artistes, reproduir llistes de reproducció generades automàticament, àlbums i permet crear la vostra pròpia llista de reproducció.</p>
<p xml:lang="de">AudioTube kann Musik auf YouTube durchsuchen, Alben und Interpreten auflisten, automatisch generierte Wiedergabelisten und Alben abspielen und erlaubt es, eine eigene Wiedergabeliste zusammenzustellen.</p>
<p xml:lang="es">AudioTube puede buscar música de YouTube, listar álbumes y artistas, reproducir las listas de reproducción generadas, álbumes y le permite crear su propia lista de reproducción.</p>
<p xml:lang="fi">AudioTube osaa etsiä YouTube Music -haun, albumien ja artistien luettelun, luotujen soittolistojen automaattisen toiston ja omien soittolistojen kokoamisen.</p>
<p xml:lang="fr">AudioTube peut effectuer des recherches de musiques sur YouTube Music, établir une liste d'albums et d'artistes, lire des listes de lecture générées automatiquement, des albums et permet de composer sa propre liste de lecture.</p>
<p xml:lang="it">AudioTube può eseguire ricerche su YouTube Music, elencare album e artisti, riprodurre scalette e album generati automaticamente e ti consente di creare la tua scaletta.</p>
<p xml:lang="ko">AudioTube는 YouTube Music을 검색하고, 앨범과 아티스트를 표시하고, 자동 생성된 재생 목록, 앨범을 재생하고, 사용자 정의 재생 목록을 만들 수 있습니다.</p>
<p xml:lang="nl">AudioTube kan in YouTube Music zoeken, een lijst maken van albums en artiesten, automatically gegenereerde afspeellijsten, albums afspelen en biedt u het samenstellen van uw eigen afspeellijst.</p>
<p xml:lang="pl">AudioTube może wyszukać muzyki na YouTube, wypisać albumy i wykonawców, odtwarzać samoczynnie utworzone listy odtwarzania, albumy oraz umożliwia tworzenie własnych list odtwarzania.</p>
<p xml:lang="pt">O AudioTube consegue pesquisar no YouTube Music, enumerar os álbuns e artistas, reproduzir listas geradas automaticamente, álbuns e permite-lhe reproduzir as suas próprias listas de reprodução.</p>
<p xml:lang="sl">AudioTube lahko išče po YouTube Music, izdela sezname albumov in avtorjev, samodejno predvaja generirane sezname, albume in sestavlja vaše sezname predvajanja.</p>
<p xml:lang="sv">AudioTube kan söka på YouTube Music, lista album och artister, spela upp automatiskt genererade spellistor, albums och låter dig sammanställa egna spellistor.</p>
<p xml:lang="uk">AudioTube може виконувати пошук на YouTube Music, показувати списки альбомів та виконавців, відтворювати створені автоматично списки відтворення, альбоми та надає вам змогу створювати власні списки відворення.</p>
<p xml:lang="x-test">xxAudioTube can search YouTube Music, list albums and artists, play automatically generated playlists, albums and allows to put your own playlist together.xx</p>
</description>
</component>
-36
View File
@@ -1,42 +1,6 @@
[Desktop Entry]
Name=AudioTube
Name[ca]=AudioTube
Name[ca@valencia]=AudioTube
Name[cs]=AudioTube
Name[de]=AudioTube
Name[es]=AudioTube
Name[fi]=AudioTube
Name[fr]=AudioTube
Name[it]=AudioTube
Name[ko]=AudioTube
Name[nl]=AudioTube
Name[pl]=AudioTube
Name[pt]=AudioTube
Name[pt_BR]=AudioTube
Name[sk]=AudioTube
Name[sl]=AudioTube
Name[sv]=AudioTube
Name[uk]=AudioTube
Name[x-test]=xxAudioTubexx
Comment=YouTube Music client
Comment[ca]=Client de música de YouTube
Comment[ca@valencia]=Client de música de YouTube
Comment[cs]=Hudební klient YouTube
Comment[de]=YouTube-Musikprogramm
Comment[es]=Cliente de música de YouTube
Comment[fi]=YouTube Music -asiakas
Comment[fr]=Client de musique sur Youtube
Comment[it]=Client YouTube Music
Comment[ko]=YouTube Music 클라이언트
Comment[nl]=Muziekclient van YouTube
Comment[pl]=Program do muzyki z YouTube
Comment[pt]=Cliente do YouTube Music
Comment[pt_BR]=Cliente YouTube Music
Comment[sk]=Hudobný klient YouTube
Comment[sl]=Glasbeni odjemalec Youtube
Comment[sv]=YouTube-musikprogram
Comment[uk]=Музичний клієнт YouTube
Comment[x-test]=xxYouTube Music clientxx
Version=1.0
Exec=audiotube
Icon=org.kde.audiotube
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-3
View File
@@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2021 Mathis Brüchert <[email protected]>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
+1 -6
View File
@@ -1,7 +1,2 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
# SPDX-FileCopyrightText: 2021 Kuba Prussak <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
ytmusicapi==0.17.3
ytmusicapi==0.16.0
youtube_dl
-7
View File
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
add_library(ytm STATIC
ytmusic.cpp
)
@@ -23,7 +19,6 @@ add_executable(audiotube
playlistmodel.cpp
playlistutils.cpp
errorhandler.cpp
playerutils.cpp
multiiterableview.h
resources.qrc
)
@@ -36,8 +31,6 @@ target_link_libraries(audiotube
Qt5::QuickControls2
Qt5::Svg
KF5::I18n
KF5::CoreAddons
KF5::Crash
ytm
)
target_compile_definitions(audiotube PRIVATE -DQT_NO_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING)
-4
View File
@@ -1,4 +0,0 @@
#! /usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Tobias Fella <[email protected]>
# SPDX-License-Identifier: CC0-1.0
$XGETTEXT `find -name \*.cpp -o -name \*.qml -o -name \*.js` -o $podir/audiotube.pot
+4 -10
View File
@@ -24,16 +24,10 @@ ArtistModel::ArtistModel(QObject *parent)
beginResetModel();
m_artist = artist;
std::sort(m_artist.thumbnails.begin(), m_artist.thumbnails.end());
auto albums = m_artist.albums ? m_artist.albums->results : std::vector<artist::Artist::Album>();
auto singles = m_artist.singles ? m_artist.singles->results : std::vector<artist::Artist::Single>();
auto songs = m_artist.songs ? m_artist.songs->results : std::vector<artist::Artist::Song>();
auto videos = m_artist.videos ? m_artist.videos->results : std::vector<artist::Artist::Video>();
m_view = std::optional(MultiIterableView(std::move(albums),
std::move(singles),
std::move(songs),
std::move(videos)));
m_view = std::optional(MultiIterableView(m_artist.albums->results,
m_artist.singles->results,
m_artist.songs->results,
m_artist.videos->results));
endResetModel();
+2 -2
View File
@@ -107,14 +107,14 @@ private:
Q_SIGNAL void startFetchWatchPlaylist(const std::optional<QString> &videoId, const std::optional<QString> &playlistId);
Q_SLOT void internalFetchWatchPlaylist(const std::optional<QString> &videoId, const std::optional<QString> &playlistId);
// Python interpreter will be initialized from the thread calling the methods
// Python interpreter will be ininitalized from the thread calling the methods
Lazy<YTMusic> m_ytm;
};
class YTMusicThread : private QThread {
public:
static YTMusicThread &instance();
~YTMusicThread() override;
~YTMusicThread();
AsyncYTMusic *operator->();
AsyncYTMusic &get();
+3 -5
View File
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick 2.15
import QtQuick 2.1
import org.kde.kirigami 2.14 as Kirigami
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.3
@@ -29,8 +29,6 @@ Kirigami.ScrollablePage {
title: albumModel.title
}
reuseItems: true
model: AlbumModel {
id: albumModel
}
@@ -58,12 +56,12 @@ Kirigami.ScrollablePage {
actions: [
Kirigami.Action {
icon.name: "go-next"
text: i18n("Play Next")
text: i18n("Play next")
onTriggered: UserPlaylistModel.playNext(delegateItem.videoId, delegateItem.title, delegateItem.artists)
},
Kirigami.Action {
icon.name: "media-playlist-append"
text: i18n("Add to Playlist")
text: i18n("Add to playlist")
onTriggered: UserPlaylistModel.append(delegateItem.videoId, delegateItem.title, delegateItem.artists)
}
]
+3 -6
View File
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick 2.15
import QtQuick 2.1
import org.kde.kirigami 2.14 as Kirigami
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.3
@@ -19,9 +19,6 @@ Kirigami.ScrollablePage {
backgroundImage.source: artistModel.thumbnailUrl
title: artistModel.title
}
reuseItems: true
model: ArtistModel {
id: artistModel
@@ -90,13 +87,13 @@ Kirigami.ScrollablePage {
actions: [
Kirigami.Action {
icon.name: "go-next"
text: i18n("Play Next")
text: i18n("Play next")
visible: type === ArtistModel.Song
onTriggered: UserPlaylistModel.playNext(delegateItem.videoId, delegateItem.title, delegateItem.artists)
},
Kirigami.Action {
icon.name: "media-playlist-append"
text: i18n("Add to Playlist")
text: i18n("Add to playlist")
visible: type === ArtistModel.Song
onTriggered: UserPlaylistModel.append(delegateItem.videoId, delegateItem.title, delegateItem.artists)
}
+14 -32
View File
@@ -29,8 +29,8 @@ ColumnLayout {
visible: footerLayout.maximized
Item {
Layout.fillWidth: info.thumbnail
Layout.fillHeight: info.thumbnail
Layout.fillWidth: true
Layout.fillHeight: true
Image {
anchors.fill: parent
@@ -93,7 +93,7 @@ ColumnLayout {
actions: [
Kirigami.Action {
text: i18n("Remove Track")
text: i18n("Remove track")
icon.name: "list-remove"
onTriggered: UserPlaylistModel.remove(delegateItem.videoId)
}
@@ -110,12 +110,10 @@ ColumnLayout {
}
Controls.ToolButton {
text: i18n("Clear")
icon.name: "edit-clear-all"
onClicked: UserPlaylistModel.clear()
}
Controls.ToolButton {
text: i18n("Shuffle")
icon.name: "media-playlist-shuffle"
onClicked: UserPlaylistModel.shufflePlaylist()
}
@@ -193,41 +191,25 @@ ColumnLayout {
text: info.title ? info.title : i18n("No media playing")
}
RowLayout{
Controls.Label{
visible: audio.duration > 0
text: PlayerUtils.formatTimestamp(audio.position)
Controls.Slider {
Layout.fillWidth: true
from: 0
to: audio.duration
value: audio.position
enabled: audio.seekable
onMoved: {
console.log("Value:", value);
audio.seek(Math.floor(value));
}
Controls.Slider {
Layout.fillWidth: true
from: 0
to: audio.duration
value: audio.position
enabled: audio.seekable
onMoved: {
console.log("Value:", value);
audio.seek(Math.floor(value));
Behavior on value {
NumberAnimation {
}
Behavior on value {
NumberAnimation {
}
}
}
Controls.Label{
visible: audio.duration > 0
text: PlayerUtils.formatTimestamp(audio.duration)
}
}
}
Controls.ToolButton {
+4 -9
View File
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick 2.15
import QtQuick 2.0
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12 as Controls
import org.kde.kirigami 2.12 as Kirigami
@@ -38,14 +38,11 @@ Kirigami.ScrollablePage {
model: PlaylistModel {
id: playlistModel
}
reuseItems: true
delegate: Kirigami.SwipeListItem {
id: delegateItem
required property string title
required property string videoId
required property var artists
required property string artists
RowLayout {
Layout.fillHeight: true
@@ -64,17 +61,15 @@ Kirigami.ScrollablePage {
actions: [
Kirigami.Action {
icon.name: "go-next"
text: i18n("Play Next")
text: i18n("Play next")
onTriggered: UserPlaylistModel.playNext(delegateItem.videoId, delegateItem.title, delegateItem.artists)
},
Kirigami.Action {
icon.name: "media-playlist-append"
text: i18n("Add to Playlist")
text: i18n("Add to playlist")
onTriggered: UserPlaylistModel.append(delegateItem.videoId, delegateItem.title, delegateItem.artists)
}
]
onClicked: play(videoId)
}
Controls.BusyIndicator {
+2 -4
View File
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick 2.15
import QtQuick 2.0
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.14 as Controls
import org.kde.kirigami 2.14 as Kirigami
@@ -24,8 +24,6 @@ Kirigami.ScrollablePage {
}
ListView {
reuseItems: true
model: SearchModel {
id: searchModel
@@ -99,7 +97,7 @@ Kirigami.ScrollablePage {
},
Kirigami.Action {
icon.name: "media-playlist-append"
text: i18n("Add to Playlist")
text: i18n("Add to playlist")
visible: delegateItem.type === SearchModel.Song
onTriggered: UserPlaylistModel.append(delegateItem.videoId, delegateItem.title, delegateItem.artists)
}
+1 -1
View File
@@ -36,7 +36,7 @@ Kirigami.ApplicationWindow {
function askPlayVideoAudio(videoId) {
showPassiveNotification(i18n("Video playback is not supported yet."),
"long",
i18n("Play only Audio"),
i18n("Play only audio"),
function() {
play(videoId)
})
-4
View File
@@ -1,6 +1,2 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
add_executable(ytm_example main.cpp)
target_link_libraries(ytm_example PRIVATE ytm)
+2 -2
View File
@@ -8,7 +8,7 @@
int main() {
const auto ytm = YTMusic();
const auto results = ytm.search("Thomas Bangalter");
const auto results = ytm.search("arte concert");
std::cout << "Found " << results.size() << " results." << std::endl;
@@ -42,7 +42,7 @@ int main() {
} else if constexpr (std::is_same_v<T, search::Video>) {
std::cout << arg.title << std::endl;
} else {
std::cout << "non exaustive visitor";
std::cout << "non excaustive visitor";
}
}, result);
}
-12
View File
@@ -7,9 +7,6 @@
#include <QtQml>
#include <QUrl>
#include <KLocalizedContext>
#include <KLocalizedString>
#include <KCrash>
#include <KAboutData>
#include "searchmodel.h"
#include "albummodel.h"
@@ -18,7 +15,6 @@
#include "userplaylistmodel.h"
#include "errorhandler.h"
#include "playlistmodel.h"
#include "playerutils.h"
constexpr auto URI = "org.kde.ytmusic";
@@ -30,11 +26,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setApplicationName(QStringLiteral("audiotube"));
KLocalizedString::setApplicationDomain("audiotube");
KAboutData::setApplicationData(KAboutData(QStringLiteral("audiotube"), QStringLiteral("AudioTube")));
KCrash::initialize();
QQmlApplicationEngine engine;
qmlRegisterType<SearchModel>(URI, 1, 0, "SearchModel");
@@ -48,9 +39,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
qmlRegisterSingletonType<ErrorHandler>(URI, 1, 0, "ErrorHandler", [](QQmlEngine *, QJSEngine *) {
return new ErrorHandler();
});
qmlRegisterSingletonType<PlayerUtils>(URI, 1, 0, "PlayerUtils", [](QQmlEngine *, QJSEngine *) {
return new PlayerUtils();
});
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
+71
View File
@@ -0,0 +1,71 @@
/***************************************************************************
SPDX-FileCopyrightText: 2014 (c) Sujith Haridasan <[email protected]>
SPDX-FileCopyrightText: 2014 (c) Ashish Madeti <[email protected]>
SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <[email protected]>
SPDX-License-Identifier: GPL-3.0-or-later
***************************************************************************/
#include "mediaplayer2.h"
#include <QCoreApplication>
#include <KCoreAddons/KAboutData>
MediaPlayer2::MediaPlayer2(QObject* parent)
: QDBusAbstractAdaptor(parent)
{
}
MediaPlayer2::~MediaPlayer2()
= default;
bool MediaPlayer2::CanQuit() const
{
return true;
}
bool MediaPlayer2::CanRaise() const
{
return true;
}
bool MediaPlayer2::HasTrackList() const
{
return false;
}
void MediaPlayer2::Quit()
{
QCoreApplication::quit();
}
void MediaPlayer2::Raise()
{
emit raisePlayer();
}
QString MediaPlayer2::Identity() const
{
return KAboutData::applicationData().displayName();
}
QString MediaPlayer2::DesktopEntry() const
{
return KAboutData::applicationData().desktopFileName();
}
QStringList MediaPlayer2::SupportedUriSchemes() const
{
return QStringList() << QStringLiteral("file");
}
QStringList MediaPlayer2::SupportedMimeTypes() const
{
// KService::Ptr app = KService::serviceByDesktopName(KCmdLineArgs::aboutData()->appName());
// if (app) {
// return app->mimeTypes();
// }
return QStringList();
}
+53
View File
@@ -0,0 +1,53 @@
/***************************************************************************
SPDX-FileCopyrightText: 2014 (c) Sujith Haridasan <[email protected]>
SPDX-FileCopyrightText: 2014 (c) Ashish Madeti <[email protected]>
SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <[email protected]>
SPDX-License-Identifier: GPL-3.0-or-later
***************************************************************************/
//#pragma once
#include "elisaLib_export.h"
#include <QDBusAbstractAdaptor>
#include <QStringList>
class MediaPlayer2 : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2") // Docs: https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html
Q_PROPERTY(bool CanQuit READ CanQuit CONSTANT)
Q_PROPERTY(bool CanRaise READ CanRaise CONSTANT)
Q_PROPERTY(bool HasTrackList READ HasTrackList CONSTANT)
Q_PROPERTY(QString Identity READ Identity CONSTANT)
Q_PROPERTY(QString DesktopEntry READ DesktopEntry CONSTANT)
Q_PROPERTY(QStringList SupportedUriSchemes READ SupportedUriSchemes CONSTANT)
Q_PROPERTY(QStringList SupportedMimeTypes READ SupportedMimeTypes CONSTANT)
public:
explicit MediaPlayer2(QObject* parent = nullptr);
~MediaPlayer2() override;
[[nodiscard]] bool CanQuit() const;
[[nodiscard]] bool CanRaise() const;
[[nodiscard]] bool HasTrackList() const;
[[nodiscard]] QString Identity() const;
[[nodiscard]] QString DesktopEntry() const;
[[nodiscard]] QStringList SupportedUriSchemes() const;
[[nodiscard]] QStringList SupportedMimeTypes() const;
public Q_SLOTS:
void Quit();
void Raise();
Q_SIGNALS:
void raisePlayer();
};
+493
View File
@@ -0,0 +1,493 @@
/***************************************************************************
SPDX-FileCopyrightText: 2014 (c) Sujith Haridasan <[email protected]>
SPDX-FileCopyrightText: 2014 (c) Ashish Madeti <[email protected]>
SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <[email protected]>
SPDX-License-Identifier: GPL-3.0-or-later
***************************************************************************/
#include "mediaplayer2player.h"
#include "mpris2.h"
#include "asyncytmusic.h"
#include "ytmusic.h"
#include "playlistmodel.h"
#if defined KF5FileMetaData_FOUND && KF5FileMetaData_FOUND
#include <KFileMetaData/EmbeddedImageData>
#endif
#include <QCryptographicHash>
#include <QStringList>
#include <QDBusMessage>
#include <QDBusConnection>
static const double MAX_RATE = 1.0;
static const double MIN_RATE = 1.0;
MediaPlayer2Player::MediaPlayer2Player(MediaPlayListProxyModel *playListControler, ManageAudioPlayer *manageAudioPlayer,
ManageMediaPlayerControl *manageMediaPlayerControl, ManageHeaderBar *manageHeaderBar,
AudioWrapper *audioPlayer, bool showProgressOnTaskBar, QObject* parent)
: QDBusAbstractAdaptor(parent), m_playListControler(playListControler), m_manageAudioPlayer(manageAudioPlayer),
m_manageMediaPlayerControl(manageMediaPlayerControl), m_manageHeaderBar(manageHeaderBar), m_audioPlayer(audioPlayer),
mProgressIndicatorSignal(QDBusMessage::createSignal(QStringLiteral("/org/kde/elisa"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"))),
mShowProgressOnTaskBar(showProgressOnTaskBar)
{
if (!m_playListControler) {
return;
}
connect(m_manageAudioPlayer, &ManageAudioPlayer::playerSourceChanged,
this, &MediaPlayer2Player::playerSourceChanged, Qt::QueuedConnection);
connect(m_manageMediaPlayerControl, &ManageMediaPlayerControl::playControlEnabledChanged,
this, &MediaPlayer2Player::playControlEnabledChanged);
connect(m_manageMediaPlayerControl, &ManageMediaPlayerControl::skipBackwardControlEnabledChanged,
this, &MediaPlayer2Player::skipBackwardControlEnabledChanged);
connect(m_manageMediaPlayerControl, &ManageMediaPlayerControl::skipForwardControlEnabledChanged,
this, &MediaPlayer2Player::skipForwardControlEnabledChanged);
connect(m_manageAudioPlayer, &ManageAudioPlayer::playerPlaybackStateChanged,
this, &MediaPlayer2Player::playerPlaybackStateChanged);
connect(m_manageAudioPlayer, &ManageAudioPlayer::playerIsSeekableChanged,
this, &MediaPlayer2Player::playerIsSeekableChanged);
connect(m_manageAudioPlayer, &ManageAudioPlayer::playerPositionChanged,
this, &MediaPlayer2Player::audioPositionChanged);
connect(m_manageAudioPlayer, &ManageAudioPlayer::seek,
this, &MediaPlayer2Player::playerSeeked);
connect(m_manageAudioPlayer, &ManageAudioPlayer::audioDurationChanged,
this, &MediaPlayer2Player::audioDurationChanged);
connect(m_audioPlayer, &AudioWrapper::volumeChanged,
this, &MediaPlayer2Player::playerVolumeChanged);
m_volume = m_audioPlayer->volume() / 100;
m_canPlay = m_manageMediaPlayerControl->playControlEnabled();
signalPropertiesChange(QStringLiteral("Volume"), Volume());
m_mediaPlayerPresent = 1;
}
MediaPlayer2Player::~MediaPlayer2Player()
= default;
QString MediaPlayer2Player::PlaybackStatus() const
{
QString result;
if (!m_playListControler) {
result = QStringLiteral("Stopped");
return result;
}
if (m_manageAudioPlayer->playerPlaybackState() == QMediaPlayer::StoppedState) {
result = QStringLiteral("Stopped");
} else if (m_manageAudioPlayer->playerPlaybackState() == QMediaPlayer::PlayingState) {
result = QStringLiteral("Playing");
} else {
result = QStringLiteral("Paused");
}
if (mShowProgressOnTaskBar) {
QVariantMap parameters;
if (m_manageAudioPlayer->playerPlaybackState() == QMediaPlayer::StoppedState || m_audioPlayer->duration() == 0) {
parameters.insert(QStringLiteral("progress-visible"), false);
parameters.insert(QStringLiteral("progress"), 0);
} else {
parameters.insert(QStringLiteral("progress-visible"), true);
parameters.insert(QStringLiteral("progress"), qRound(static_cast<double>(m_position / m_audioPlayer->duration())) / 1000.0);
}
mProgressIndicatorSignal.setArguments({QStringLiteral("application://org.kde.elisa.desktop"), parameters});
QDBusConnection::sessionBus().send(mProgressIndicatorSignal);
}
return result;
}
bool MediaPlayer2Player::CanGoNext() const
{
return m_canGoNext;
}
void MediaPlayer2Player::Next()
{
emit next();
if (m_playListControler) {
m_playListControler->skipNextTrack();
}
}
bool MediaPlayer2Player::CanGoPrevious() const
{
return m_canGoPrevious;
}
void MediaPlayer2Player::Previous()
{
emit previous();
if (m_playListControler) {
m_playListControler->skipPreviousTrack(m_audioPlayer->position());
}
}
bool MediaPlayer2Player::CanPause() const
{
return m_canPlay;
}
void MediaPlayer2Player::Pause()
{
if (m_playListControler) {
m_manageAudioPlayer->ensurePause();
}
}
void MediaPlayer2Player::PlayPause()
{
emit playPause();
if (m_playListControler) {
m_manageAudioPlayer->playPause();
}
}
void MediaPlayer2Player::Stop()
{
emit stop();
if (m_playListControler) {
m_manageAudioPlayer->stop();
}
}
bool MediaPlayer2Player::CanPlay() const
{
return m_canPlay;
}
void MediaPlayer2Player::Play()
{
if (m_playListControler) {
m_manageAudioPlayer->ensurePlay();
}
}
double MediaPlayer2Player::Volume() const
{
return m_volume;
}
void MediaPlayer2Player::setVolume(double volume)
{
m_volume= qBound(0.0, volume, 1.0);
emit volumeChanged(m_volume);
m_audioPlayer->setVolume(100 * m_volume);
signalPropertiesChange(QStringLiteral("Volume"), Volume());
}
QVariantMap MediaPlayer2Player::Metadata() const
{
return m_metadata;
}
qlonglong MediaPlayer2Player::Position() const
{
return m_position;
}
void MediaPlayer2Player::setPropertyPosition(int newPositionInMs)
{
m_position = qlonglong(newPositionInMs) * 1000;
/* only sent new progress when it has advanced more than 1 %
* to limit DBus traffic
*/
const auto incrementalProgress = static_cast<double>(newPositionInMs - mPreviousProgressPosition) / m_audioPlayer->duration();
if (mShowProgressOnTaskBar && (incrementalProgress > 0.01 || incrementalProgress < 0))
{
mPreviousProgressPosition = newPositionInMs;
QVariantMap parameters;
parameters.insert(QStringLiteral("progress-visible"), true);
parameters.insert(QStringLiteral("progress"), static_cast<double>(newPositionInMs) / m_audioPlayer->duration());
mProgressIndicatorSignal.setArguments({QStringLiteral("application://org.kde.elisa.desktop"), parameters});
QDBusConnection::sessionBus().send(mProgressIndicatorSignal);
}
}
double MediaPlayer2Player::Rate() const
{
return m_rate;
}
void MediaPlayer2Player::setRate(double newRate)
{
if (newRate <= 0.0001 && newRate >= -0.0001) {
Pause();
} else {
m_rate = qBound(MinimumRate(), newRate, MaximumRate());
emit rateChanged(m_rate);
signalPropertiesChange(QStringLiteral("Rate"), Rate());
}
}
double MediaPlayer2Player::MinimumRate() const
{
return MIN_RATE;
}
double MediaPlayer2Player::MaximumRate() const
{
return MAX_RATE;
}
bool MediaPlayer2Player::CanSeek() const
{
return m_playerIsSeekableChanged;
}
bool MediaPlayer2Player::CanControl() const
{
return true;
}
void MediaPlayer2Player::Seek(qlonglong Offset)
{
if (mediaPlayerPresent()) {
auto offset = (m_position + Offset) / 1000;
m_manageAudioPlayer->playerSeek(int(offset));
}
}
void MediaPlayer2Player::SetPosition(const QDBusObjectPath &trackId, qlonglong pos)
{
if (trackId.path() == m_currentTrackId) {
m_manageAudioPlayer->playerSeek(int(pos / 1000));
}
}
void MediaPlayer2Player::OpenUri(const QString &uri)
{
Q_UNUSED(uri);
}
void MediaPlayer2Player::playerSourceChanged()
{
if (!m_playListControler) {
return;
}
setCurrentTrack(m_manageAudioPlayer->playListPosition());
}
void MediaPlayer2Player::playControlEnabledChanged()
{
if (!m_playListControler) {
return;
}
m_canPlay = m_manageMediaPlayerControl->playControlEnabled();
signalPropertiesChange(QStringLiteral("CanPause"), CanPause());
signalPropertiesChange(QStringLiteral("CanPlay"), CanPlay());
emit canPauseChanged();
emit canPlayChanged();
}
void MediaPlayer2Player::skipBackwardControlEnabledChanged()
{
if (!m_playListControler) {
return;
}
m_canGoPrevious = m_manageMediaPlayerControl->skipBackwardControlEnabled();
signalPropertiesChange(QStringLiteral("CanGoPrevious"), CanGoPrevious());
emit canGoPreviousChanged();
}
void MediaPlayer2Player::skipForwardControlEnabledChanged()
{
if (!m_playListControler) {
return;
}
m_canGoNext = m_manageMediaPlayerControl->skipForwardControlEnabled();
signalPropertiesChange(QStringLiteral("CanGoNext"), CanGoNext());
emit canGoNextChanged();
}
void MediaPlayer2Player::playerPlaybackStateChanged()
{
signalPropertiesChange(QStringLiteral("PlaybackStatus"), PlaybackStatus());
emit playbackStatusChanged();
playerIsSeekableChanged();
}
void MediaPlayer2Player::playerIsSeekableChanged()
{
m_playerIsSeekableChanged = m_manageAudioPlayer->playerIsSeekable();
signalPropertiesChange(QStringLiteral("CanSeek"), CanSeek());
emit canSeekChanged();
}
void MediaPlayer2Player::audioPositionChanged()
{
setPropertyPosition(static_cast<int>(m_manageAudioPlayer->playerPosition()));
}
void MediaPlayer2Player::playerSeeked(qint64 position)
{
Q_EMIT Seeked(position * 1000);
}
void MediaPlayer2Player::audioDurationChanged()
{
m_metadata = getMetadataOfCurrentTrack();
signalPropertiesChange(QStringLiteral("Metadata"), Metadata());
skipBackwardControlEnabledChanged();
skipForwardControlEnabledChanged();
playerPlaybackStateChanged();
playerIsSeekableChanged();
setPropertyPosition(static_cast<int>(m_manageAudioPlayer->playerPosition()));
}
void MediaPlayer2Player::playerVolumeChanged()
{
setVolume(m_audioPlayer->volume() / 100.0);
}
int MediaPlayer2Player::currentTrack() const
{
return m_manageAudioPlayer->playListPosition();
}
void MediaPlayer2Player::setCurrentTrack(int newTrackPosition)
{
m_currentTrack = m_manageAudioPlayer->playerSource().toString();
m_currentTrackId = QDBusObjectPath(QLatin1String("/org/kde/elisa/playlist/") + QString::number(newTrackPosition)).path();
emit currentTrackChanged();
m_metadata = getMetadataOfCurrentTrack();
signalPropertiesChange(QStringLiteral("Metadata"), Metadata());
}
QVariantMap MediaPlayer2Player::getMetadataOfCurrentTrack()
{
auto result = QVariantMap();
if (m_currentTrackId.isEmpty()) {
return {};
}
result[QStringLiteral("mpris:trackid")] = QVariant::fromValue<QDBusObjectPath>(QDBusObjectPath(m_currentTrackId));
result[QStringLiteral("mpris:length")] = qlonglong(m_manageAudioPlayer->audioDuration()) * 1000;
//convert milli-seconds into micro-seconds
if (!m_manageHeaderBar->title().isNull() && !m_manageHeaderBar->title().toString().isEmpty()) {
result[QStringLiteral("xesam:title")] = m_manageHeaderBar->title();
}
result[QStringLiteral("xesam:url")] = m_manageAudioPlayer->playerSource().toString();
if (!m_manageHeaderBar->album().isNull() && !m_manageHeaderBar->album().toString().isEmpty()) {
result[QStringLiteral("xesam:album")] = m_manageHeaderBar->album();
}
if (!m_manageHeaderBar->artist().isNull() && !m_manageHeaderBar->artist().toString().isEmpty()) {
result[QStringLiteral("xesam:artist")] = QStringList{m_manageHeaderBar->artist().toString()};
}
if (!m_manageHeaderBar->image().isEmpty() && !m_manageHeaderBar->image().toString().isEmpty()) {
if (m_manageHeaderBar->image().scheme() == QStringLiteral("image")) {
// adding a special case for image:// URLs that are only valid because Elisa installs a special handler for them
// converting those URL to data URLs with embedded image data
#if defined KF5FileMetaData_FOUND && KF5FileMetaData_FOUND
KFileMetaData::EmbeddedImageData embeddedImage;
auto imageData = embeddedImage.imageData(m_manageHeaderBar->image().toString().mid(14));
if (imageData.contains(KFileMetaData::EmbeddedImageData::FrontCover)) {
result[QStringLiteral("mpris:artUrl")] = QString{QStringLiteral("data:image/png;base64,") + QLatin1String{imageData[KFileMetaData::EmbeddedImageData::FrontCover].toBase64()}};
}
#endif
} else {
result[QStringLiteral("mpris:artUrl")] = m_manageHeaderBar->image().toString();
}
}
return result;
}
int MediaPlayer2Player::mediaPlayerPresent() const
{
return m_mediaPlayerPresent;
}
bool MediaPlayer2Player::showProgressOnTaskBar() const
{
return mShowProgressOnTaskBar;
}
void MediaPlayer2Player::setShowProgressOnTaskBar(bool value)
{
mShowProgressOnTaskBar = value;
QVariantMap parameters;
if (!mShowProgressOnTaskBar || m_manageAudioPlayer->playerPlaybackState() == QMediaPlayer::StoppedState || m_audioPlayer->duration() == 0) {
parameters.insert(QStringLiteral("progress-visible"), false);
parameters.insert(QStringLiteral("progress"), 0);
} else {
parameters.insert(QStringLiteral("progress-visible"), true);
parameters.insert(QStringLiteral("progress"), qRound(static_cast<double>(m_position / m_audioPlayer->duration())) / 1000.0);
}
mProgressIndicatorSignal.setArguments({QStringLiteral("application://org.kde.elisa.desktop"), parameters});
QDBusConnection::sessionBus().send(mProgressIndicatorSignal);
}
void MediaPlayer2Player::setMediaPlayerPresent(int status)
{
if (m_mediaPlayerPresent != status) {
m_mediaPlayerPresent = status;
emit mediaPlayerPresentChanged();
signalPropertiesChange(QStringLiteral("CanGoNext"), CanGoNext());
signalPropertiesChange(QStringLiteral("CanGoPrevious"), CanGoPrevious());
signalPropertiesChange(QStringLiteral("CanPause"), CanPause());
signalPropertiesChange(QStringLiteral("CanPlay"), CanPlay());
emit canGoNextChanged();
emit canGoPreviousChanged();
emit canPauseChanged();
emit canPlayChanged();
}
}
void MediaPlayer2Player::signalPropertiesChange(const QString &property, const QVariant &value)
{
QVariantMap properties;
properties[property] = value;
const int ifaceIndex = metaObject()->indexOfClassInfo("D-Bus Interface");
QDBusMessage msg = QDBusMessage::createSignal(QStringLiteral("/org/mpris/MediaPlayer2"),
QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"));
msg << QLatin1String(metaObject()->classInfo(ifaceIndex).value());
msg << properties;
msg << QStringList();
QDBusConnection::sessionBus().send(msg);
}
#include "moc_mediaplayer2player.cpp"
+159
View File
@@ -0,0 +1,159 @@
/***************************************************************************
SPDX-FileCopyrightText: 2014 (c) Sujith Haridasan <[email protected]>
SPDX-FileCopyrightText: 2014 (c) Ashish Madeti <[email protected]>
SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <[email protected]>
SPDX-License-Identifier: GPL-3.0-or-later
***************************************************************************/
#ifndef MEDIAPLAYER2PLAYER_H
#define MEDIAPLAYER2PLAYER_H
#include "elisaLib_export.h"
#include <QDBusAbstractAdaptor>
#include <QDBusObjectPath>
#include <QDBusMessage>
class MediaPlayListProxyModel;
class ManageAudioPlayer;
class ManageMediaPlayerControl;
class ManageHeaderBar;
class AudioWrapper;
class ELISALIB_EXPORT MediaPlayer2Player : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2.Player") // Docs: https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html
Q_PROPERTY(QString PlaybackStatus READ PlaybackStatus NOTIFY playbackStatusChanged)
Q_PROPERTY(double Rate READ Rate WRITE setRate NOTIFY rateChanged)
Q_PROPERTY(QVariantMap Metadata READ Metadata NOTIFY playbackStatusChanged)
Q_PROPERTY(double Volume READ Volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(qlonglong Position READ Position WRITE setPropertyPosition NOTIFY playbackStatusChanged)
Q_PROPERTY(double MinimumRate READ MinimumRate CONSTANT)
Q_PROPERTY(double MaximumRate READ MaximumRate CONSTANT)
Q_PROPERTY(bool CanGoNext READ CanGoNext NOTIFY canGoNextChanged)
Q_PROPERTY(bool CanGoPrevious READ CanGoPrevious NOTIFY canGoPreviousChanged)
Q_PROPERTY(bool CanPlay READ CanPlay NOTIFY canPlayChanged)
Q_PROPERTY(bool CanPause READ CanPause NOTIFY canPauseChanged)
Q_PROPERTY(bool CanControl READ CanControl NOTIFY canControlChanged)
Q_PROPERTY(bool CanSeek READ CanSeek NOTIFY canSeekChanged)
Q_PROPERTY(int currentTrack READ currentTrack WRITE setCurrentTrack NOTIFY currentTrackChanged)
Q_PROPERTY(int mediaPlayerPresent READ mediaPlayerPresent WRITE setMediaPlayerPresent NOTIFY mediaPlayerPresentChanged)
public:
explicit MediaPlayer2Player(MediaPlayListProxyModel *playListControler,
ManageAudioPlayer *manageAudioPlayer,
ManageMediaPlayerControl* manageMediaPlayerControl,
ManageHeaderBar * manageHeaderBar,
AudioWrapper *audioPlayer,
bool showProgressOnTaskBar,
QObject* parent = nullptr);
~MediaPlayer2Player() override;
QString PlaybackStatus() const;
double Rate() const;
QVariantMap Metadata() const;
double Volume() const;
qlonglong Position() const;
double MinimumRate() const;
double MaximumRate() const;
bool CanGoNext() const;
bool CanGoPrevious() const;
bool CanPlay() const;
bool CanPause() const;
bool CanSeek() const;
bool CanControl() const;
int currentTrack() const;
int mediaPlayerPresent() const;
bool showProgressOnTaskBar() const;
void setShowProgressOnTaskBar(bool value);
Q_SIGNALS:
void Seeked(qlonglong Position);
void rateChanged(double newRate);
void volumeChanged(double newVol);
void playbackStatusChanged();
void canGoNextChanged();
void canGoPreviousChanged();
void canPlayChanged();
void canPauseChanged();
void canControlChanged();
void canSeekChanged();
void currentTrackChanged();
void mediaPlayerPresentChanged();
void next();
void previous();
void playPause();
void stop();
public Q_SLOTS:
void Next();
void Previous();
void Pause();
void PlayPause();
void Stop();
void Play();
void Seek(qlonglong Offset);
void SetPosition(const QDBusObjectPath &trackId, qlonglong pos);
void OpenUri(const QString &uri);
private Q_SLOTS:
void playerSourceChanged();
void playControlEnabledChanged();
void skipBackwardControlEnabledChanged();
void skipForwardControlEnabledChanged();
void playerPlaybackStateChanged();
void playerIsSeekableChanged();
void audioPositionChanged();
void playerSeeked(qint64 position);
void audioDurationChanged();
void playerVolumeChanged();
private:
void signalPropertiesChange(const QString &property, const QVariant &value);
void setMediaPlayerPresent(int status);
void setRate(double newRate);
void setVolume(double volume);
void setPropertyPosition(int newPositionInMs);
void setCurrentTrack(int newTrackPosition);
QVariantMap getMetadataOfCurrentTrack();
QVariantMap m_metadata;
QString m_currentTrack;
QString m_currentTrackId;
double m_rate = 1.0;
double m_volume = 0.0;
int m_mediaPlayerPresent = 0;
bool m_canPlay = false;
bool m_canGoNext = false;
bool m_canGoPrevious = false;
qlonglong m_position = 0;
MediaPlayListProxyModel *m_playListControler = nullptr;
bool m_playerIsSeekableChanged = false;
ManageAudioPlayer* m_manageAudioPlayer = nullptr;
ManageMediaPlayerControl* m_manageMediaPlayerControl = nullptr;
ManageHeaderBar * m_manageHeaderBar = nullptr;
AudioWrapper *m_audioPlayer = nullptr;
mutable QDBusMessage mProgressIndicatorSignal;
int mPreviousProgressPosition = 0;
bool mShowProgressOnTaskBar = true;
};
#endif // MEDIAPLAYER2PLAYER_H
+200
View File
@@ -0,0 +1,200 @@
/***************************************************************************
SPDX-FileCopyrightText: 2014 (c) Sujith Haridasan <[email protected]>
SPDX-FileCopyrightText: 2014 (c) Ashish Madeti <[email protected]>
SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <[email protected]>
SPDX-License-Identifier: GPL-3.0-or-later
***************************************************************************/
#include "mpris2.h"
#include "mediaplayer2.h"
#include "mediaplayer2player.h"
#include "mediaplaylistproxymodel.h"
#include <QDBusConnection>
#if defined Q_OS_WIN
#include <Windows.h>
#else
#include <unistd.h>
#endif
Mpris2::Mpris2(QObject* parent)
: QObject(parent)
{
}
void Mpris2::initDBusService()
{
QString mspris2Name(QStringLiteral("org.mpris.MediaPlayer2.") + m_playerName);
bool success = QDBusConnection::sessionBus().registerService(mspris2Name);
// If the above failed, it's likely because we're not the first instance
// or the name is already taken. In that event the MPRIS2 spec wants the
// following:
if (!success) {
#if defined Q_OS_WIN
success = QDBusConnection::sessionBus().registerService(mspris2Name + QLatin1String(".instance") + QString::number(GetCurrentProcessId()));
#else
success = QDBusConnection::sessionBus().registerService(mspris2Name + QLatin1String(".instance") + QString::number(getpid()));
#endif
}
if (success) {
m_mp2 = std::make_unique<MediaPlayer2>(this);
m_mp2p = std::make_unique<MediaPlayer2Player>(m_playListModel, m_manageAudioPlayer, m_manageMediaPlayerControl, m_manageHeaderBar, m_audioPlayer, mShowProgressOnTaskBar, this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/mpris/MediaPlayer2"), this, QDBusConnection::ExportAdaptors);
connect(m_mp2.get(), &MediaPlayer2::raisePlayer, this, &Mpris2::raisePlayer);
}
}
Mpris2::~Mpris2()
= default;
QString Mpris2::playerName() const
{
return m_playerName;
}
MediaPlayListProxyModel *Mpris2::playListModel() const
{
return m_playListModel;
}
ManageAudioPlayer *Mpris2::audioPlayerManager() const
{
return m_manageAudioPlayer;
}
ManageMediaPlayerControl *Mpris2::manageMediaPlayerControl() const
{
return m_manageMediaPlayerControl;
}
ManageHeaderBar *Mpris2::headerBarManager() const
{
return m_manageHeaderBar;
}
AudioWrapper *Mpris2::audioPlayer() const
{
return m_audioPlayer;
}
bool Mpris2::showProgressOnTaskBar() const
{
return mShowProgressOnTaskBar;
}
void Mpris2::setPlayerName(const QString &playerName)
{
if (m_playerName == playerName) {
return;
}
m_playerName = playerName;
if (m_playListModel && m_manageAudioPlayer && m_manageMediaPlayerControl && m_manageHeaderBar && m_audioPlayer && !m_playerName.isEmpty()) {
if (!m_mp2) {
initDBusService();
}
}
emit playerNameChanged();
}
void Mpris2::setPlayListModel(MediaPlayListProxyModel *playListModel)
{
if (m_playListModel == playListModel) {
return;
}
m_playListModel = playListModel;
if (m_playListModel && m_manageAudioPlayer && m_manageMediaPlayerControl && m_manageHeaderBar && m_audioPlayer && !m_playerName.isEmpty()) {
if (!m_mp2) {
initDBusService();
}
}
emit playListModelChanged();
}
void Mpris2::setAudioPlayerManager(ManageAudioPlayer *manageAudioPlayer)
{
if (m_manageAudioPlayer == manageAudioPlayer) {
return;
}
m_manageAudioPlayer = manageAudioPlayer;
if (m_playListModel && m_manageAudioPlayer && m_manageMediaPlayerControl && m_manageHeaderBar && m_audioPlayer && !m_playerName.isEmpty()) {
if (!m_mp2) {
initDBusService();
}
}
emit audioPlayerManagerChanged();
}
void Mpris2::setManageMediaPlayerControl(ManageMediaPlayerControl *manageMediaPlayerControl)
{
if (m_manageMediaPlayerControl == manageMediaPlayerControl) {
return;
}
m_manageMediaPlayerControl = manageMediaPlayerControl;
if (m_playListModel && m_manageAudioPlayer && m_manageMediaPlayerControl && m_manageHeaderBar && m_audioPlayer && !m_playerName.isEmpty()) {
if (!m_mp2) {
initDBusService();
}
}
emit manageMediaPlayerControlChanged();
}
void Mpris2::setHeaderBarManager(ManageHeaderBar *manageHeaderBar)
{
if (m_manageHeaderBar == manageHeaderBar)
return;
m_manageHeaderBar = manageHeaderBar;
if (m_playListModel && m_manageAudioPlayer && m_manageMediaPlayerControl && m_manageHeaderBar && m_audioPlayer && !m_playerName.isEmpty()) {
if (!m_mp2) {
initDBusService();
}
}
emit headerBarManagerChanged();
}
void Mpris2::setAudioPlayer(AudioWrapper *audioPlayer)
{
if (m_audioPlayer == audioPlayer)
return;
m_audioPlayer = audioPlayer;
if (m_playListModel && m_manageAudioPlayer && m_manageMediaPlayerControl && m_manageHeaderBar && m_audioPlayer && !m_playerName.isEmpty()) {
if (!m_mp2) {
initDBusService();
}
}
emit audioPlayerChanged();
}
void Mpris2::setShowProgressOnTaskBar(bool value)
{
m_mp2p->setShowProgressOnTaskBar(value);
mShowProgressOnTaskBar = value;
Q_EMIT showProgressOnTaskBarChanged();
}
#include "moc_mpris2.cpp"
+131
View File
@@ -0,0 +1,131 @@
/***************************************************************************
SPDX-FileCopyrightText: 2014 (c) Sujith Haridasan <[email protected]>
SPDX-FileCopyrightText: 2014 (c) Ashish Madeti <[email protected]>
SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <[email protected]>
SPDX-License-Identifier: GPL-3.0-or-later
***************************************************************************/
#ifndef MEDIACENTER_MPRIS2_H
#define MEDIACENTER_MPRIS2_H
#include "elisaLib_export.h"
#include <QObject>
#include <QSharedPointer>
#include <memory>
class MediaPlayer2Player;
class MediaPlayer2;
class MediaPlayListProxyModel;
class ManageAudioPlayer;
class ManageMediaPlayerControl;
class ManageHeaderBar;
class AudioWrapper;
class ELISALIB_EXPORT Mpris2 : public QObject
{
Q_OBJECT
Q_PROPERTY(QString playerName
READ playerName
WRITE setPlayerName
NOTIFY playerNameChanged)
Q_PROPERTY(MediaPlayListProxyModel* playListModel
READ playListModel
WRITE setPlayListModel
NOTIFY playListModelChanged)
Q_PROPERTY(ManageAudioPlayer* audioPlayerManager
READ audioPlayerManager
WRITE setAudioPlayerManager
NOTIFY audioPlayerManagerChanged)
Q_PROPERTY(ManageMediaPlayerControl* manageMediaPlayerControl
READ manageMediaPlayerControl
WRITE setManageMediaPlayerControl
NOTIFY manageMediaPlayerControlChanged)
Q_PROPERTY(ManageHeaderBar* headerBarManager
READ headerBarManager
WRITE setHeaderBarManager
NOTIFY headerBarManagerChanged)
Q_PROPERTY(AudioWrapper* audioPlayer
READ audioPlayer
WRITE setAudioPlayer
NOTIFY audioPlayerChanged)
Q_PROPERTY(bool showProgressOnTaskBar
READ showProgressOnTaskBar
WRITE setShowProgressOnTaskBar
NOTIFY showProgressOnTaskBarChanged)
public:
explicit Mpris2(QObject* parent = nullptr);
~Mpris2() override;
[[nodiscard]] QString playerName() const;
[[nodiscard]] MediaPlayListProxyModel* playListModel() const;
[[nodiscard]] ManageAudioPlayer* audioPlayerManager() const;
[[nodiscard]] ManageMediaPlayerControl* manageMediaPlayerControl() const;
[[nodiscard]] ManageHeaderBar* headerBarManager() const;
[[nodiscard]] AudioWrapper* audioPlayer() const;
[[nodiscard]] bool showProgressOnTaskBar() const;
public Q_SLOTS:
void setPlayerName(const QString &playerName);
void setPlayListModel(MediaPlayListProxyModel* playListModel);
void setAudioPlayerManager(ManageAudioPlayer* audioPlayerManager);
void setManageMediaPlayerControl(ManageMediaPlayerControl* manageMediaPlayerControl);
void setHeaderBarManager(ManageHeaderBar* headerBarManager);
void setAudioPlayer(AudioWrapper* audioPlayer);
void setShowProgressOnTaskBar(bool value);
Q_SIGNALS:
void raisePlayer();
void playerNameChanged();
void playListModelChanged();
void audioPlayerManagerChanged();
void manageMediaPlayerControlChanged();
void headerBarManagerChanged();
void audioPlayerChanged();
void showProgressOnTaskBarChanged();
private:
void initDBusService();
std::unique_ptr<MediaPlayer2> m_mp2;
std::unique_ptr<MediaPlayer2Player> m_mp2p;
QString m_playerName;
MediaPlayListProxyModel* m_playListModel = nullptr;
ManageAudioPlayer* m_manageAudioPlayer = nullptr;
ManageMediaPlayerControl* m_manageMediaPlayerControl = nullptr;
ManageHeaderBar* m_manageHeaderBar = nullptr;
AudioWrapper* m_audioPlayer = nullptr;
bool mShowProgressOnTaskBar = true;
};
#endif //MEDIACENTER_MPRIS2_H
+1 -1
View File
@@ -52,7 +52,7 @@ private:
}
}
public:
explicit MultiIterableView(std::vector<Arguments> &&...lists)
explicit MultiIterableView(const std::vector<Arguments> &...lists)
: m_vectors(std::make_tuple(lists...))
{
}
-15
View File
@@ -1,15 +0,0 @@
// SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
//
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include "playerutils.h"
PlayerUtils::PlayerUtils(QObject *parent) : QObject(parent)
{
}
QString PlayerUtils::formatTimestamp(quint64 stamp)
{
return m_format.formatDuration(stamp, KFormat::FoldHours);
}
-22
View File
@@ -1,22 +0,0 @@
// SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
//
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#pragma once
#include <QObject>
#include <KFormat>
class PlayerUtils : public QObject
{
Q_OBJECT
public:
explicit PlayerUtils(QObject *parent = nullptr);
Q_INVOKABLE QString formatTimestamp(quint64 stamp);
private:
KFormat m_format;
};
+1 -1
View File
@@ -49,7 +49,7 @@ QVariant PlaylistModel::data(const QModelIndex &index, int role) const
case Title:
return QString::fromStdString(m_playlist.tracks[index.row()].title);
case Artists:
return QVariant::fromValue(m_playlist.tracks[index.row()].artists);
return PlaylistUtils::artistsToString(m_playlist.tracks[index.row()].artists);
case VideoId:
if (m_playlist.tracks[index.row()].video_id) {
return QString::fromStdString(*m_playlist.tracks[index.row()].video_id);
+1 -5
View File
@@ -10,9 +10,7 @@
#include <ytmusic.h>
namespace PlaylistUtils {
QString artistsToString(const std::vector<meta::Artist> &artists)
QString PlaylistUtils::artistsToString(const std::vector<meta::Artist> &artists)
{
if (!artists.empty()) {
return std::accumulate(artists.begin() + 1, artists.end(),
@@ -24,5 +22,3 @@ QString artistsToString(const std::vector<meta::Artist> &artists)
return {};
}
}
+6 -2
View File
@@ -11,6 +11,10 @@ namespace meta {
struct Artist;
}
namespace PlaylistUtils {
QString artistsToString(const std::vector<meta::Artist> &artists);
class PlaylistUtils
{
public:
PlaylistUtils() = delete;
static QString artistsToString(const std::vector<meta::Artist> &artists);
};
-6
View File
@@ -1,9 +1,3 @@
<!--
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
-->
<RCC>
<qresource prefix="/">
<file alias="main.qml">contents/ui/main.qml</file>
+1 -1
View File
@@ -21,7 +21,7 @@ class VideoInfoExtractor : public QObject
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
public:
explicit VideoInfoExtractor(QObject *parent = nullptr);
VideoInfoExtractor(QObject *parent = nullptr);
QUrl audioUrl() const;
Q_SIGNAL void audioUrlChanged();
+1 -6
View File
@@ -15,7 +15,7 @@ using namespace py::literals;
#define UNEXPORT __attribute__ ((visibility("hidden")))
constexpr auto TESTED_YTMUSICAPI_VERSION = "0.17.3";
constexpr auto TESTED_YTMUSICAPI_VERSION = "0.16.0";
struct UNEXPORT YTMusicPrivate {
py::scoped_interpreter guard {};
@@ -72,10 +72,6 @@ watch::Playlist::Track extract_watch_track(py::handle track);
template <typename T>
inline auto extract_py_list(py::handle obj) {
if (obj.is_none()) {
return std::vector<T>();
}
const auto list = obj.cast<py::list>();
std::vector<T> output;
@@ -280,7 +276,6 @@ YTMusic::YTMusic(
const auto module = py::module::import("ytmusicapi");
d->ytmusic = module.attr("YTMusic")(auth, user, requests_session, proxies, language);
// Some of the called python code randomly fails if the encoding is not utf8
setenv("LC_ALL", "en_US.utf8", true);
const auto version = module.attr("_version").attr("__version__").cast<std::string>();