mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Add Tomahawk.assert to JS bindings
This commit is contained in:
@@ -409,6 +409,10 @@ Tomahawk.asyncRequest = function (url, callback, extraHeaders, options) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Tomahawk.assert = function (assertion, message) {
|
||||||
|
Tomahawk.nativeAssert(assertion, message);
|
||||||
|
}
|
||||||
|
|
||||||
Tomahawk.sha256 = Tomahawk.sha256 || CryptoJS.SHA256;
|
Tomahawk.sha256 = Tomahawk.sha256 || CryptoJS.SHA256;
|
||||||
Tomahawk.md5 = Tomahawk.md5 || CryptoJS.MD5;
|
Tomahawk.md5 = Tomahawk.md5 || CryptoJS.MD5;
|
||||||
// Return a HMAC (md5) signature of the input text with the desired key
|
// Return a HMAC (md5) signature of the input text with the desired key
|
||||||
|
@@ -460,6 +460,17 @@ JSResolverHelper::reportStreamUrl( const QString& qid, const QString& streamUrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void JSResolverHelper::nativeAssert(bool assertion, const QString& message)
|
||||||
|
{
|
||||||
|
if ( !assertion )
|
||||||
|
{
|
||||||
|
tLog() << "Assertion failed" << message;
|
||||||
|
Q_ASSERT( assertion );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JSResolverHelper::customIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
JSResolverHelper::customIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
||||||
std::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
std::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback )
|
||||||
|
@@ -60,6 +60,11 @@ public:
|
|||||||
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl );
|
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl );
|
||||||
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl, const QVariantMap& headers );
|
Q_INVOKABLE void reportStreamUrl( const QString& qid, const QString& streamUrl, const QVariantMap& headers );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make Tomahawk assert the assertion is true, probably not to be used by resolvers directly
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void nativeAssert( bool assertion, const QString& message = QString() );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve metadata for a media stream.
|
* Retrieve metadata for a media stream.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user