Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Dummy pull request for comments / review #1

Closed
wants to merge 34 commits into from

3 participants

@lfranchi
Owner

No description provided.

AltarBeastiful and others added some commits
@AltarBeastiful AltarBeastiful Add KQOauth lib in thirdparty. 6225ee8
@AltarBeastiful AltarBeastiful Add empty Dropbox account manager and config ui. abaaf03
@AltarBeastiful AltarBeastiful Add all parameters returned along with the OAuth token received in th…
…e signals accesToken and temporaryToken.
ab825ba
@AltarBeastiful AltarBeastiful Merge branch 'master' of https://github.com/tomahawk-player/tomahawk
Conflicts:
	src/libtomahawk/CMakeLists.txt
5a55a63
@AltarBeastiful AltarBeastiful Change the dropbox SVG icon to a lighter one. d9c9a70
@AltarBeastiful AltarBeastiful Add the link with the custom dropbox account and the JS resolver.
Add a layout to DropboxConfig.ui
9122e1e
@AltarBeastiful AltarBeastiful Add the possibility for JS resolvers to register for signals on their…
… config.ui.

Remove custom Dropbox account factory from QtResolver.
1831838
@AltarBeastiful AltarBeastiful Remove Dropbox custom account manager from tomahawk. ac82eac
@AltarBeastiful AltarBeastiful Add method to load an external JS file from the resolver folder. 92b70fb
@AltarBeastiful AltarBeastiful Add a method to request a QWebView from a JS resolver. 2f3a2e5
@AltarBeastiful AltarBeastiful Add Asynch POST request to tomahawk.js dc08224
@AltarBeastiful AltarBeastiful Merge remote-tracking branch 'tomaOrigin/master'
Conflicts:
	resources.qrc
dd0f6d0
@AltarBeastiful AltarBeastiful Merge remote-tracking branch 'tomaOrigin/master' 80f8a4d
@AltarBeastiful AltarBeastiful Merge remote-tracking branch 'tomaOrigin/master' 4fb4612
@AltarBeastiful AltarBeastiful Add bind function in tomahawk.js 16b636e
loclamor add a cloudstream class to manage cloud stream ; add a Q_INVOKABLE me…
…thode in QtScriptResolver to parse ID3Tags from a stream ; modify cmake configuration to use taglib 1.8 at least
170a926
loclamor merge resolution on QtScriptResolver cf0bbcb
@AltarBeastiful AltarBeastiful Change QtScriptResolverHelper::customIODeviceFactory to accept url wi…
…th HTTP headers.
1ad944d
@AltarBeastiful AltarBeastiful Merge branch 'master' of github.com:ISI-Peasy/tomahawk a1eef2a
@loclamor loclamor update of cloudStream reader 6bf196c
@AltarBeastiful AltarBeastiful Fix errors in parsing of ID3 tags (ReadCloudFile) b43e45a
@loclamor loclamor messages de debug sur les headers d196528
@loclamor loclamor ajout du parametre ID a readCloudFile d965af2
@loclamor loclamor ajout du parametre fileID a redCloudFile 5479175
@loclamor loclamor header authorization replacement 6950daa
@loclamor loclamor tentative de modification du oaut_nonce 013edb6
@AltarBeastiful AltarBeastiful Add synchronous post request to tomahawk.js c8522b7
@AltarBeastiful AltarBeastiful QwebInspector for Javascript resolvers. 78351e0
@AltarBeastiful AltarBeastiful Merge branch 'master' of https://github.com/tomahawk-player/tomahawk 8081cf4
@AltarBeastiful AltarBeastiful Extra headers and error message for Tomahawk.synchrequest 72fb384
@AltarBeastiful AltarBeastiful Change error test for duration of a track 0ff9909
@AltarBeastiful AltarBeastiful Merge branch 'feature/id3tag' ab46933
@AltarBeastiful AltarBeastiful Merge branch 'master', remote-tracking branch 'tomaOrigin/master' 142237c
@lfranchi Merge branch 'master' into isi d5dd4d7
@lfranchi lfranchi commented on the diff
data/js/tomahawk.js
((16 lines not shown))
xmlHttpRequest.send(null);
if (xmlHttpRequest.status == 200){
return xmlHttpRequest.responseText;
+ }else if (xmlHttpRequest.readyState === 4) {
@lfranchi Owner

Javascript coding style---please put spaces after } :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
data/js/tomahawk.js
((22 lines not shown))
}
};
+Tomahawk.syncPostRequest = function(url, params, extraHeaders)
@lfranchi Owner

Might be good to call this syncFormPostRequest, as it x-www-form-urlencodes things. Is there no body to the POST?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
data/js/tomahawk.js
@@ -387,6 +449,29 @@ Tomahawk.sha256=function(s){
};
+if (!Function.prototype.bind) {
@lfranchi Owner

nitpick---is this taken from somewhere? Would be good to reference it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
((8 lines not shown))
#include <boost/bind.hpp>
+//--- includes readcloudFile
+//#include "taghandlers/tag.h"
+# include "utils/cloudstream.h"
@lfranchi Owner

Capitalization :)

what do you mean here ?

@lfranchi Owner

we CapitalizeFiles.cpp like this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
@@ -60,6 +100,7 @@
{
m_scriptPath = scriptPath;
m_resolver = parent;
+ network = new QNetworkAccessManager(this);
@lfranchi Owner

We have TomahawkUtils::nam(), do you need a new one here?

maybe not, i'll look about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
@@ -314,19 +355,208 @@
}
+void
+QtScriptResolverHelper::ReadCloudFile(const QString& fileName, const QString& fileId, const QString& sizeS, const QString& mime_type, const QVariant& requestJS, const QString& javascriptCallbackFunction)
@lfranchi Owner

Style :)

This goes for this file and the rest of the pull request---please follow the Tomahawk coding style. That means (look at other files for guidance):

  • Spaces between ()
  • { and } on new lines
  • return type on new line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
((24 lines not shown))
+ }
+ else
+ {
+ download_url = QUrl(requestJS.toString());
+ }
+
+ tDebug( LOGINFO ) << "#### ReadCloudFile : Loading tags of " << fileName << " from " << download_url.toString() << " which have id " << fileId;
+
+
+ m["fileId"] = fileId;
+ m["mimetype"] = mime_type.toUtf8();
+
+
+ CloudStream* stream = new CloudStream(
+ download_url, fileName, size, headers, network);
+ stream->Precache();
@lfranchi Owner

Is this blocking?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
((110 lines not shown))
+ }
+/* if (tag->tag()->albumArtist()) {
+ m["albumartist"] = tag->tag()->albumArtist();
+ }
+ if (tag->tag()->composer()) {
+ m["composer"] = tag->tag()->composer();
+ }
+ if (tag->tag()->discNumber() != 0) {
+ m["discnumber"] = tag->tag()->discNumber();
+ }
+*/
+ }
+
+ QString tabTagsJSON = "{";
+ //we convert the QVariantMap to JSON to give it as an argument of the callback function
+ int nbTags = m.count();
@lfranchi Owner

Please use QJson::Serializer instead of hand-coding this :)

this is corrected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
((140 lines not shown))
+
+ m_resolver->m_engine->mainFrame()->evaluateJavaScript( getUrl );
+}
+
+
+void
+QtScriptResolverHelper::addLocalJSFile( const QString &jsFilePath )
+{
+ m_resolver->m_engine->mainFrame()->evaluateJavaScript( readRaw(jsFilePath) );
+}
+
+
+void
+QtScriptResolverHelper::requestWebView(const QString &varName, const QString &url)
+{
+ QWebView *view = new QWebView();
@lfranchi Owner

What do you need this for?

This is the OAuth webpage we redirect the user to accept our app in googleDrive/Dropbox.

Another solution is to open the default webbrowser, which one do you prefer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
((154 lines not shown))
+{
+ QWebView *view = new QWebView();
+ view->load(QUrl(url));
+
+ //TODO: move this to JS.
+ view->setWindowModality(Qt::ApplicationModal);
+
+ m_resolver->m_engine->mainFrame()->addToJavaScriptWindowObject(varName, view);
+}
+
+void
+QtScriptResolverHelper::showWebInspector()
+{
+ QWebInspector *inspector = new QWebInspector;
+ inspector->setPage(m_resolver->m_engine);
+ inspector->show();
@lfranchi Owner

Likewise, is this just for debugging internally?

Yeah, it was supposed to! Never got it working and as it was at the end of the implementation of the resolvers we sticked with logging and bashing heads on the wall.
I'm going to see if it cannot work, as it would be really useful to create new resolvers.
For now we only have "TypeError: 'undefined' is not a function" 0 "undefined" which is kinda thin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.cpp
((179 lines not shown))
QString getUrl = QString( "Tomahawk.resolver.instance.%1( '%2' );" ).arg( m_urlCallback )
.arg( QString( QUrl( result->url() ).toEncoded() ) );
- QString urlStr = m_resolver->m_engine->mainFrame()->evaluateJavaScript( getUrl ).toString();
+ QVariant jsResult = m_resolver->m_engine->mainFrame()->evaluateJavaScript( getUrl ).toString();
+
+ if(jsResult.type() == QVariant::Map)
@lfranchi Owner

I don't like how we have 2 different return value types (string or map)... can we standardize on a QVariantMap (and require a url parameter)?

I'd like that too. However changing this would impact all resolvers with a custom url handler ! Maybe push this version first, update all resolvers, then change to QVariantMap only?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.h
@@ -59,6 +64,17 @@ class DLLEXPORT QtScriptResolverHelper : public QObject
Q_INVOKABLE QByteArray base64Encode( const QByteArray& input );
Q_INVOKABLE QByteArray base64Decode( const QByteArray& input );
+
+ // send ID3Tags of the stream as argument of the callback function
+ Q_INVOKABLE void
+ ReadCloudFile(const QString& fileName, const QString& fileId, const QString& sizeS, const QString& mime_type, const QVariant& requestJS, const QString& javascriptCallbackFunction);
@lfranchi Owner

camelCase please :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/resolvers/QtScriptResolver.h
@@ -87,6 +103,7 @@ class DLLEXPORT QtScriptResolverHelper : public QObject
#ifdef QCA2_FOUND
QCA::Initializer m_qcaInit;
#endif
+ QNetworkAccessManager* network;
@lfranchi Owner

You shouldn't need this (see comment above), but anyway instance variables should be prefixed with m_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi lfranchi commented on the diff
src/libtomahawk/utils/cloudstream.cpp
((164 lines not shown))
+ // than the raw data so we must disable compression.
+ if (url_.host() == "files.one.ubuntu.com") {
+ request.setRawHeader("Accept-Encoding", "identity");
+ }
+
+ //tDebug() << request.rawHeader("Authorization");
+ tDebug() << "######## CloudStream : HTTP request : ";
+ foreach(const QByteArray& header, request.rawHeaderList()){
+ tDebug() << "#### CloudStream : header request : " << header << " = " << request.rawHeader(header);
+ }
+
+ QNetworkReply* reply = network_->get(request);
+ connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(SSLErrors(QList<QSslError>)));
+ ++num_requests_;
+
+ QEventLoop loop;
@lfranchi Owner

Do you need this to be blocking/synchronous? I know this is hatstand's code and not yours, but maybe clementine had a different requirement. Remember that any blocking call in JS in our resolvers will block the main UI thread because QtWebkit is run on the main thread.

Any net requests (especially slow ones like this!) have the potential to lock up the UI so should be async :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@lfranchi
Owner

What do you need kqoauth for? I would rather avoid including it if possible... I want to rope @jefferai into this conversation, but basically OAuth2 is not really standard, and each site implements it slightly differently. What do you need this for, and will it over all the user cases we have for it (all services we might want)?

@AltarBeastiful

Ya actually kqoauth is gonna disappear, part of an old proof on concept. All oauth is implemented in the resolvers.

@lfranchi lfranchi referenced this pull request in tomahawk-player/tomahawk-resolvers
Open

Google Drive and Dropbox resolvers #41

@lfranchi lfranchi closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 10, 2013
  1. @AltarBeastiful
  2. @AltarBeastiful
  3. @AltarBeastiful

    Add all parameters returned along with the OAuth token received in th…

    AltarBeastiful authored
    …e signals accesToken and temporaryToken.
  4. @AltarBeastiful

    Merge branch 'master' of https://github.com/tomahawk-player/tomahawk

    AltarBeastiful authored
    Conflicts:
    	src/libtomahawk/CMakeLists.txt
Commits on Feb 11, 2013
  1. @AltarBeastiful
  2. @AltarBeastiful

    Add the link with the custom dropbox account and the JS resolver.

    AltarBeastiful authored
    Add a layout to DropboxConfig.ui
Commits on Feb 14, 2013
  1. @AltarBeastiful

    Add the possibility for JS resolvers to register for signals on their…

    AltarBeastiful authored
    … config.ui.
    
    Remove custom Dropbox account factory from QtResolver.
  2. @AltarBeastiful
Commits on Feb 17, 2013
  1. @AltarBeastiful
Commits on Feb 19, 2013
  1. @AltarBeastiful
Commits on Feb 20, 2013
  1. @AltarBeastiful
  2. @AltarBeastiful

    Merge remote-tracking branch 'tomaOrigin/master'

    AltarBeastiful authored
    Conflicts:
    	resources.qrc
  3. @AltarBeastiful
Commits on Feb 24, 2013
  1. @AltarBeastiful
  2. @AltarBeastiful
Commits on Feb 26, 2013
  1. add a cloudstream class to manage cloud stream ; add a Q_INVOKABLE me…

    loclamor authored
    …thode in QtScriptResolver to parse ID3Tags from a stream ; modify cmake configuration to use taglib 1.8 at least
  2. merge resolution on QtScriptResolver

    loclamor authored
  3. @AltarBeastiful
  4. @AltarBeastiful
Commits on Feb 27, 2013
  1. @loclamor

    update of cloudStream reader

    loclamor authored
  2. @AltarBeastiful
  3. @loclamor
Commits on Feb 28, 2013
  1. @loclamor
  2. @loclamor
  3. @loclamor
  4. @loclamor
  5. @AltarBeastiful
Commits on Mar 4, 2013
  1. @AltarBeastiful
Commits on Mar 6, 2013
  1. @AltarBeastiful
  2. @AltarBeastiful
  3. @AltarBeastiful
Commits on Mar 7, 2013
  1. @AltarBeastiful
Commits on Mar 19, 2013
  1. @AltarBeastiful
Commits on Mar 20, 2013
Something went wrong with that request. Please try again.