Commit Graph

336 Commits

Author SHA1 Message Date
kentsangkm 6982b47819 Search song from Spotify via web api 2021-07-18 10:45:10 +01:00
Jonas Kvinge 320a1b81c9 Fix incorrect use of QFutureWatcher
To avoid a race condition, it is important to call setFuture() after doing the connections.

See: https://doc.qt.io/qt-6/qfuturewatcher.html
2021-07-14 10:18:15 +01:00
Jim Broadus 1309c76bec tagreader: Relocate artist/album/title guessing code
Move the code that attempts to fill missing song metadata out of the
tagreader worker. In the main process, it will be controllable using
settings and calling context.

The methods were moved into a new SongPathParser class that checks new
settings to determine if action should be taken.
2021-05-17 13:20:34 +01:00
Jim Broadus 9a337a9efc logging: Fix {anonymous} class name.
If the __PRETTY_FUNCTION__ macro yields {anonymous} as the class name,
use the method name as the tag.
2021-05-03 14:44:19 +01:00
Jim Broadus 59f6d95b80 clementine-tagreader: Fix addDefaultCaCertificates deprecation
QSslSocket::addDefaultCaCertificates is deprecated in 5.15. Use
QSslConfiguration default configuration instead.
2021-04-22 11:23:50 +01:00
Jim Broadus 5f75bde396 libclementine-common: Use positive numbers for worker ids.
QRandomGenerator::generate() returns an unbounded int32, while the legacy
qrand method always returned a positive number. When generating a tag
reader ID with QRandomGenerator, cast the random value to an unsigned so
that it is formatted as a positive number in the name.

Note that most usages of QRandomGenrator in the codebase use bounded()
instead of generate(), and should work as expected.
2021-04-22 11:21:08 +01:00
Jim Broadus 73c0af1977 Remove expired Equifax CA root
The Equifax certificate expired in 2018, so any certificate that was
signed by that CA should also be expired.
2021-04-21 10:24:53 +01:00
Jim Broadus f04657e7e7 Replace qrand usage with QRandomGenerator
QRandomGenerator was introduced in 5.10 and qrand has since been
deprecated. QRandomGenerator::global() returns a global instance that
has been securely seeded. QRandomGenerator provides methods that
generate values within ranges, so taking a modulus of the result isn't
necessary.
2021-04-20 10:31:07 +01:00
Jim Broadus 429d8ee0f9 core/logging: Fix QString::split deprecation
QString::SplitBehavior is deprecated in 5.14. Use Qt::SplitBehavior
after this version.
2021-04-19 10:25:31 +01:00
Jim Broadus 163ebe71d8 libclementine-tagreader: Discontinue use of deprecated taglib methods.
Direct use of MP4::itemListMap() was deprecated in favor of using item() and
setItem(). XiphComment::removeField was replaced by removeFields.
2021-04-18 13:48:13 +01:00
Jim Broadus 8b2f7f08ae ext: Remove depencency on src
Remove /src from all include paths in /ext.
2021-03-17 18:26:51 +00:00
Jim Broadus cd41f706af libclementine-common: Move timeconstants.h to common location
This header is used by code in /ext, so move it out of /src. This is the
last /ext dependency on /src.
2021-03-17 18:26:51 +00:00
Jim Broadus af75ebbd6f libclementine-common: Mac: Fix exec search path
workerpool.h utilizes the MAC-specific USE_BUNDLE option, but the file
didn't directly include the config header file. Cleanup change 341dc73
reordered some headers, so it was no longer included as a side-effect
either.
2021-03-16 09:30:56 +00:00
Jim Broadus c974b8b6f2 build: Don't include src/config.h from ext
Include the global /include/clementine-config.h rather than src/config.h
from /ext.

Note that this does not fully remove the dependencies on src from ext.
2021-03-16 09:30:56 +00:00
Jim Broadus e479206c45 tagreader: Follow redirects when downloading file
Set the QNetworkRequest::FollowRedirectsAttribute attribute to true.
This should be changed to use RedirectPolicyAttribute when all supported
platforms move to 5.9 or greater. Stretch is at 5.7.
2021-02-26 11:18:49 +00:00
Jim Broadus 1a3828e2c1 protobuf: Fix namespace conflict
Protobuf 3.15 adds a namespace alias for "pb" that conflicts with
Clementine's. Modify Clementine to use "cpb".

Patch provided by @ahesford

Reference: 5c028d6cf4/src/google/protobuf/port.h (L44)
2021-02-21 14:17:26 +00:00
Matthieu Bruel 9714b0632d All changes for ClemRemote v1.0 (in one go) 2020-12-17 12:23:30 +00:00
Robert-André Mauchin cfcd0a956e Drop -std=c++0x and -U__STRICT_ANSI__
This was causing compilation failures, static assertion failed, with GCC 11.

Fix #6865

Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
2020-12-17 11:28:09 +00:00
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
dmdmdm 834b1d4514 Changed local variable names to be like_this 2020-07-08 18:01:59 +01:00
dmdmdm 0ff11ee2e0 Autoformated code 2020-07-08 18:01:59 +01:00
dmdmdm d3a28a40ed Shortened a line 2020-07-08 18:01:59 +01:00
dmdmdm 2c5c30de15 Guess album name from folder name 2020-07-08 18:01:59 +01:00
dmdmdm 40575e854e Fixed one indent 2020-05-24 15:54:08 +01:00
dmdmdm 0f2e8946d6 Made parameter const 2020-05-24 15:54:08 +01:00
dmdmdm 86b48c22ae Minor fixes 2020-05-24 15:54:08 +01:00
dmdmdm c8eaafb0a8 Switch from std::string to QString 2020-05-24 15:54:08 +01:00
dmdmdm fb262022f4 Switch from std::string to QString 2020-05-24 15:54:08 +01:00
dmdmdm be60c12438 Guess artist and title (fourth attempt) 2020-05-24 15:54:08 +01:00
dmdmdm 9b580e4a5c Guess artist and title from filename (third attempt) 2020-05-24 15:54:08 +01:00
dmdmdm ddbde91889 Guess artist and title from filename (second attempt) 2020-05-24 15:54:08 +01:00
Jim Broadus 5b918a70aa Add an optional delete function for Lazy pointers.
This allows a delete function to be provided with the prototype: void d(T*)
This function is passed to the unique_ptr constructor to be used when the object
is released. The default function simply deletes the object, where the default
behavior for unique_ptr would have a specialization for arrays. If Lazy is ever
used with arrays, a delete function should be provided.
2020-05-19 10:39:06 +01:00
Jim Broadus 0ecb773355 Handle lyrics tag for mp4
Translation table in mp4tag.cpp for reference.
2020-04-19 14:01:25 +01:00
Jim Broadus 509c65ced7 tagreader: Add debug handler for taglib
Pass taglib debug messages through qLog instead of printing directly to stderr.
2020-04-19 14:00:35 +01:00
Jim Broadus 902522f4d3 Fix Qt generated log messages.
To avoid infinite recursion, Qt prevents a log generated from an installed
message handler from being handled by that same handler. So when a Qt message
is handled, the logging magic (__logging_message__) that is added by
CreateLogger, and is expected to be detected and stripped by the handler, is
instead dumped to the log.

Instead of sending the Qt messages back through the logging system, use a new
BufferedDebug to build the log message in a buffer, then immeiately print the
buffer to stderr.
2020-03-07 02:41:56 +00:00
Jim Broadus 09723d516c Use a template for CreateLogger to allow different QDebug derivatives. 2020-03-07 02:41:56 +00:00
Jim Broadus 79ac16afeb Move unneeded declarations and macros from logging header.
Some functions and macros aren't used outside of logging.cpp and don't need be
declared in header. Functions can be static.
2020-03-06 11:09:20 +00:00
Jim Broadus 52fd6ffadc Add a logging category to log all network requests.
New logging class NetworkRequests disabled by default, but can be enabled with
the command line option.
2020-02-13 11:09:51 +00:00
Jim Broadus d45a9f5c53 Enable debug logging for GstEnginePipeline by default.
Use qLogCat to put verbose GStreamer callback messages into a new
GstEnginePipelineCallbacks category. Filter that category instead of
the entire class by default.
2020-01-31 10:24:53 +00:00
Jim Broadus 4b37e0c577 Use qLogCat for GLog handler.
Provide the domain string from the GLog callback as the category.
2020-01-30 11:20:03 -08:00
Jim Broadus a2d2850884 Add a new qLogCat macro to specify category.
In some cases, such as message handling callback functions, the line and function
macros don't provide a lot of useful information. In other cases, we may want more
granularity of control withing a class. For these cases, add a qLogCat that takes
a category string. Print this string in the message and use it as the filter
category.
2020-01-30 11:19:58 -08:00
Jim Broadus 203d6425fd Fix nomenclature in logging functions.
The qLog macro passes the result of the __PRETTY_FUNCTION__ macro to the
CreateLogger* functions, but these all take an argument called class_name.
2020-01-30 08:50:06 -08:00
Jim Broadus dbe67bf32b Fix closure timing hole.
When a closure involves an ObjectHelper, a connection is made from the
receiver's destroyed signal and the helper object's deleteLater slot. Since
the signal between the sender and the helper object isn't disconnected until
either object is actually destroyed, this leaves a hole where the helper
holds a pointer to an invalid receiver object, but is still able to receive
the signal connected to its Invoke slot.

Instead of connecting the destroyed signal to deleteLater, connect it to a new
TearDown slot that immediately disconnects the signal then calls deleteLater.
2020-01-11 00:53:35 -08:00
Jonas Kvinge 79e7c2a1fa Add check for valid birthTime() 2019-11-13 19:10:39 +01:00
Jonas Kvinge c23a251ec3 Fix setting mtime/btime in tagreader 2019-11-13 18:47:27 +01:00
John Maguire 04c85c2bb7
Merge pull request #6433 from clementine-player/qt5
Qt5
2019-11-07 12:27:25 +00:00
Ulrich Spörlein 6e2506e94a Fix Clementine on FreeBSD/NFS files, where birthtime is always -1
As of Qt 5.10 the badly named created() which would fall back to POSIX
ctime if birthtime wasn't supported (as was the case on basically every
Unix filesystem up to some decades ago) is deprecated and replaced by
the better named birthTime or metadataChangeTime (yay!).

As of some years now, created() returns birthtime under FreeBSD, but
either due to the protocol or lack of implementation, this returns -1
under FreeBSD mounting a ZFS pool from a FreeBSD server with NFSv3.

This would render Clementine completely useless. Local filesystems are
not affected though. The fix is to catch the -1 birthtime and use mtime
instead, which is a more meaningful value anyway.

This closes issue #6423.
2019-10-27 22:52:36 +01:00
John Maguire cb6cd7c485 Merge remote-tracking branch 'origin/master' into qt5 2019-10-04 16:51:43 +01:00
luz.paz fb93ae4b02 Fix misc. source comment typos
Typos found via `codespell`
2019-08-21 23:43:16 -04:00
Ronan Jouchet 483be6ef7c Fix ratings not saved to file tag (Fix #6385)
Commit 96a7e18a8d by @smithjd15 from
2019-04-03 fixed a number of potential zero-value field values, but it
also flipped the early exit condition skipping saving a rating to file.

It seems out of place with the rest of the commit, so considering it a
mistake and reverting to the original condition.

Manually tested; works and saves again ratings to file.
2019-08-09 03:09:17 +02:00