History

Upload QByteArray

EdgarPironti committed 10 years ago

Commit 1db6d0e1 parent 1b18d362 files · +8 −16Browse files

Showing the changes to libraries/script-engine/src/RecordingScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

libraries/script-engine/src/RecordingScriptingInterface.cpp+8−13
@@ -177,8 +177,7 @@ void RecordingScriptingInterface::saveRecording(const QString& filename) { · 176 unmodified lines
177177 }
178178
179179 bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUrl) {
180−
181− if (!getClipAtpUrl.isFunction())
180+ if (!getClipAtpUrl.isFunction())
182181 return false;
183182
184183 if (QThread::currentThread() != thread()) {
@@ -192,13 +191,14 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr · 7 unmodified lines
192191 return false;
193192 }
194193
195− QString filename = "./temp.hfr";
196− recording::Clip::toFile(filename, _lastClip);
197−
198− QUrl url{ filename };
194+ //QString filename = "./temp.hfr";
195+ //recording::Clip::toFile(filename, _lastClip);
199196
200− if (auto upload = DependencyManager::get<AssetClient>()->createUpload(url.toLocalFile())) { // Here we should use the other implementation of createUpload, but we need the QByteArray of the _lastClip
197+ //QUrl url{ filename };
201198
199+ //if (auto upload = DependencyManager::get<AssetClient>()->createUpload(url.toLocalFile())) {
200+
201+ if (auto upload = DependencyManager::get<AssetClient>()->createUpload(recording::Clip::toBuffer(_lastClip), HFR_EXTENSION)) {
202202 QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
203203 auto filename = QFileInfo(upload->getFilename()).fileName();
204204 QString clip_atp_url = "";
@@ -215,18 +215,13 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr · 10 unmodified lines
215215 args << clip_atp_url;
216216 getClipAtpUrl.call(QScriptValue(), args);
217217 });
218−
219− // start the upload now
220218 upload->start();
221219 return true;
222−
223− }
220+ }
224221
225222 return false;
226−
227223 }
228224
229−
230225 void RecordingScriptingInterface::loadLastRecording() {
231226 if (QThread::currentThread() != thread()) {
232227 QMetaObject::invokeMethod(this, "loadLastRecording", Qt::BlockingQueuedConnection);