MCPcopy Create free account
hub / github.com/Moosync/Moosync / initialize

Method initialize

src-tauri/src/providers/youtube.rs:483–514  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

481impl GenericProvider for YoutubeProvider {
482 #[tracing::instrument(level = "debug", skip(self))]
483 async fn initialize(&self) -> Result<()> {
484 let _ = self
485 .status_tx
486 .lock()
487 .await
488 .send(self.get_provider_status(None).await)
489 .await;
490
491 let preferences: State<PreferenceConfig> = self.app.state();
492 let youtube_config: Value = preferences
493 .inner()
494 .load_selective("youtube".into())
495 .unwrap_or_default();
496
497 tracing::info!("{:?}", youtube_config);
498 let client_id = youtube_config.get("client_id");
499 let client_secret = youtube_config.get("client_secret");
500
501 *self.config.lock().await = YoutubeConfig {
502 client_id: client_id.map(|v| v.as_str().unwrap().to_string()),
503 client_secret: client_secret.map(|v| v.as_str().unwrap().to_string()),
504 redirect_uri: "https://moosync.app/youtube",
505 scopes: vec!["https://www.googleapis.com/auth/youtube.readonly"],
506 };
507
508 let res = self.refresh_login().await;
509 if let Err(err) = res {
510 tracing::error!("youtube refresh login err: {:?}", err);
511 }
512
513 Ok(())
514 }
515
516 #[tracing::instrument(level = "debug", skip(self))]
517 async fn get_provider_scopes(&self) -> Result<Vec<ExtensionProviderScope>> {

Callers 4

initialize_providerMethod · 0.45
initialize_librespotFunction · 0.45

Calls 5

sendMethod · 0.80
load_selectiveMethod · 0.80
getMethod · 0.80
get_provider_statusMethod · 0.45
refresh_loginMethod · 0.45

Tested by

no test coverage detected