Skip to content

MEGA internet service using mega-sdk#7435

Open
githubmailsma wants to merge 3 commits intoclementine-player:masterfrom
githubmailsma:mega-internet-service
Open

MEGA internet service using mega-sdk#7435
githubmailsma wants to merge 3 commits intoclementine-player:masterfrom
githubmailsma:mega-internet-service

Conversation

@githubmailsma
Copy link
Copy Markdown

A fully working MEGA internet service, comparable to Google Drive and other cloud storage providers, allowing users to:

  • Connect to their MEGA account
  • Select MEGA folders to sync mp3s from
  • Scan folders, refresh the folder list, or reset the local database
  • Auto-select all folders in which MP3 are found
    Includes a settings page where the user can enter their email and password, and a service layer to handle the calls to the SDK.

@hatstand
Copy link
Copy Markdown
Contributor

hatstand commented Mar 4, 2026

Can you accomplish this without git submodules?

// MEGA SDK application key. Provide your own via -DMEGA_API_KEY="yourkey"
// at CMake configure time. Register at https://mega.nz/sdk to obtain one.
#ifndef MEGA_API_KEY
#define MEGA_API_KEY ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense for Clementine to have one rather than expecting users to recompile?

MegaService::~MegaService() {
// Stop the streaming server if running.
if (streaming_port_ > 0) {
mega_api_->httpServerStop();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably needs to hold the lock?

// Whether we are currently logged in and nodes are fetched.
bool logged_in_;

// Mutex for thread-safe access to streaming state.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to clear about exactly what this lock is intended to protect. Is it just all access to mega_api_?

}

void MegaService::BuildFolderTree(mega::MegaNode* node,
QList<MegaFolderInfo>& list) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a pointer instead of a non-const reference to make the mutable input parameter more obvious.

return result;
}

bool MegaService::CollectFoldersWithAudio(mega::MegaNode* node,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it simpler to return QSet<QString> with the implication that has_audio == x.isEmpty()?

ui_->email->setText(email);
ui_->password->setText(password);

if (!email.isEmpty() && !password.isEmpty()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this still work given you wipe the password after login?

// MegaService Credential Tests
// ============================================================================

class MegaServiceCredentialTest : public ::testing::Test {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only validating the behaviour of QSettings rather than any of our code.

// Mega URL Scheme Tests
// ============================================================================

class MegaUrlSchemeTest : public ::testing::Test {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of these are only testing QUrl

// Mega Folder Selection Persistence Tests
// ============================================================================

class MegaFolderSelectionTest : public ::testing::Test {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this is just testing QSettings.

// Mega URL Handle Extraction Tests
// ============================================================================

class MegaHandleExtractionTest : public ::testing::Test {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these aren't testing anything.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants