Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'easy-yt-subscription'
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmiddiii committed Oct 15, 2021
2 parents d63bc90 + 68a4727 commit b6991df
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 65 deletions.
94 changes: 45 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ env_logger = "0.9.0"

image = "0.23.14"

tf_core = { package = "tf_core", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_join = { package = "tf_join", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_filter = { package = "tf_filter", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_observer = { package = "tf_observer", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_playlist = { package = "tf_playlist", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_yt = { package = "tf_platform_youtube", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_pt = { package = "tf_platform_peertube", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_lbry = { package = "tf_platform_lbry", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "d18735f502fc8ff46ac8505df268fdd541d96902" }
tf_core = { package = "tf_core", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
tf_join = { package = "tf_join", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
tf_filter = { package = "tf_filter", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
tf_observer = { package = "tf_observer", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
tf_playlist = { package = "tf_playlist", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
tf_yt = { package = "tf_platform_youtube", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
tf_pt = { package = "tf_platform_peertube", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
tf_lbry = { package = "tf_platform_lbry", git = "https://github.com/Tubefeeder/tubefeeder-extractor.git", rev = "005777524e7018e194e859312d7517a187f18ef1" }
18 changes: 10 additions & 8 deletions src/gui/subscriptions/subscription_adder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ use gtk::prelude::*;
use relm::{Relm, Widget};
use relm_derive::{widget, Msg};
use tf_join::{AnySubscription, AnySubscriptionList, Platform};
use tf_lbry::LbrySubscription;
use tf_pt::PTSubscription;
use tf_yt::YTSubscription;
use tf_lbry::LbrySubscription;

#[derive(Msg)]
pub enum SubscriptionAdderMsg {
Expand Down Expand Up @@ -81,24 +81,26 @@ impl Widget for SubscriptionAdder {
let platform = self.model.platform.clone();

std::thread::spawn(move || {
let sub_res: Result<AnySubscription, tf_core::Error> =
let sub_res: Option<AnySubscription> =
tokio::runtime::Runtime::new().unwrap().block_on(async {
match platform {
Platform::Youtube => YTSubscription::from_id_or_name(&channel_id_or_name)
Platform::Youtube => YTSubscription::try_from_search(&channel_id_or_name)
.await
.map(|s| s.into()),
Platform::Peertube => {
Ok(PTSubscription::new(&base_url, &channel_id_or_name).into())
},
Platform::Lbry => Ok(LbrySubscription::new(&channel_id_or_name).into()),
Some(PTSubscription::new(&base_url, &channel_id_or_name).into())
}
Platform::Lbry => Some(LbrySubscription::new(&channel_id_or_name).into()),
// -- Add case here

}
});

// TODO: Error handling
if let Ok(sub) = sub_res {
if let Some(sub) = sub_res {
log::debug!("New Channel {:#?}", sub);
sub_list.add(sub);
} else {
log::error!("Error");
}
});
}
Expand Down

0 comments on commit b6991df

Please sign in to comment.