Compare commits

..
81 Commits
Author SHA1 Message Date
Bhushan Shah 69901cb69c GIT_SILENT: Update appstream data for 21.08 2021-08-31 15:40:02 +05:30
Bhushan Shah e230adf223 GIT_SILENT: drop the kdev4 file, we don't commit this to repo 2021-08-31 15:19:07 +05:30
Bhushan Shah 07584b73f4 GIT_SILENT: Update cmake version for 21.08 2021-08-31 15:13:22 +05:30
Jonah Brüchert 1b29a028a6 cmake: Prepare for PlaMo gear 2021-08-09 11:51:46 +02:00
l10n daemon script 736d1789c9 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-08-01 01:22:02 +00:00
l10n daemon script 01f22c517a GIT_SILENT made messages (after extraction) 2021-08-01 00:24:21 +00:00
l10n daemon script edd171c97b SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-07-27 01:26:36 +00:00
Jonah Brüchert 873c791262 Fix page stack sometimes appearing in the footer 2021-07-18 18:11:08 +02:00
Jonah Brüchert 068a5b756a Stop the loading animation if a query fails 2021-07-12 01:50:42 +02:00
Jonah Brüchert db35f2a5e6 Update ytmusicapi 2021-07-12 00:25:17 +02:00
Jonah Brüchert c06bb7ad03 Fix new search bar overlaying the player 2021-07-10 20:30:22 +02:00
Jonah Brüchert 1c63395497 Fix i18n 2021-07-10 19:51:47 +02:00
Jonah Brüchert ba79cd6b5a Add new dependencies to README 2021-07-10 19:38:43 +02:00
Jonah Brüchert a458b36ed3 Add placeholder message to search page 2021-07-10 19:37:28 +02:00
Mathis Brüchert 1c51c183f0 move search field into header 2021-07-10 19:14:38 +02:00
Mohammad Shavez 7a69653933 Fix: Hide timestamps when queue is cleared 2021-07-10 13:24:19 +05:30
l10n daemon script f9a286b136 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-07-05 01:18:42 +00:00
l10n daemon script 87e1a7ef90 GIT_SILENT made messages (after extraction) 2021-07-05 00:20:18 +00:00
l10n daemon script e5561d0256 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-07-04 01:16:40 +00:00
l10n daemon script 998ba22a21 GIT_SILENT made messages (after extraction) 2021-07-04 00:18:54 +00:00
l10n daemon script a79fb43569 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-07-02 01:14:16 +00:00
l10n daemon script 0365309415 GIT_SILENT made messages (after extraction) 2021-07-02 00:19:14 +00:00
Jonah Brüchert c0df2785df Lazy-initialize YTMusic object
So it can't throw exceptions in the constructor,
and we can actually properly handle them.
2021-06-30 01:49:24 +02:00
Jonah Brüchert e0ae3f0c93 Fix i18n usage 2021-06-28 02:00:18 +02:00
Jonah Brüchert b95850013b Regenerate flatpak sources 2021-06-28 00:06:08 +02:00
Jonah Brüchert 4ec46a10bf Add artist radio feature 2021-06-27 16:28:25 +02:00
l10n daemon script 05e9949487 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-06-23 01:17:05 +00:00
l10n daemon script 7b1bce6297 GIT_SILENT made messages (after extraction) 2021-06-23 00:20:23 +00:00
l10n daemon script b6fa3b3aa9 GIT_SILENT made messages (after extraction) 2021-06-21 00:20:46 +00:00
Jonah Brüchert 5b5e41a563 Display title of the video that could not be played 2021-06-21 01:20:29 +02:00
Jonah Brüchert 8fcac61500 Fix loading Thomas Bangalter 2021-06-21 01:15:27 +02:00
Jonah Brüchert 0420a694f7 Set KAboutData for KCrash 2021-06-18 16:16:35 +02:00
Jonah Brüchert 78cf01b0e8 Enable KCrash 2021-06-18 16:15:58 +02:00
Jonah Brüchert b5f8ae8d85 Add copyright headers to find modules 2021-06-17 14:04:32 +02:00
Jonah Brüchert 58c183df56 Add find modules for python dependencies 2021-06-17 01:15:32 +02:00
Jonah Brüchert 2272f88db9 Add text to playlist actions 2021-06-17 00:45:01 +02:00
Jonah Brüchert d7f1a408fd Only leave space for the album cover if there is one 2021-06-17 00:43:02 +02:00
Jonah Brüchert b7c99086e9 Simplify setting the translation domain 2021-06-16 22:32:10 +02:00
Jonah Brüchert 28c5b7d562 License some data files as CC0-1.0 2021-06-16 21:44:57 +02:00
Jonah Brüchert c163b6b995 Set translation domain 2021-06-16 21:42:53 +02:00
Jonah Brüchert 7e62862bd3 Add CI job to check reuse compliance 2021-06-16 21:36:08 +02:00
Jonah Brüchert 89402fb770 Fix reuse compliance 2021-06-16 21:35:56 +02:00
Jonah Brüchert 4717953a06 Use title capitalization in actions 2021-06-16 21:25:44 +02:00
Jonah Brüchert eefab11079 example: Fix typo 2021-06-16 21:22:07 +02:00
Jonah Brüchert 25d5749970 Make YTMusicThread destructor override 2021-06-16 21:21:52 +02:00
Jonah Brüchert 5e4c45038f asyncytmusic.h: Fix typo 2021-06-16 21:20:05 +02:00
Jonah Brüchert 7967d37f14 Make PlaylistUtils a namespace 2021-06-16 21:18:26 +02:00
Jonah Brüchert 1ee5a49c72 Make VideoInfoExtractor constructor explicit 2021-06-16 21:15:57 +02:00
Jonah Brüchert 44aedfd702 Add comment about the setenv 2021-06-16 21:14:22 +02:00
Jonah Brüchert 5e4fcb7d35 metainfo: Add launchable 2021-06-16 21:12:46 +02:00
l10n daemon script d6dcce1a88 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-06-16 01:25:39 +00:00
l10n daemon script e34530bf7d GIT_SILENT made messages (after extraction) 2021-06-16 00:20:38 +00:00
Jonah Brüchert 56b440f689 Use KFormat to format the timestamps 2021-06-13 23:00:48 +02:00
Jonah Brüchert e2cebadaef Move contents into MultiIterableView
makes it easier and safer and we currently don't need the lists anywhere else
2021-06-13 18:41:13 +02:00
l10n daemon script 49d55d73d1 GIT_SILENT made messages (after extraction) 2021-06-11 00:19:11 +00:00
Jonah Brüchert a9ec57a008 Fix playback from playlist page 2021-06-10 22:33:28 +02:00
Jonah Brüchert f4e11ba490 Depend on at least the cmake version required by FindKF5 2021-06-10 19:16:06 +02:00
Jonah Brüchert 44176b49ac metainfo: Add information about input devices 2021-06-10 18:51:11 +02:00
Jonah Brüchert 79ff9230ba Extend appstream metadata 2021-06-10 18:47:12 +02:00
l10n daemon script d6682dbfe3 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-06-07 01:17:55 +00:00
l10n daemon script ef53ac4b1a GIT_SILENT made messages (after extraction) 2021-06-07 00:20:04 +00:00
Tobias Fella c503d0607a Add missing license texts 2021-06-06 13:09:27 +02:00
Tobias Fella 5f63abd8bb Fix license identifiers 2021-06-06 13:09:17 +02:00
l10n daemon script e2530e94cf SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-06-06 01:20:14 +00:00
l10n daemon script 1f3e1ff98e GIT_SILENT made messages (after extraction) 2021-06-06 00:20:04 +00:00
Luigi Toscano f7353bfcd5 svg file: temporarily fix the wrong headers
An SVN file is a valid XML file, but it is mostly handled by a graphic
program.
It seems the metadata should be added though the editor using some
standard SVG fields, but it is not fully clear (at least to me)
which ones are the correct ones, see also:

https://github.com/fsfe/reuse-tool/issues/180

In any case, the SPDX header before the xml line makes this
an invalid SVG file (even though some relaxed parser may still
accept it), so remove the SPDX comment for now.

CCMAIL: [email protected]
2021-06-06 00:40:09 +02:00
Luigi Toscano bdeca89a95 Fix appdata: the xml header must be the 1st
Otherwise it is not a valid XML file. Please see also:
https://community.kde.org/Guidelines_and_HOWTOs/Licensing#XML_Files_.28appdata.xml.2C_.2A.qrc.29

CCMAIL: [email protected]
2021-06-06 00:34:42 +02:00
Jonah Brüchert a707a0523f Enable reuseItems in all list views 2021-06-05 13:23:27 +02:00
l10n daemon script 70243a6e59 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-06-05 01:17:27 +00:00
Jonah Brüchert 2f4cb7868a Update tested ytmusicapi version 2021-06-05 00:33:18 +02:00
Jonah Brüchert 1fa0a3f4b2 Add reuse headers to currently unlicensed files 2021-06-04 17:36:13 +02:00
l10n daemon script f24a74d195 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-06-04 01:25:30 +00:00
l10n daemon script 38c448335f GIT_SILENT made messages (after extraction) 2021-06-04 00:22:38 +00:00
l10n daemon script 9afeae2ccc SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-05-30 01:17:11 +00:00
l10n daemon script 583973a731 GIT_SILENT made messages (after extraction) 2021-05-30 00:19:35 +00:00
Yuri Chornoivan dc5c25cf42 Add message extraction script 2021-05-27 18:46:59 +03:00
l10n daemon script a4fcc55638 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-05-26 01:27:39 +00:00
l10n daemon script 1aa7559fe7 GIT_SILENT made messages (after extraction) 2021-05-26 00:22:08 +00:00
Mohammad Shavez 6f4ec382e8 Hide timestamps when no media is playing 2021-05-25 07:19:03 +00:00
Mohammad Shavez a67631ec92 Added timestamps around progress bar 2021-05-25 07:19:03 +00:00
Jonah Brüchert d861b7cc59 Update tested ytmusicapi version 2021-05-25 01:13:59 +02:00
55 changed files with 874 additions and 414 deletions

No files matched your search

+6
View File
@@ -1,2 +1,8 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
# SPDX-FileCopyrightText: 2021 Bhushan Shah <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*.kdev4
CMakeLists.txt.user
flatpak/flatpak-builder-tools/
+6
View File
@@ -0,0 +1,6 @@
# 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
@@ -0,0 +1,4 @@
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
+15 -3
View File
@@ -1,9 +1,14 @@
cmake_minimum_required(VERSION 3.14)
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
cmake_minimum_required(VERSION 3.16.0)
project(audiotube)
include(FeatureSummary)
set(PROJECT_VERSION "21.08")
set(QT5_MIN_VERSION 5.15)
set(KF5_MIN_VERSION 5.81)
@@ -12,7 +17,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})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECMakeSettings)
@@ -21,11 +26,18 @@ include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMPoQmTools)
ecm_setup_version(${PROJECT_VERSION}
VARIABLE_PREFIX AUDIOTUBE
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/version.h
)
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)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n CoreAddons Crash)
find_package(pybind11 REQUIRED)
find_package(YoutubeDL REQUIRED RUNTIME)
find_package(YTMusicAPI REQUIRED RUNTIME)
add_subdirectory(src)
+22
View File
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,119 @@
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.
+1 -1
View File
@@ -4,7 +4,7 @@ AudioTube is a client for YouTube Music.
# Dependencies
It depends on Qt and Kirigami in addition to a few python packages:
It depends on Qt, Kirigami, KI18n, KCoreAddons and KCrash in addition to a few python packages:
* ytmusicapi
* youtube_dl
+3
View File
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
SPDX-License-Identifier: CC0-1.0
+11
View File
@@ -0,0 +1,11 @@
# 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
@@ -0,0 +1,11 @@
# 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/94/a0/b8325b524700daae1c04a6156473ab7091d44071353f1d7c9e66b9c7f019/youtube_dl-2021.4.26.tar.gz",
"sha256": "6f311ffaf8b88cdcf27a2301a2272455e213bdb780aa447246933a3da4532879"
"url": "https://files.pythonhosted.org/packages/c6/75/05979677d9abc76851d13d8db3951e39017ac223545adab6e8576fa0cbe7/youtube_dl-2021.6.6.tar.gz",
"sha256": "cb2d3ee002158ede783e97a82c95f3817594df54367ea6a77ce5ceea4772f0ab"
}
]
}
+3
View File
@@ -0,0 +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
+6 -6
View File
@@ -7,8 +7,8 @@
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/cb/cf/871177f1fc795c6c10787bc0e1f27bb6cf7b81dbde399fd35860472cecbc/urllib3-1.26.4.tar.gz",
"sha256": "e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"
"url": "https://files.pythonhosted.org/packages/4f/5a/597ef5911cb8919efe4d86206aa8b2658616d676a7088f0825ca08bd7cb8/urllib3-1.26.6.tar.gz",
"sha256": "f57b4c16c62fa2760b7e3d97c35b255512fb6b59a259730f36ba32ce9f8e342f"
},
{
"type": "file",
@@ -22,8 +22,8 @@
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/06/a9/cd1fd8ee13f73a4d4f491ee219deeeae20afefa914dfb4c130cfc9dc397a/certifi-2020.12.5.tar.gz",
"sha256": "1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"
"url": "https://files.pythonhosted.org/packages/6d/78/f8db8d57f520a54f0b8a438319c342c61c22759d8f9a1cd2e2180b5e5ea9/certifi-2021.5.30.tar.gz",
"sha256": "2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee"
},
{
"type": "file",
@@ -32,8 +32,8 @@
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/61/b5/da439d5f75db7ff17790b19136c835f9a315530436ee7bc9d75aeea2f6e5/ytmusicapi-0.16.0.tar.gz",
"sha256": "ffde3fb5a78123ac59dee37fc1f32793f34f9a4fa3d3e69a1fc08064112c2b5d"
"url": "https://files.pythonhosted.org/packages/83/aa/3e2c231fbef90d5bd75614e3739bb27e7e33e28c9891d6ee0561fe52a9df/ytmusicapi-0.18.0.tar.gz",
"sha256": "447d1b6a594f49942f7ac75412cba59c191b6f3540d98ac65a1333445beec16d"
}
]
}
+3
View File
@@ -0,0 +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
+4
View File
@@ -1,5 +1,9 @@
#!/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
@@ -0,0 +1,3 @@
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
+72
View File
@@ -1,13 +1,31 @@
<?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="en-GB">AudioTube</name>
<name xml:lang="es">AudioTube</name>
<name xml:lang="eu">AudioTube</name>
<name xml:lang="fi">AudioTube</name>
<name xml:lang="fr">AudioTube</name>
<name xml:lang="hi">ओडियो-ट्यूब</name>
<name xml:lang="it">AudioTube</name>
<name xml:lang="ko">AudioTube</name>
<name xml:lang="nl">AudioTube</name>
<name xml:lang="pa">ਆਡੀਓ-ਟਿਊਬ</name>
<name xml:lang="pl">AudioTube</name>
<name xml:lang="pt">AudioTube</name>
<name xml:lang="pt-BR">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>
@@ -15,9 +33,19 @@
<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="en-GB">Convergent YouTube Music client</summary>
<summary xml:lang="es">Cliente de música de YouTube convergente</summary>
<summary xml:lang="eu">YouTube Music bezero konbergentea</summary>
<summary xml:lang="fi">Mukautuva YouTube Music -asiakas</summary>
<summary xml:lang="fr">Client convergent pour musique sur YouTube</summary>
<summary xml:lang="hi">अभिसृत यूट्यूब संगीत क्लाएंट</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">Adaptacyjny program do YouTube Music</summary>
<summary xml:lang="pt">Cliente de música do YouTube convergente</summary>
<summary xml:lang="pt-BR">Um cliente convergente para o YouTube Music</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>
@@ -26,21 +54,65 @@
<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="en-GB">KDE Community</developer_name>
<developer_name xml:lang="es">Comunidad KDE</developer_name>
<developer_name xml:lang="eu">KDE komunitatea</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="hi">केडीई समुदाय</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="pa">ਕੇਡੀਈ ਕਮਿਊਨਟੀ</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="pt-BR">A Comunidade 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>
<releases>
<release version="21.08" date="2021-08-31">
<url>https://www.plasma-mobile.org/2021/08/31/plasma-mobile-gear-21-08/</url>
</release>
</releases>
<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="en-GB">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="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="eu">AudioTube-k YouTube Music-en bilatu dezake, albumak eta artistak zerrendatu, automatikoki sortutako jotze-zerrendak eta albumak jo, eta zure jotze-zerrenda osatzeko aukera eskaintzen dizu.</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="hi">ऑडियोट्यूब यूट्यूब संगीत खोज सकता है, एल्बम और कलाकारों की सूची बना सकता है, स्वचालित रूप से उत्पन्न की गई गीतसूची, एल्बम बजा सकता है और आपकी अपनी खुद की प्लेलिस्ट को एक साथ रखने में मदद करता है।</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 przeszukiwać serwis YouTube Music, 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="pt-BR">O AudioTube pode pesquisar no YouTube Music, listar álbuns e artistas, rodar listas de reprodução geradas automaticamente, álbuns inteiros, e criar a sua própria lista 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>
+28
View File
@@ -2,20 +2,48 @@
Name=AudioTube
Name[ca]=AudioTube
Name[ca@valencia]=AudioTube
Name[cs]=AudioTube
Name[de]=AudioTube
Name[en_GB]=AudioTube
Name[es]=AudioTube
Name[eu]=AudioTube
Name[fi]=AudioTube
Name[fr]=AudioTube
Name[hi]=ओडियो-ट्यूब
Name[it]=AudioTube
Name[ko]=AudioTube
Name[nl]=AudioTube
Name[pa]=ਆਡੀਓ-ਟਿਊਬ
Name[pl]=AudioTube
Name[pt]=AudioTube
Name[pt_BR]=AudioTube
Name[ro]=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[en_GB]=YouTube Music client
Comment[es]=Cliente de música de YouTube
Comment[eu]=YouTube Music bezeroa
Comment[fi]=YouTube Music -asiakas
Comment[fr]=Client de musique sur Youtube
Comment[hi]=यूट्यूब संगीत क्लाएंट
Comment[it]=Client YouTube Music
Comment[ko]=YouTube Music 클라이언트
Comment[nl]=Muziekclient van YouTube
Comment[pa]=ਯੂਟਿਊਬ ਸੰਗੀਤ ਕਲਾਈਂਟ
Comment[pl]=Program do YouTube Music
Comment[pt]=Cliente do YouTube Music
Comment[pt_BR]=Cliente YouTube Music
Comment[ro]=Client de muzică pentru YouTube
Comment[sk]=Hudobný klient YouTube
Comment[sl]=Glasbeni odjemalec Youtube
Comment[sv]=YouTube-musikprogram
Comment[uk]=Музичний клієнт YouTube
Comment[x-test]=xxYouTube Music clientxx
+3
View File
@@ -0,0 +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
+3
View File
@@ -0,0 +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
+3
View File
@@ -0,0 +1,3 @@
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
+6 -1
View File
@@ -1,2 +1,7 @@
ytmusicapi==0.16.0
# 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.18.0
youtube_dl
+8
View File
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2021 Jonah Brüchert <[email protected]>
#
# SPDX-License-Identifier: BSD-2-Clause
add_library(ytm STATIC
ytmusic.cpp
)
@@ -19,6 +23,8 @@ add_executable(audiotube
playlistmodel.cpp
playlistutils.cpp
errorhandler.cpp
playerutils.cpp
abstractytmusicmodel.cpp
multiiterableview.h
resources.qrc
)
@@ -31,6 +37,8 @@ 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
@@ -0,0 +1,4 @@
#! /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
+27
View File
@@ -0,0 +1,27 @@
// 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 "abstractytmusicmodel.h"
#include "asyncytmusic.h"
AbstractYTMusicModel::AbstractYTMusicModel(QObject *parent)
: QAbstractListModel(parent)
{
}
bool AbstractYTMusicModel::loading() const
{
return m_loading;
}
void AbstractYTMusicModel::setLoading(bool loading)
{
if (m_loading == loading)
return;
m_loading = loading;
Q_EMIT loadingChanged();
}
+28
View File
@@ -0,0 +1,28 @@
// 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 <QAbstractListModel>
///
/// Base class for all models that work with data from the AsyncYTMusic class.
/// It provides a loading property, that is automatically set to false if a query fails.
///
class AbstractYTMusicModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
public:
explicit AbstractYTMusicModel(QObject *parent = nullptr);
bool loading() const;
void setLoading(bool loading);
Q_SIGNAL void loadingChanged();
private:
bool m_loading = false;
};
+1 -13
View File
@@ -7,7 +7,7 @@
#include <QDebug>
AlbumModel::AlbumModel(QObject *parent)
: QAbstractListModel(parent)
: AbstractYTMusicModel(parent)
{
connect(this, &AlbumModel::browseIdChanged, this, [=] {
setLoading(true);
@@ -81,18 +81,6 @@ QString AlbumModel::title() const
return QString::fromStdString(m_album.title);
}
bool AlbumModel::loading() const
{
return m_loading;
}
void AlbumModel::setLoading(bool loading)
{
m_loading = loading;
Q_EMIT loadingChanged();
}
QUrl AlbumModel::thumbnailUrl() const
{
if (m_album.thumbnails.empty()) {
+2 -7
View File
@@ -8,15 +8,15 @@
#include <QUrl>
#include "asyncytmusic.h"
#include "abstractytmusicmodel.h"
class AlbumModel : public QAbstractListModel
class AlbumModel : public AbstractYTMusicModel
{
Q_OBJECT
Q_PROPERTY(QString browseId READ browseId WRITE setBrowseId NOTIFY browseIdChanged REQUIRED)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl NOTIFY thumbnailUrlChanged)
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
Q_PROPERTY(QString playlistId READ playlistId NOTIFY playlistIdChanged)
public:
@@ -39,10 +39,6 @@ public:
QString title() const;
Q_SIGNAL void titleChanged();
bool loading() const;
void setLoading(bool loading);
Q_SIGNAL void loadingChanged();
QUrl thumbnailUrl() const;
Q_SIGNAL void thumbnailUrlChanged();
@@ -51,7 +47,6 @@ public:
private:
QString m_browseId;
bool m_loading = false;
album::Album m_album;
};
+12 -17
View File
@@ -7,7 +7,7 @@
#include <asyncytmusic.h>
ArtistModel::ArtistModel(QObject *parent)
: QAbstractListModel(parent)
: AbstractYTMusicModel(parent)
{
connect(this, &ArtistModel::channelIdChanged, this, [=] {
if (m_channelId.isEmpty()) {
@@ -24,10 +24,16 @@ ArtistModel::ArtistModel(QObject *parent)
beginResetModel();
m_artist = artist;
std::sort(m_artist.thumbnails.begin(), m_artist.thumbnails.end());
m_view = std::optional(MultiIterableView(m_artist.albums->results,
m_artist.singles->results,
m_artist.songs->results,
m_artist.videos->results));
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)));
endResetModel();
@@ -145,17 +151,6 @@ QUrl ArtistModel::thumbnailUrl() const
return QUrl(QString::fromStdString(m_artist.thumbnails.back().url));
}
bool ArtistModel::loading() const
{
return m_loading;
}
void ArtistModel::setLoading(bool loading)
{
m_loading = loading;
Q_EMIT loadingChanged();
}
void ArtistModel::triggerItem(int row)
{
if (m_view) {
@@ -168,7 +163,7 @@ void ArtistModel::triggerItem(int row)
} else if constexpr(std::is_same_v<T, artist::Artist::Song>) {
Q_EMIT openSong(QString::fromStdString(item.video_id));
} else if constexpr(std::is_same_v<T, artist::Artist::Video>) {
Q_EMIT openVideo(QString::fromStdString(item.video_id));
Q_EMIT openVideo(QString::fromStdString(item.video_id), QString::fromStdString(item.title));
} else {
Q_UNREACHABLE();
}
+6 -9
View File
@@ -10,9 +10,12 @@
#include <optional>
#include <ytmusic.h>
#include "multiiterableview.h"
class ArtistModel : public QAbstractListModel
#include "multiiterableview.h"
#include "abstractytmusicmodel.h"
class ArtistModel : public AbstractYTMusicModel
{
Q_OBJECT
@@ -20,7 +23,6 @@ class ArtistModel : public QAbstractListModel
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl NOTIFY thumbnailUrlChanged)
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
public:
enum Type {
@@ -54,19 +56,14 @@ public:
QUrl thumbnailUrl() const;
Q_SIGNAL void thumbnailUrlChanged();
bool loading() const;
void setLoading(bool loading);
Q_SIGNAL void loadingChanged();
Q_INVOKABLE void triggerItem(int row);
Q_SIGNAL void openAlbum(const QString &browseId);
Q_SIGNAL void openSong(const QString &videoId);
Q_SIGNAL void openVideo(const QString &videoId);
Q_SIGNAL void openVideo(const QString &videoId, const QString &title);
private:
QString m_channelId;
bool m_loading = false;
artist::Artist m_artist;
std::optional<MultiIterableView<
+3 -2
View File
@@ -37,6 +37,7 @@ public:
if (!m_item) {
m_item = std::make_unique<T>();
}
Q_ASSERT(m_item);
return m_item;
}
@@ -107,14 +108,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 ininitalized from the thread calling the methods
// Python interpreter will be initialized from the thread calling the methods
Lazy<YTMusic> m_ytm;
};
class YTMusicThread : private QThread {
public:
static YTMusicThread &instance();
~YTMusicThread();
~YTMusicThread() override;
AsyncYTMusic *operator->();
AsyncYTMusic &get();
+5 -3
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.1
import QtQuick 2.15
import org.kde.kirigami 2.14 as Kirigami
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.3
@@ -29,6 +29,8 @@ Kirigami.ScrollablePage {
title: albumModel.title
}
reuseItems: true
model: AlbumModel {
id: albumModel
}
@@ -56,12 +58,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)
}
]
+8 -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.1
import QtQuick 2.15
import org.kde.kirigami 2.14 as Kirigami
import QtQuick.Controls 2.14 as Controls
import QtQuick.Layouts 1.3
@@ -19,6 +19,9 @@ Kirigami.ScrollablePage {
backgroundImage.source: artistModel.thumbnailUrl
title: artistModel.title
}
reuseItems: true
model: ArtistModel {
id: artistModel
@@ -32,8 +35,8 @@ Kirigami.ScrollablePage {
play(videoId)
}
onOpenVideo: (videoId) => {
askPlayVideoAudio(videoId)
onOpenVideo: (videoId, title) => {
askPlayVideoAudio(videoId, title)
}
}
section.property: "type"
@@ -87,13 +90,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)
}
+204 -221
View File
@@ -9,269 +9,252 @@ import org.kde.kirigami 2.12 as Kirigami
import org.kde.ytmusic 1.0
import QtMultimedia 5.12
ColumnLayout {
id: footerLayout
Item {
id: footerItem
property bool maximized: false
anchors.left: parent.left
anchors.right: parent.right
height: maximized ? applicationWindow().height : player.preferredHeight
height: maximized ? applicationWindow().height : 75
GridLayout {
id: playerLayout
Rectangle {
color: Kirigami.Theme.backgroundColor
Kirigami.Theme.colorSet: Kirigami.Theme.Window
anchors.fill: footerLayout
}
readonly property bool mobile: width > height
ColumnLayout {
id: footerLayout
height: parent.height
anchors.fill: parent
Layout.fillHeight: footerLayout.maximized
Layout.fillWidth: true
flow: width > height ? GridLayout.LeftToRight : GridLayout.TopToBottom
visible: footerLayout.maximized
GridLayout {
id: playerLayout
Item {
readonly property bool mobile: width > height
Layout.fillHeight: footerItem.maximized
Layout.fillWidth: true
Layout.fillHeight: true
Image {
anchors.fill: parent
flow: width > height ? GridLayout.LeftToRight : GridLayout.TopToBottom
visible: footerItem.maximized
source: info.thumbnail
fillMode: Image.PreserveAspectFit
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Controls.ScrollView {
anchors.fill: parent
ListView {
Item {
Layout.fillWidth: info.thumbnail
Layout.fillHeight: info.thumbnail
Image {
anchors.fill: parent
id: playlistView
clip: true
Controls.BusyIndicator {
anchors.centerIn: parent
visible: UserPlaylistModel.loading || UserPlaylistModel.loading
}
onCountChanged: {
if (count < 1) {
footerLayout.maximized = false
}
}
model: UserPlaylistModel
delegate: Kirigami.SwipeListItem {
id: delegateItem
required property string title
required property string videoId
required property string artists
required property bool isCurrent
highlighted: isCurrent
onClicked: UserPlaylistModel.skipTo(videoId)
ColumnLayout {
Layout.fillWidth: true
Kirigami.Heading {
elide: Text.ElideRight
Layout.fillWidth: true
level: 2
text: title
}
Controls.Label {
elide: Text.ElideRight
Layout.fillWidth: true
text: artists
}
}
actions: [
Kirigami.Action {
text: i18n("Remove track")
icon.name: "list-remove"
onTriggered: UserPlaylistModel.remove(delegateItem.videoId)
}
]
}
header: Controls.ToolBar {
anchors.left: parent.left
anchors.right: parent.right
RowLayout {
anchors.fill: parent
Item {
Layout.fillWidth: true
}
Controls.ToolButton {
icon.name: "edit-clear-all"
onClicked: UserPlaylistModel.clear()
}
Controls.ToolButton {
icon.name: "media-playlist-shuffle"
onClicked: UserPlaylistModel.shufflePlaylist()
}
}
}
source: info.thumbnail
fillMode: Image.PreserveAspectFit
}
}
}
}
Kirigami.Separator {
Layout.fillWidth: true
}
RowLayout {
id: player
Layout.fillWidth: true
Layout.fillHeight: !footer.maximized
VideoInfoExtractor {
id: info
onSongChanged: audio.play()
videoId: UserPlaylistModel.currentVideoId
}
Audio {
id: audio
source: info.audioUrl
onStatusChanged: {
if (status === Audio.EndOfMedia) {
console.log("Song ended");
UserPlaylistModel.next();
}
}
}
Controls.ToolButton {
display: Controls.AbstractButton.IconOnly
Layout.preferredWidth: parent.height
Layout.fillHeight: true
enabled: info.audioUrl != ""
text: audio.playbackState === Audio.PlayingState ? i18n("Pause") : i18n("Play")
visible: !info.loading
icon.name: audio.playbackState === Audio.PlayingState ? "media-playback-pause" : "media-playback-start"
onClicked: audio.playbackState === Audio.PlayingState ? audio.pause() : audio.play()
}
Controls.ToolButton {
display: Controls.AbstractButton.IconOnly
Layout.preferredWidth: parent.height
Layout.fillHeight: true
enabled: UserPlaylistModel.canSkip
visible: !info.loading
icon.name: "media-skip-forward"
onClicked: UserPlaylistModel.next()
}
Controls.BusyIndicator {
Layout.fillHeight: true
visible: info.loading
}
ColumnLayout {
Layout.fillHeight: true
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.bottomMargin: Kirigami.Units.smallSpacing
Kirigami.Heading {
level: 3
Item {
Layout.fillWidth: true
elide: Qt.ElideRight
text: info.title ? info.title : i18n("No media playing")
}
Layout.fillHeight: true
RowLayout{
Controls.ScrollView {
anchors.fill: parent
Controls.Label{
visible: audio.duration > 0
text: {
var hours = new Date(audio.position).getUTCHours()
if(hours>0)
hours = (("0"+hours).slice(-2)) + ":"
else
hours = ""
ListView {
anchors.fill: parent
id: playlistView
var minutes = new Date(audio.position).getUTCMinutes()
minutes = ("0"+minutes).slice(-2)
clip: true
var seconds = new Date(audio.position).getUTCSeconds()
seconds = ("0"+seconds).slice(-2)
Controls.BusyIndicator {
anchors.centerIn: parent
visible: UserPlaylistModel.loading || UserPlaylistModel.loading
}
return hours+minutes+":"+seconds;
onCountChanged: {
if (count < 1) {
footerItem.maximized = false
}
}
model: UserPlaylistModel
delegate: Kirigami.SwipeListItem {
id: delegateItem
required property string title
required property string videoId
required property string artists
required property bool isCurrent
highlighted: isCurrent
onClicked: UserPlaylistModel.skipTo(videoId)
ColumnLayout {
Layout.fillWidth: true
Kirigami.Heading {
elide: Text.ElideRight
Layout.fillWidth: true
level: 2
text: title
}
Controls.Label {
elide: Text.ElideRight
Layout.fillWidth: true
text: artists
}
}
actions: [
Kirigami.Action {
text: i18n("Remove Track")
icon.name: "list-remove"
onTriggered: UserPlaylistModel.remove(delegateItem.videoId)
}
]
}
header: Controls.ToolBar {
anchors.left: parent.left
anchors.right: parent.right
RowLayout {
anchors.fill: parent
Item {
Layout.fillWidth: true
}
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()
}
}
}
}
}
}
}
Controls.Slider {
Kirigami.Separator {
Layout.fillWidth: true
}
RowLayout {
id: player
Layout.fillWidth: true
Layout.fillHeight: !footer.maximized
VideoInfoExtractor {
id: info
onSongChanged: audio.play()
videoId: UserPlaylistModel.currentVideoId
}
Audio {
id: audio
source: info.audioUrl
onStatusChanged: {
if (status === Audio.EndOfMedia) {
console.log("Song ended");
UserPlaylistModel.next();
}
}
}
Controls.ToolButton {
display: Controls.AbstractButton.IconOnly
Layout.preferredWidth: parent.height
Layout.fillHeight: true
enabled: info.audioUrl != ""
text: audio.playbackState === Audio.PlayingState ? i18n("Pause") : i18n("Play")
visible: !info.loading
icon.name: audio.playbackState === Audio.PlayingState ? "media-playback-pause" : "media-playback-start"
onClicked: audio.playbackState === Audio.PlayingState ? audio.pause() : audio.play()
}
Controls.ToolButton {
display: Controls.AbstractButton.IconOnly
Layout.preferredWidth: parent.height
Layout.fillHeight: true
enabled: UserPlaylistModel.canSkip
visible: !info.loading
icon.name: "media-skip-forward"
onClicked: UserPlaylistModel.next()
}
Controls.BusyIndicator {
Layout.fillHeight: true
visible: info.loading
}
ColumnLayout {
Layout.fillHeight: true
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.bottomMargin: Kirigami.Units.smallSpacing
Kirigami.Heading {
level: 3
Layout.fillWidth: true
from: 0
to: audio.duration
value: audio.position
enabled: audio.seekable
onMoved: {
console.log("Value:", value);
audio.seek(Math.floor(value));
elide: Qt.ElideRight
text: info.title ? info.title : i18n("No media playing")
}
RowLayout{
Controls.Label{
visible: info.title
text: PlayerUtils.formatTimestamp(audio.position)
}
Behavior on value {
NumberAnimation {
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 {
}
}
}
}
Controls.Label{
visible: audio.duration > 0
text: {
var hours = new Date(audio.duration).getUTCHours()
if(hours>0)
hours = (("0"+hours).slice(-2)) + ":"
else
hours = ""
var minutes = new Date(audio.duration).getUTCMinutes()
minutes = ("0"+minutes).slice(-2)
var seconds = new Date(audio.duration).getUTCSeconds()
seconds = ("0"+seconds).slice(-2)
return hours+minutes+":"+seconds;
Controls.Label{
visible: info.title
text: PlayerUtils.formatTimestamp(audio.duration)
}
}
}
Controls.ToolButton {
display: Controls.AbstractButton.IconOnly
Layout.preferredWidth: parent.height
text: i18n("Expand")
enabled: playlistView.count > 0
Layout.fillHeight: true
icon.name: footerItem.maximized ? "arrow-down" : "arrow-up"
onClicked: footerItem.maximized = !footerItem.maximized
}
}
Controls.ToolButton {
display: Controls.AbstractButton.IconOnly
Layout.preferredWidth: parent.height
text: i18n("Expand")
enabled: playlistView.count > 0
Layout.fillHeight: true
icon.name: footerLayout.maximized ? "arrow-down" : "arrow-up"
onClicked: footerLayout.maximized = !footerLayout.maximized
}
}
Behavior on height {
NumberAnimation {
}
}
}
+9 -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.0
import QtQuick 2.15
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12 as Controls
import org.kde.kirigami 2.12 as Kirigami
@@ -38,11 +38,14 @@ Kirigami.ScrollablePage {
model: PlaylistModel {
id: playlistModel
}
reuseItems: true
delegate: Kirigami.SwipeListItem {
id: delegateItem
required property string title
required property string videoId
required property string artists
required property var artists
RowLayout {
Layout.fillHeight: true
@@ -61,15 +64,17 @@ 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 {
+28 -15
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.0
import QtQuick 2.15
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.14 as Controls
import org.kde.kirigami 2.14 as Kirigami
@@ -10,20 +10,13 @@ import org.kde.kirigami 2.14 as Kirigami
import org.kde.ytmusic 1.0
Kirigami.ScrollablePage {
title: i18n("Youtube Music")
property alias searchQuery: searchModel.searchQuery
header: Controls.Control {
padding: Kirigami.Units.largeSpacing
contentItem: Kirigami.SearchField {
delaySearch: true
selectByMouse: true
onAccepted: {
searchModel.searchQuery = text
}
}
}
title: searchQuery
ListView {
reuseItems: true
model: SearchModel {
id: searchModel
@@ -49,8 +42,8 @@ Kirigami.ScrollablePage {
play(videoId)
}
onOpenVideo: (videoId) => {
askPlayVideoAudio(videoId)
onOpenVideo: (videoId, title) => {
askPlayVideoAudio(videoId, title)
}
}
delegate: Kirigami.SwipeListItem {
@@ -60,6 +53,7 @@ Kirigami.ScrollablePage {
required property int type
required property string videoId
required property var artists
required property string radioPlaylistId
RowLayout {
Layout.fillHeight: true
@@ -97,9 +91,15 @@ 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)
},
Kirigami.Action {
icon.name: "radio"
text: i18n("Radio")
visible: delegateItem.type === SearchModel.Artist && delegateItem.radioPlaylistId
onTriggered: playPlaylist(delegateItem.radioPlaylistId)
}
]
@@ -109,5 +109,18 @@ Kirigami.ScrollablePage {
anchors.centerIn: parent
visible: searchModel.loading
}
Kirigami.PlaceholderMessage {
anchors.centerIn: parent
width: parent.width - (Kirigami.Units.largeSpacing * 4)
visible: parent.count === 0 && !searchModel.loading
text: i18n("Find music on YouTube Music")
helpfulAction: Kirigami.Action {
onTriggered: searchField.forceActiveFocus()
text: i18n("Search")
icon.name: "search"
}
}
}
}
+41 -3
View File
@@ -3,6 +3,8 @@
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
import QtQuick 2.1
import QtQuick.Controls 2.12 as Controls
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.14 as Kirigami
import org.kde.ytmusic 1.0
@@ -10,6 +12,42 @@ import org.kde.ytmusic 1.0
Kirigami.ApplicationWindow {
id: root
property alias searchField: searchField
header: Controls.Control {
visible: !footer.maximized
padding: Kirigami.Units.largeSpacing
background: Rectangle {
width: parent.width
height: parent.height
anchors.fill: parent
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Header
color: Kirigami.Theme.backgroundColor
}
contentItem: RowLayout{
Item {
Layout.fillWidth: true
}
Kirigami.SearchField {
id: searchField
delaySearch: true
selectByMouse: true
Layout.fillWidth: true
Layout.maximumWidth: 400
onAccepted: {
pageStack.clear()
pageStack.push("qrc:/SearchPage.qml", {
"searchQuery": text})
}
}
Item {
Layout.fillWidth: true
}
}
}
title: i18n("AudioTube")
controlsVisible: !footer.maximized
@@ -33,10 +71,10 @@ Kirigami.ApplicationWindow {
UserPlaylistModel.playlistId = playlistId
}
function askPlayVideoAudio(videoId) {
showPassiveNotification(i18n("Video playback is not supported yet."),
function askPlayVideoAudio(videoId, title) {
showPassiveNotification(i18n("Video playback is not supported yet. Do you want to play only the audio of \"%1\"?", title),
"long",
i18n("Play only audio"),
i18n("Play only Audio"),
function() {
play(videoId)
})
+4
View File
@@ -1,2 +1,6 @@
# 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("arte concert");
const auto results = ytm.search("Thomas Bangalter");
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 excaustive visitor";
std::cout << "non exaustive visitor";
}
}, result);
}
+12
View File
@@ -7,6 +7,9 @@
#include <QtQml>
#include <QUrl>
#include <KLocalizedContext>
#include <KLocalizedString>
#include <KCrash>
#include <KAboutData>
#include "searchmodel.h"
#include "albummodel.h"
@@ -15,6 +18,7 @@
#include "userplaylistmodel.h"
#include "errorhandler.h"
#include "playlistmodel.h"
#include "playerutils.h"
constexpr auto URI = "org.kde.ytmusic";
@@ -26,6 +30,11 @@ 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");
@@ -39,6 +48,9 @@ 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")));
+1 -1
View File
@@ -52,7 +52,7 @@ private:
}
}
public:
explicit MultiIterableView(const std::vector<Arguments> &...lists)
explicit MultiIterableView(std::vector<Arguments> &&...lists)
: m_vectors(std::make_tuple(lists...))
{
}
+15
View File
@@ -0,0 +1,15 @@
// 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
@@ -0,0 +1,22 @@
// 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;
};
+2 -13
View File
@@ -11,7 +11,7 @@
#include "playlistutils.h"
PlaylistModel::PlaylistModel(QObject *parent)
: QAbstractListModel(parent)
: AbstractYTMusicModel(parent)
{
connect(this, &PlaylistModel::playlistIdChanged, this, [=] {
setLoading(true);
@@ -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 PlaylistUtils::artistsToString(m_playlist.tracks[index.row()].artists);
return QVariant::fromValue(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);
@@ -76,17 +76,6 @@ void PlaylistModel::setPlaylistId(const QString &playlistId)
Q_EMIT playlistIdChanged();
}
bool PlaylistModel::loading() const
{
return m_loading;
}
void PlaylistModel::setLoading(bool loading)
{
m_loading = loading;
Q_EMIT loadingChanged();
}
QUrl PlaylistModel::thumbnailUrl() const
{
if (m_playlist.thumbnails.empty()) {
+3 -7
View File
@@ -7,7 +7,9 @@
#include <QAbstractListModel>
#include <ytmusic.h>
class PlaylistModel : public QAbstractListModel
#include "abstractytmusicmodel.h"
class PlaylistModel : public AbstractYTMusicModel
{
Q_OBJECT
@@ -15,7 +17,6 @@ class PlaylistModel : public QAbstractListModel
Q_PROPERTY(QString playlistId READ playlistId WRITE setPlaylistId NOTIFY playlistIdChanged REQUIRED)
// output
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl NOTIFY thumbnailUrlChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
@@ -36,10 +37,6 @@ public:
void setPlaylistId(const QString &playlistId);
Q_SIGNAL void playlistIdChanged();
bool loading() const;
void setLoading(bool loading);
Q_SIGNAL void loadingChanged();
QUrl thumbnailUrl() const;
Q_SIGNAL void thumbnailUrlChanged();
@@ -48,7 +45,6 @@ public:
private:
QString m_playlistId;
bool m_loading = false;
playlist::Playlist m_playlist {};
};
+5 -1
View File
@@ -10,7 +10,9 @@
#include <ytmusic.h>
QString PlaylistUtils::artistsToString(const std::vector<meta::Artist> &artists)
namespace PlaylistUtils {
QString artistsToString(const std::vector<meta::Artist> &artists)
{
if (!artists.empty()) {
return std::accumulate(artists.begin() + 1, artists.end(),
@@ -22,3 +24,5 @@ QString PlaylistUtils::artistsToString(const std::vector<meta::Artist> &artists)
return {};
}
}
+2 -6
View File
@@ -11,10 +11,6 @@ namespace meta {
struct Artist;
}
class PlaylistUtils
{
public:
PlaylistUtils() = delete;
static QString artistsToString(const std::vector<meta::Artist> &artists);
namespace PlaylistUtils {
QString artistsToString(const std::vector<meta::Artist> &artists);
};
+6
View File
@@ -1,3 +1,9 @@
<!--
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>
+16 -14
View File
@@ -5,7 +5,7 @@
#include "searchmodel.h"
SearchModel::SearchModel(QObject *parent)
: QAbstractListModel(parent)
: AbstractYTMusicModel(parent)
{
connect(this, &SearchModel::searchQueryChanged, this, [=] {
if (m_searchQuery.isEmpty()) {
@@ -105,6 +105,18 @@ QVariant SearchModel::data(const QModelIndex &index, int role) const
Q_UNREACHABLE();
}
}, m_searchResults.at(index.row())));
case RadioPlaylistId:
return std::visit([&](auto &&arg) {
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, search::Artist>) {
if (arg.radio_id) {
return QString::fromStdString(*arg.radio_id);
}
}
return QString();
}, m_searchResults.at(index.row()));
}
Q_UNREACHABLE();
@@ -118,7 +130,8 @@ QHash<int, QByteArray> SearchModel::roleNames() const
{Title, "title"},
{Type, "type"},
{VideoId, "videoId"},
{Artists, "artists"}
{Artists, "artists"},
{RadioPlaylistId, "radioPlaylistId"},
};
}
@@ -133,17 +146,6 @@ void SearchModel::setSearchQuery(const QString &searchQuery)
Q_EMIT searchQueryChanged();
}
bool SearchModel::loading() const
{
return m_loading;
}
void SearchModel::setLoading(bool loading)
{
m_loading = loading;
Q_EMIT loadingChanged();
}
void SearchModel::triggerItem(int row)
{
std::visit([&](auto&& arg) {
@@ -157,7 +159,7 @@ void SearchModel::triggerItem(int row)
} else if constexpr (std::is_same_v<T, search::Song>) {
Q_EMIT openSong(QString::fromStdString(arg.video_id));
} else if constexpr (std::is_same_v<T, search::Video>) {
Q_EMIT openVideo(QString::fromStdString(arg.video_id));
Q_EMIT openVideo(QString::fromStdString(arg.video_id), QString::fromStdString(arg.title));
} else {
Q_UNREACHABLE();
}
+5 -9
View File
@@ -8,13 +8,13 @@
#include <QThread>
#include "asyncytmusic.h"
#include "abstractytmusicmodel.h"
class SearchModel : public QAbstractListModel
class SearchModel : public AbstractYTMusicModel
{
Q_OBJECT
Q_PROPERTY(QString searchQuery READ searchQuery WRITE setSearchQuery NOTIFY searchQueryChanged)
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
public:
enum Type {
@@ -30,7 +30,8 @@ public:
Title = Qt::UserRole + 1,
Type,
VideoId,
Artists
Artists,
RadioPlaylistId
};
explicit SearchModel(QObject *parent = nullptr);
@@ -43,20 +44,15 @@ public:
void setSearchQuery(const QString &searchQuery);
Q_SIGNAL void searchQueryChanged();
bool loading() const;
void setLoading(bool loading);
Q_SIGNAL void loadingChanged();
Q_INVOKABLE void triggerItem(int row);
Q_SIGNAL void openAlbum(const QString &browseId);
Q_SIGNAL void openArtist(const QString &browseId);
Q_SIGNAL void openPlaylist(const QString &browseId);
Q_SIGNAL void openSong(const QString &videoId);
Q_SIGNAL void openVideo(const QString &videoId);
Q_SIGNAL void openVideo(const QString &videoId, const QString &title);
private:
QString m_searchQuery;
std::vector<search::SearchResultItem> m_searchResults;
bool m_loading = false;
};
+1 -12
View File
@@ -13,7 +13,7 @@
#include "playlistutils.h"
UserPlaylistModel::UserPlaylistModel(QObject *parent)
: QAbstractListModel(parent)
: AbstractYTMusicModel(parent)
{
connect(this, &UserPlaylistModel::initialVideoIdChanged, this, [=] {
if (m_initialVideoId.isEmpty()) {
@@ -98,17 +98,6 @@ void UserPlaylistModel::setInitialVideoId(const QString &videoId)
Q_EMIT initialVideoIdChanged();
}
bool UserPlaylistModel::loading() const
{
return m_loading;
}
void UserPlaylistModel::setLoading(bool loading)
{
m_loading = loading;
Q_EMIT loadingChanged();
}
QString UserPlaylistModel::nextVideoId() const
{
auto currentTrack = std::find_if(m_playlist.tracks.begin(), m_playlist.tracks.end(),
+3 -7
View File
@@ -7,7 +7,9 @@
#include <ytmusic.h>
class UserPlaylistModel : public QAbstractListModel
#include "abstractytmusicmodel.h"
class UserPlaylistModel : public AbstractYTMusicModel
{
Q_OBJECT
@@ -17,7 +19,6 @@ class UserPlaylistModel : public QAbstractListModel
Q_PROPERTY(bool shuffle READ shuffle WRITE setShuffle NOTIFY shuffleChanged)
// output
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
Q_PROPERTY(QString currentVideoId READ currentVideoId NOTIFY currentVideoIdChanged)
Q_PROPERTY(bool canSkip READ canSkip NOTIFY canSkipChanged)
@@ -39,10 +40,6 @@ public:
void setInitialVideoId(const QString &videoId);
Q_SIGNAL void initialVideoIdChanged();
bool loading() const;
void setLoading(bool loading);
Q_SIGNAL void loadingChanged();
QString nextVideoId() const;
QString currentVideoId() const;
@@ -74,7 +71,6 @@ private:
QString m_initialVideoId;
QString m_playlistId;
QString m_currentVideoId;
bool m_loading = false;
bool m_shuffle = false;
watch::Playlist m_playlist;
-1
View File
@@ -33,7 +33,6 @@ VideoInfoExtractor::VideoInfoExtractor(QObject *parent)
});
}
QUrl VideoInfoExtractor::audioUrl() const
{
if (m_videoInfo.formats.empty()) {
+1 -1
View File
@@ -21,7 +21,7 @@ class VideoInfoExtractor : public QObject
Q_PROPERTY(bool loading READ loading WRITE setLoading NOTIFY loadingChanged)
public:
VideoInfoExtractor(QObject *parent = nullptr);
explicit VideoInfoExtractor(QObject *parent = nullptr);
QUrl audioUrl() const;
Q_SIGNAL void audioUrlChanged();
+54 -28
View File
@@ -15,11 +15,46 @@ using namespace py::literals;
#define UNEXPORT __attribute__ ((visibility("hidden")))
constexpr auto TESTED_YTMUSICAPI_VERSION = "0.16.0";
constexpr auto TESTED_YTMUSICAPI_VERSION = "0.18.0";
struct UNEXPORT YTMusicPrivate {
py::scoped_interpreter guard {};
py::object ytmusic;
std::optional<std::string> auth;
std::optional<std::string> user;
std::optional<bool> requests_session;
std::optional<std::map<std::string, std::string> > proxies;
std::string language;
py::object get_ytmusic() {
if (ytmusic.is_none()) {
const auto module = py::module::import("ytmusicapi");
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>();
if (version != TESTED_YTMUSICAPI_VERSION) {
std::cerr << "Running with untested version of ytmusicapi." << std::endl;
std::cerr << "The currently tested and supported version is " << TESTED_YTMUSICAPI_VERSION << std::endl;
}
}
return ytmusic;
}
py::object get_ytdl() {
// lazy initialization
if (ytdl.is_none()) {
ytdl = py::module::import("youtube_dl").attr("YoutubeDL")(py::dict());
}
return ytdl;
}
private:
py::object ytmusic = py::none();
py::object ytdl = py::none();
};
@@ -72,6 +107,10 @@ 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;
@@ -273,16 +312,11 @@ YTMusic::YTMusic(
const std::string &language)
: d(std::make_unique<YTMusicPrivate>())
{
const auto module = py::module::import("ytmusicapi");
d->ytmusic = module.attr("YTMusic")(auth, user, requests_session, proxies, language);
setenv("LC_ALL", "en_US.utf8", true);
const auto version = module.attr("_version").attr("__version__").cast<std::string>();
if (version != TESTED_YTMUSICAPI_VERSION) {
std::cerr << "Running with untested version of ytmusicapi." << std::endl;
std::cerr << "The currently tested and supported version is " << TESTED_YTMUSICAPI_VERSION << std::endl;
}
d->auth = auth;
d->user = user;
d->requests_session = requests_session;
d->proxies = proxies;
d->language = language;
}
YTMusic::~YTMusic() = default;
@@ -293,7 +327,7 @@ std::vector<search::SearchResultItem> YTMusic::search(
const int limit,
const bool ignore_spelling) const
{
const auto results = d->ytmusic.attr("search")(query, filter, limit, ignore_spelling).cast<py::list>();
const auto results = d->get_ytmusic().attr("search")(query, filter, limit, ignore_spelling).cast<py::list>();
std::vector<search::SearchResultItem> output;
for (const auto &result : results) {
@@ -307,7 +341,7 @@ std::vector<search::SearchResultItem> YTMusic::search(
artist::Artist YTMusic::get_artist(const std::string &channel_id) const
{
const auto artist = d->ytmusic.attr("get_artist")(channel_id);
const auto artist = d->get_ytmusic().attr("get_artist")(channel_id);
return artist::Artist {
artist["description"].cast<std::optional<std::string>>(),
artist["views"].cast<std::optional<std::string>>(),
@@ -325,7 +359,7 @@ artist::Artist YTMusic::get_artist(const std::string &channel_id) const
album::Album YTMusic::get_album(const std::string &browseId) const
{
const auto album = d->ytmusic.attr("get_album")(browseId);
const auto album = d->get_ytmusic().attr("get_album")(browseId);
return {
album["title"].cast<std::string>(),
@@ -348,7 +382,7 @@ album::Album YTMusic::get_album(const std::string &browseId) const
song::Song YTMusic::get_song(const std::string &video_id) const
{
const auto song = d->ytmusic.attr("get_song")(video_id);
const auto song = d->get_ytmusic().attr("get_song")(video_id);
return {
song["videoId"].cast<std::string>(),
@@ -380,7 +414,7 @@ song::Song YTMusic::get_song(const std::string &video_id) const
playlist::Playlist YTMusic::get_playlist(const std::string &playlist_id, int limit) const
{
const auto playlist = d->ytmusic.attr("get_playlist")(playlist_id, limit);
const auto playlist = d->get_ytmusic().attr("get_playlist")(playlist_id, limit);
return {
playlist["id"].cast<std::string>(),
@@ -397,7 +431,7 @@ playlist::Playlist YTMusic::get_playlist(const std::string &playlist_id, int lim
std::vector<artist::Artist::Album> YTMusic::get_artist_albums(const std::string &channel_id, const std::string &params) const
{
const auto py_albums = d->ytmusic.attr("get_artist_albums")(channel_id, params);
const auto py_albums = d->get_ytmusic().attr("get_artist_albums")(channel_id, params);
std::vector<artist::Artist::Album> albums;
std::transform(py_albums.begin(), py_albums.end(), std::back_inserter(albums), [](py::handle album) {
@@ -417,15 +451,7 @@ video_info::VideoInfo YTMusic::extract_video_info(const std::string &video_id) c
{
using namespace pybind11::literals;
// lazy initialization
if (d->ytdl.is_none()) {
const auto module = py::module::import("youtube_dl");
py::dict options;
d->ytdl = module.attr("YoutubeDL")(options);
}
const auto info = d->ytdl.attr("extract_info")(video_id, "download"_a=py::bool_(false));
//py::print(py::module::import("json").attr("dumps")(info, "indent"_a=4));
const auto info = d->get_ytdl().attr("extract_info")(video_id, "download"_a=py::bool_(false));
return {
info["id"].cast<std::string>(),
@@ -440,7 +466,7 @@ watch::Playlist YTMusic::get_watch_playlist(const std::optional<std::string> &vi
int limit,
const std::optional<std::string> &params) const
{
const auto playlist = d->ytmusic.attr("get_watch_playlist")("videoId"_a = videoId,
const auto playlist = d->get_ytmusic().attr("get_watch_playlist")("videoId"_a = videoId,
"playlistId"_a = playlistId,
"limit"_a = py::int_(limit),
"params"_a = params);