| @@ -3,7 +3,7 @@ use invidious::{ClientSync, ClientSyncTrait}; |
| 3 | 3 | use crate::global::traits::SearchProviderTrait; |
| 4 | 4 | |
| 5 | 5 | // used in `data.global` |
| 6 | | /// Holds the invidious client |
| 6 | /// Holds the crate::global::common client |
| 7 | 7 | #[derive(Clone)] |
| 8 | 8 | pub struct InvidiousClient(pub ClientSync); |
| 9 | 9 | |
| @@ -13,13 +13,609 @@ impl InvidiousClient { |
| 13 | 13 | } |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | impl From<invidious::hidden::Storyboard> for crate::global::common::hidden::Storyboard { |
| 17 | fn from(value: invidious::hidden::Storyboard) -> Self { |
| 18 | Self { |
| 19 | url: value.url, |
| 20 | template_url: value.template_url, |
| 21 | width: value.width, |
| 22 | height: value.height, |
| 23 | count: value.count, |
| 24 | interval: value.interval, |
| 25 | storyboard_width: value.storyboard_width, |
| 26 | storyboard_height: value.storyboard_height, |
| 27 | storyboard_count: value.storyboard_count, |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | impl From<invidious::CommonThumbnail> for crate::global::common::CommonThumbnail { |
| 33 | fn from(value: invidious::CommonThumbnail) -> Self { |
| 34 | Self { |
| 35 | quality: value.quality, |
| 36 | url: value.url, |
| 37 | width: value.width, |
| 38 | height: value.height, |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl From<invidious::hidden::CountryCode> for crate::global::common::hidden::CountryCode { |
| 44 | fn from(value: invidious::hidden::CountryCode) -> Self { |
| 45 | match value { |
| 46 | invidious::hidden::CountryCode::AD => Self::AD, |
| 47 | invidious::hidden::CountryCode::AE => Self::AE, |
| 48 | invidious::hidden::CountryCode::AF => Self::AF, |
| 49 | invidious::hidden::CountryCode::AG => Self::AG, |
| 50 | invidious::hidden::CountryCode::AI => Self::AI, |
| 51 | invidious::hidden::CountryCode::AL => Self::AL, |
| 52 | invidious::hidden::CountryCode::AM => Self::AM, |
| 53 | invidious::hidden::CountryCode::AO => Self::AO, |
| 54 | invidious::hidden::CountryCode::AQ => Self::AQ, |
| 55 | invidious::hidden::CountryCode::AR => Self::AR, |
| 56 | invidious::hidden::CountryCode::AS => Self::AS, |
| 57 | invidious::hidden::CountryCode::AT => Self::AT, |
| 58 | invidious::hidden::CountryCode::AU => Self::AU, |
| 59 | invidious::hidden::CountryCode::AW => Self::AW, |
| 60 | invidious::hidden::CountryCode::AX => Self::AX, |
| 61 | invidious::hidden::CountryCode::AZ => Self::AZ, |
| 62 | invidious::hidden::CountryCode::BA => Self::BA, |
| 63 | invidious::hidden::CountryCode::BB => Self::BB, |
| 64 | invidious::hidden::CountryCode::BD => Self::BD, |
| 65 | invidious::hidden::CountryCode::BE => Self::BE, |
| 66 | invidious::hidden::CountryCode::BF => Self::BF, |
| 67 | invidious::hidden::CountryCode::BG => Self::BG, |
| 68 | invidious::hidden::CountryCode::BH => Self::BH, |
| 69 | invidious::hidden::CountryCode::BI => Self::BI, |
| 70 | invidious::hidden::CountryCode::BJ => Self::BJ, |
| 71 | invidious::hidden::CountryCode::BL => Self::BL, |
| 72 | invidious::hidden::CountryCode::BM => Self::BM, |
| 73 | invidious::hidden::CountryCode::BN => Self::BN, |
| 74 | invidious::hidden::CountryCode::BO => Self::BO, |
| 75 | invidious::hidden::CountryCode::BQ => Self::BQ, |
| 76 | invidious::hidden::CountryCode::BR => Self::BR, |
| 77 | invidious::hidden::CountryCode::BS => Self::BS, |
| 78 | invidious::hidden::CountryCode::BT => Self::BT, |
| 79 | invidious::hidden::CountryCode::BV => Self::BV, |
| 80 | invidious::hidden::CountryCode::BW => Self::BW, |
| 81 | invidious::hidden::CountryCode::BY => Self::BY, |
| 82 | invidious::hidden::CountryCode::BZ => Self::BZ, |
| 83 | invidious::hidden::CountryCode::CA => Self::CA, |
| 84 | invidious::hidden::CountryCode::CC => Self::CC, |
| 85 | invidious::hidden::CountryCode::CD => Self::CD, |
| 86 | invidious::hidden::CountryCode::CF => Self::CF, |
| 87 | invidious::hidden::CountryCode::CG => Self::CG, |
| 88 | invidious::hidden::CountryCode::CH => Self::CH, |
| 89 | invidious::hidden::CountryCode::CI => Self::CI, |
| 90 | invidious::hidden::CountryCode::CK => Self::CK, |
| 91 | invidious::hidden::CountryCode::CL => Self::CL, |
| 92 | invidious::hidden::CountryCode::CM => Self::CM, |
| 93 | invidious::hidden::CountryCode::CN => Self::CN, |
| 94 | invidious::hidden::CountryCode::CO => Self::CO, |
| 95 | invidious::hidden::CountryCode::CR => Self::CR, |
| 96 | invidious::hidden::CountryCode::CU => Self::CU, |
| 97 | invidious::hidden::CountryCode::CV => Self::CV, |
| 98 | invidious::hidden::CountryCode::CW => Self::CW, |
| 99 | invidious::hidden::CountryCode::CX => Self::CX, |
| 100 | invidious::hidden::CountryCode::CY => Self::CY, |
| 101 | invidious::hidden::CountryCode::CZ => Self::CZ, |
| 102 | invidious::hidden::CountryCode::DE => Self::DE, |
| 103 | invidious::hidden::CountryCode::DJ => Self::DJ, |
| 104 | invidious::hidden::CountryCode::DK => Self::DK, |
| 105 | invidious::hidden::CountryCode::DM => Self::DM, |
| 106 | invidious::hidden::CountryCode::DO => Self::DO, |
| 107 | invidious::hidden::CountryCode::DZ => Self::DZ, |
| 108 | invidious::hidden::CountryCode::EC => Self::EC, |
| 109 | invidious::hidden::CountryCode::EE => Self::EE, |
| 110 | invidious::hidden::CountryCode::EG => Self::EG, |
| 111 | invidious::hidden::CountryCode::EH => Self::EH, |
| 112 | invidious::hidden::CountryCode::ER => Self::ER, |
| 113 | invidious::hidden::CountryCode::ES => Self::ES, |
| 114 | invidious::hidden::CountryCode::ET => Self::ET, |
| 115 | invidious::hidden::CountryCode::FI => Self::FI, |
| 116 | invidious::hidden::CountryCode::FJ => Self::FJ, |
| 117 | invidious::hidden::CountryCode::FK => Self::FK, |
| 118 | invidious::hidden::CountryCode::FM => Self::FM, |
| 119 | invidious::hidden::CountryCode::FO => Self::FO, |
| 120 | invidious::hidden::CountryCode::FR => Self::FR, |
| 121 | invidious::hidden::CountryCode::GA => Self::GA, |
| 122 | invidious::hidden::CountryCode::GB => Self::GB, |
| 123 | invidious::hidden::CountryCode::GD => Self::GD, |
| 124 | invidious::hidden::CountryCode::GE => Self::GE, |
| 125 | invidious::hidden::CountryCode::GF => Self::GF, |
| 126 | invidious::hidden::CountryCode::GG => Self::GG, |
| 127 | invidious::hidden::CountryCode::GH => Self::GH, |
| 128 | invidious::hidden::CountryCode::GI => Self::GI, |
| 129 | invidious::hidden::CountryCode::GL => Self::GL, |
| 130 | invidious::hidden::CountryCode::GM => Self::GM, |
| 131 | invidious::hidden::CountryCode::GN => Self::GN, |
| 132 | invidious::hidden::CountryCode::GP => Self::GP, |
| 133 | invidious::hidden::CountryCode::GQ => Self::GQ, |
| 134 | invidious::hidden::CountryCode::GR => Self::GR, |
| 135 | invidious::hidden::CountryCode::GS => Self::GS, |
| 136 | invidious::hidden::CountryCode::GT => Self::GT, |
| 137 | invidious::hidden::CountryCode::GU => Self::GU, |
| 138 | invidious::hidden::CountryCode::GW => Self::GW, |
| 139 | invidious::hidden::CountryCode::GY => Self::GY, |
| 140 | invidious::hidden::CountryCode::HK => Self::HK, |
| 141 | invidious::hidden::CountryCode::HM => Self::HM, |
| 142 | invidious::hidden::CountryCode::HN => Self::HN, |
| 143 | invidious::hidden::CountryCode::HR => Self::HR, |
| 144 | invidious::hidden::CountryCode::HT => Self::HT, |
| 145 | invidious::hidden::CountryCode::HU => Self::HU, |
| 146 | invidious::hidden::CountryCode::ID => Self::ID, |
| 147 | invidious::hidden::CountryCode::IE => Self::IE, |
| 148 | invidious::hidden::CountryCode::IL => Self::IL, |
| 149 | invidious::hidden::CountryCode::IM => Self::IM, |
| 150 | invidious::hidden::CountryCode::IN => Self::IN, |
| 151 | invidious::hidden::CountryCode::IO => Self::IO, |
| 152 | invidious::hidden::CountryCode::IQ => Self::IQ, |
| 153 | invidious::hidden::CountryCode::IR => Self::IR, |
| 154 | invidious::hidden::CountryCode::IS => Self::IS, |
| 155 | invidious::hidden::CountryCode::IT => Self::IT, |
| 156 | invidious::hidden::CountryCode::JE => Self::JE, |
| 157 | invidious::hidden::CountryCode::JM => Self::JM, |
| 158 | invidious::hidden::CountryCode::JO => Self::JO, |
| 159 | invidious::hidden::CountryCode::JP => Self::JP, |
| 160 | invidious::hidden::CountryCode::KE => Self::KE, |
| 161 | invidious::hidden::CountryCode::KG => Self::KG, |
| 162 | invidious::hidden::CountryCode::KH => Self::KH, |
| 163 | invidious::hidden::CountryCode::KI => Self::KI, |
| 164 | invidious::hidden::CountryCode::KM => Self::KM, |
| 165 | invidious::hidden::CountryCode::KN => Self::KN, |
| 166 | invidious::hidden::CountryCode::KP => Self::KP, |
| 167 | invidious::hidden::CountryCode::KR => Self::KR, |
| 168 | invidious::hidden::CountryCode::KW => Self::KW, |
| 169 | invidious::hidden::CountryCode::KY => Self::KY, |
| 170 | invidious::hidden::CountryCode::KZ => Self::KZ, |
| 171 | invidious::hidden::CountryCode::LA => Self::LA, |
| 172 | invidious::hidden::CountryCode::LB => Self::LB, |
| 173 | invidious::hidden::CountryCode::LC => Self::LC, |
| 174 | invidious::hidden::CountryCode::LI => Self::LI, |
| 175 | invidious::hidden::CountryCode::LK => Self::LK, |
| 176 | invidious::hidden::CountryCode::LR => Self::LR, |
| 177 | invidious::hidden::CountryCode::LS => Self::LS, |
| 178 | invidious::hidden::CountryCode::LT => Self::LT, |
| 179 | invidious::hidden::CountryCode::LU => Self::LU, |
| 180 | invidious::hidden::CountryCode::LV => Self::LV, |
| 181 | invidious::hidden::CountryCode::LY => Self::LY, |
| 182 | invidious::hidden::CountryCode::MA => Self::MA, |
| 183 | invidious::hidden::CountryCode::MC => Self::MC, |
| 184 | invidious::hidden::CountryCode::MD => Self::MD, |
| 185 | invidious::hidden::CountryCode::ME => Self::ME, |
| 186 | invidious::hidden::CountryCode::MF => Self::MF, |
| 187 | invidious::hidden::CountryCode::MG => Self::MG, |
| 188 | invidious::hidden::CountryCode::MH => Self::MH, |
| 189 | invidious::hidden::CountryCode::MK => Self::MK, |
| 190 | invidious::hidden::CountryCode::ML => Self::ML, |
| 191 | invidious::hidden::CountryCode::MM => Self::MM, |
| 192 | invidious::hidden::CountryCode::MN => Self::MN, |
| 193 | invidious::hidden::CountryCode::MO => Self::MO, |
| 194 | invidious::hidden::CountryCode::MP => Self::MP, |
| 195 | invidious::hidden::CountryCode::MQ => Self::MQ, |
| 196 | invidious::hidden::CountryCode::MR => Self::MR, |
| 197 | invidious::hidden::CountryCode::MS => Self::MS, |
| 198 | invidious::hidden::CountryCode::MT => Self::MT, |
| 199 | invidious::hidden::CountryCode::MU => Self::MU, |
| 200 | invidious::hidden::CountryCode::MV => Self::MV, |
| 201 | invidious::hidden::CountryCode::MW => Self::MW, |
| 202 | invidious::hidden::CountryCode::MX => Self::MX, |
| 203 | invidious::hidden::CountryCode::MY => Self::MY, |
| 204 | invidious::hidden::CountryCode::MZ => Self::MZ, |
| 205 | invidious::hidden::CountryCode::NA => Self::NA, |
| 206 | invidious::hidden::CountryCode::NC => Self::NC, |
| 207 | invidious::hidden::CountryCode::NE => Self::NE, |
| 208 | invidious::hidden::CountryCode::NF => Self::NF, |
| 209 | invidious::hidden::CountryCode::NG => Self::NG, |
| 210 | invidious::hidden::CountryCode::NI => Self::NI, |
| 211 | invidious::hidden::CountryCode::NL => Self::NL, |
| 212 | invidious::hidden::CountryCode::NO => Self::NO, |
| 213 | invidious::hidden::CountryCode::NP => Self::NP, |
| 214 | invidious::hidden::CountryCode::NR => Self::NR, |
| 215 | invidious::hidden::CountryCode::NU => Self::NU, |
| 216 | invidious::hidden::CountryCode::NZ => Self::NZ, |
| 217 | invidious::hidden::CountryCode::OM => Self::OM, |
| 218 | invidious::hidden::CountryCode::PA => Self::PA, |
| 219 | invidious::hidden::CountryCode::PE => Self::PE, |
| 220 | invidious::hidden::CountryCode::PF => Self::PF, |
| 221 | invidious::hidden::CountryCode::PG => Self::PG, |
| 222 | invidious::hidden::CountryCode::PH => Self::PH, |
| 223 | invidious::hidden::CountryCode::PK => Self::PK, |
| 224 | invidious::hidden::CountryCode::PL => Self::PL, |
| 225 | invidious::hidden::CountryCode::PM => Self::PM, |
| 226 | invidious::hidden::CountryCode::PN => Self::PN, |
| 227 | invidious::hidden::CountryCode::PR => Self::PR, |
| 228 | invidious::hidden::CountryCode::PS => Self::PS, |
| 229 | invidious::hidden::CountryCode::PT => Self::PT, |
| 230 | invidious::hidden::CountryCode::PW => Self::PW, |
| 231 | invidious::hidden::CountryCode::PY => Self::PY, |
| 232 | invidious::hidden::CountryCode::QA => Self::QA, |
| 233 | invidious::hidden::CountryCode::RE => Self::RE, |
| 234 | invidious::hidden::CountryCode::RO => Self::RO, |
| 235 | invidious::hidden::CountryCode::RS => Self::RS, |
| 236 | invidious::hidden::CountryCode::RU => Self::RU, |
| 237 | invidious::hidden::CountryCode::RW => Self::RW, |
| 238 | invidious::hidden::CountryCode::SA => Self::SA, |
| 239 | invidious::hidden::CountryCode::SB => Self::SB, |
| 240 | invidious::hidden::CountryCode::SC => Self::SC, |
| 241 | invidious::hidden::CountryCode::SD => Self::SD, |
| 242 | invidious::hidden::CountryCode::SE => Self::SE, |
| 243 | invidious::hidden::CountryCode::SG => Self::SG, |
| 244 | invidious::hidden::CountryCode::SH => Self::SH, |
| 245 | invidious::hidden::CountryCode::SI => Self::SI, |
| 246 | invidious::hidden::CountryCode::SJ => Self::SJ, |
| 247 | invidious::hidden::CountryCode::SK => Self::SK, |
| 248 | invidious::hidden::CountryCode::SL => Self::SL, |
| 249 | invidious::hidden::CountryCode::SM => Self::SM, |
| 250 | invidious::hidden::CountryCode::SN => Self::SN, |
| 251 | invidious::hidden::CountryCode::SO => Self::SO, |
| 252 | invidious::hidden::CountryCode::SR => Self::SR, |
| 253 | invidious::hidden::CountryCode::SS => Self::SS, |
| 254 | invidious::hidden::CountryCode::ST => Self::ST, |
| 255 | invidious::hidden::CountryCode::SV => Self::SV, |
| 256 | invidious::hidden::CountryCode::SX => Self::SX, |
| 257 | invidious::hidden::CountryCode::SY => Self::SY, |
| 258 | invidious::hidden::CountryCode::SZ => Self::SZ, |
| 259 | invidious::hidden::CountryCode::TC => Self::TC, |
| 260 | invidious::hidden::CountryCode::TD => Self::TD, |
| 261 | invidious::hidden::CountryCode::TF => Self::TF, |
| 262 | invidious::hidden::CountryCode::TG => Self::TG, |
| 263 | invidious::hidden::CountryCode::TH => Self::TH, |
| 264 | invidious::hidden::CountryCode::TJ => Self::TJ, |
| 265 | invidious::hidden::CountryCode::TK => Self::TK, |
| 266 | invidious::hidden::CountryCode::TL => Self::TL, |
| 267 | invidious::hidden::CountryCode::TM => Self::TM, |
| 268 | invidious::hidden::CountryCode::TN => Self::TN, |
| 269 | invidious::hidden::CountryCode::TO => Self::TO, |
| 270 | invidious::hidden::CountryCode::TR => Self::TR, |
| 271 | invidious::hidden::CountryCode::TT => Self::TT, |
| 272 | invidious::hidden::CountryCode::TV => Self::TV, |
| 273 | invidious::hidden::CountryCode::TW => Self::TW, |
| 274 | invidious::hidden::CountryCode::TZ => Self::TZ, |
| 275 | invidious::hidden::CountryCode::UA => Self::UA, |
| 276 | invidious::hidden::CountryCode::UG => Self::UG, |
| 277 | invidious::hidden::CountryCode::UM => Self::UM, |
| 278 | invidious::hidden::CountryCode::US => Self::US, |
| 279 | invidious::hidden::CountryCode::UY => Self::UY, |
| 280 | invidious::hidden::CountryCode::UZ => Self::UZ, |
| 281 | invidious::hidden::CountryCode::VA => Self::VA, |
| 282 | invidious::hidden::CountryCode::VC => Self::VC, |
| 283 | invidious::hidden::CountryCode::VE => Self::VE, |
| 284 | invidious::hidden::CountryCode::VG => Self::VG, |
| 285 | invidious::hidden::CountryCode::VI => Self::VI, |
| 286 | invidious::hidden::CountryCode::VN => Self::VN, |
| 287 | invidious::hidden::CountryCode::VU => Self::VU, |
| 288 | invidious::hidden::CountryCode::WF => Self::WF, |
| 289 | invidious::hidden::CountryCode::WS => Self::WS, |
| 290 | invidious::hidden::CountryCode::YE => Self::YE, |
| 291 | invidious::hidden::CountryCode::YT => Self::YT, |
| 292 | invidious::hidden::CountryCode::ZA => Self::ZA, |
| 293 | invidious::hidden::CountryCode::ZM => Self::ZM, |
| 294 | invidious::hidden::CountryCode::ZW => Self::ZW, |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | impl From<invidious::hidden::AdaptiveFormat> for crate::global::common::hidden::AdaptiveFormat { |
| 300 | fn from(value: invidious::hidden::AdaptiveFormat) -> Self { |
| 301 | Self { |
| 302 | index: value.index, |
| 303 | bitrate: value.bitrate, |
| 304 | init: value.init, |
| 305 | url: value.url, |
| 306 | itag: value.itag, |
| 307 | r#type: value.r#type, |
| 308 | clen: value.clen, |
| 309 | lmt: value.lmt, |
| 310 | projection_type: value.projection_type, |
| 311 | fps: value.fps, |
| 312 | container: value.container, |
| 313 | encoding: value.encoding, |
| 314 | quality: value.quality, |
| 315 | resolution: value.resolution, |
| 316 | quality_label: value.quality_label, |
| 317 | audio_quality: value.audio_quality, |
| 318 | audio_sample_rate: value.audio_sample_rate, |
| 319 | audio_channels: value.audio_channels, |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | impl From<invidious::CommonImage> for crate::global::common::CommonImage { |
| 325 | fn from(value: invidious::CommonImage) -> Self { |
| 326 | Self { |
| 327 | url: value.url, |
| 328 | width: value.width, |
| 329 | height: value.height, |
| 330 | } |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | impl From<invidious::hidden::FormatStream> for crate::global::common::hidden::FormatStream { |
| 335 | fn from(value: invidious::hidden::FormatStream) -> Self { |
| 336 | Self { |
| 337 | url: value.url, |
| 338 | itag: value.itag, |
| 339 | r#type: value.r#type, |
| 340 | quality: value.quality, |
| 341 | container: value.container, |
| 342 | encoding: value.encoding, |
| 343 | quality_label: value.quality_label, |
| 344 | resolution: value.resolution, |
| 345 | size: value.size, |
| 346 | } |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | impl From<invidious::hidden::Caption> for crate::global::common::hidden::Caption { |
| 351 | fn from(value: invidious::hidden::Caption) -> Self { |
| 352 | Self { |
| 353 | label: value.label, |
| 354 | language: value.language, |
| 355 | url: value.url, |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | impl From<invidious::hidden::VideoShort> for crate::global::common::hidden::VideoShort { |
| 361 | fn from(value: invidious::hidden::VideoShort) -> Self { |
| 362 | Self { |
| 363 | id: value.id, |
| 364 | title: value.title, |
| 365 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 366 | author: value.author, |
| 367 | length: value.length, |
| 368 | views_text: value.views_text, |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | impl From<invidious::video::Video> for crate::global::common::video::Video { |
| 374 | fn from(value: invidious::video::Video) -> Self { |
| 375 | Self { |
| 376 | r#type: value.r#type, |
| 377 | title: value.title, |
| 378 | id: value.id, |
| 379 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 380 | storyboards: value.storyboards.into_iter().map(|v| v.into()).collect(), |
| 381 | description: value.description, |
| 382 | description_html: value.description_html, |
| 383 | published: value.published, |
| 384 | published_text: value.published_text, |
| 385 | keywords: value.keywords, |
| 386 | views: value.views, |
| 387 | likes: value.likes, |
| 388 | dislikes: value.dislikes, |
| 389 | paid: value.paid, |
| 390 | premium: value.premium, |
| 391 | family_friendly: value.family_friendly, |
| 392 | allowed_regions: value |
| 393 | .allowed_regions |
| 394 | .into_iter() |
| 395 | .map(|v| v.into()) |
| 396 | .collect(), |
| 397 | genre: value.genre, |
| 398 | genre_url: value.genre_url, |
| 399 | author: value.author, |
| 400 | author_id: value.author_id, |
| 401 | author_url: value.author_url, |
| 402 | author_thumbnails: value |
| 403 | .author_thumbnails |
| 404 | .into_iter() |
| 405 | .map(|v| v.into()) |
| 406 | .collect(), |
| 407 | sub_count_text: value.sub_count_text, |
| 408 | length: value.length, |
| 409 | allow_ratings: value.allow_ratings, |
| 410 | rating: value.rating, |
| 411 | listed: value.listed, |
| 412 | live: value.live, |
| 413 | upcoming: value.upcoming, |
| 414 | premiere_timestamp: value.premiere_timestamp, |
| 415 | dash: value.dash, |
| 416 | adaptive_formats: value |
| 417 | .adaptive_formats |
| 418 | .into_iter() |
| 419 | .map(|v| v.into()) |
| 420 | .collect(), |
| 421 | format_streams: value.format_streams.into_iter().map(|v| v.into()).collect(), |
| 422 | captions: value.captions.into_iter().map(|v| v.into()).collect(), |
| 423 | recommended_videos: value |
| 424 | .recommended_videos |
| 425 | .into_iter() |
| 426 | .map(|v| v.into()) |
| 427 | .collect(), |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | impl From<invidious::CommonVideo> for crate::global::common::CommonVideo { |
| 433 | fn from(value: invidious::CommonVideo) -> Self { |
| 434 | Self { |
| 435 | title: value.title, |
| 436 | id: value.id, |
| 437 | author: value.author, |
| 438 | author_id: value.author_id, |
| 439 | author_url: value.author_url, |
| 440 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 441 | description: value.description, |
| 442 | description_html: value.description_html, |
| 443 | views: value.views, |
| 444 | length: value.length, |
| 445 | published: value.published, |
| 446 | published_text: value.published_text, |
| 447 | premiere_timestamp: value.premiere_timestamp, |
| 448 | live: value.live, |
| 449 | premium: value.premium, |
| 450 | upcoming: value.upcoming, |
| 451 | } |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | impl From<invidious::CommonPlaylist> for crate::global::common::CommonPlaylist { |
| 456 | fn from(value: invidious::CommonPlaylist) -> Self { |
| 457 | Self { |
| 458 | title: value.title, |
| 459 | id: value.id, |
| 460 | thumbnail: value.thumbnail, |
| 461 | author: value.author, |
| 462 | author_id: value.author_id, |
| 463 | author_verified: value.author_verified, |
| 464 | video_count: value.video_count, |
| 465 | videos: value.videos.into_iter().map(|v| v.into()).collect(), |
| 466 | } |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | impl From<invidious::CommonPlaylistVideo> for crate::global::common::CommonPlaylistVideo { |
| 471 | fn from(value: invidious::CommonPlaylistVideo) -> Self { |
| 472 | Self { |
| 473 | title: value.title, |
| 474 | id: value.id, |
| 475 | length: value.length, |
| 476 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | impl From<invidious::CommonChannel> for crate::global::common::CommonChannel { |
| 482 | fn from(value: invidious::CommonChannel) -> Self { |
| 483 | Self { |
| 484 | name: value.name, |
| 485 | id: value.id, |
| 486 | url: value.url, |
| 487 | verified: value.verified, |
| 488 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 489 | auto_generated: value.auto_generated, |
| 490 | subscribers: value.subscribers, |
| 491 | video_count: value.video_count, |
| 492 | description: value.description, |
| 493 | description_html: value.description_html, |
| 494 | } |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | impl From<invidious::hidden::SearchItem> for crate::global::common::hidden::SearchItem { |
| 499 | fn from(value: invidious::hidden::SearchItem) -> Self { |
| 500 | match value { |
| 501 | invidious::hidden::SearchItem::Video(video) => Self::Video(video.into()), |
| 502 | invidious::hidden::SearchItem::Playlist(pl) => Self::Playlist(pl.into()), |
| 503 | invidious::hidden::SearchItem::Channel(ch) => Self::Channel(ch.into()), |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | impl From<invidious::channel::Channel> for crate::global::common::channel::Channel { |
| 509 | fn from(value: invidious::channel::Channel) -> Self { |
| 510 | Self { |
| 511 | name: value.name, |
| 512 | id: value.id, |
| 513 | url: value.url, |
| 514 | banners: value.banners.into_iter().map(|v| v.into()).collect(), |
| 515 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 516 | subscribers: value.subscribers, |
| 517 | total_views: value.total_views, |
| 518 | joined: value.joined, |
| 519 | auto_generated: value.auto_generated, |
| 520 | family_friendly: value.family_friendly, |
| 521 | description: value.description, |
| 522 | description_html: value.description_html, |
| 523 | allowed_regions: value |
| 524 | .allowed_regions |
| 525 | .into_iter() |
| 526 | .map(|v| v.into()) |
| 527 | .collect(), |
| 528 | latest_videos: value.lastest_videos.into_iter().map(|v| v.into()).collect(), |
| 529 | related_channels: value |
| 530 | .related_channels |
| 531 | .into_iter() |
| 532 | .map(|v| v.into()) |
| 533 | .collect(), |
| 534 | } |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | impl From<invidious::hidden::RelatedChannel> for crate::global::common::hidden::RelatedChannel { |
| 539 | fn from(value: invidious::hidden::RelatedChannel) -> Self { |
| 540 | Self { |
| 541 | name: value.name, |
| 542 | id: value.id, |
| 543 | url: value.url, |
| 544 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | impl From<invidious::hidden::PopularItem> for crate::global::common::hidden::PopularItem { |
| 550 | fn from(value: invidious::hidden::PopularItem) -> Self { |
| 551 | Self { |
| 552 | r#type: value.r#type, |
| 553 | title: value.title, |
| 554 | id: value.id, |
| 555 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 556 | length: value.length, |
| 557 | views: value.views, |
| 558 | author: value.author, |
| 559 | author_id: value.author_id, |
| 560 | author_url: value.author_url, |
| 561 | published: value.published, |
| 562 | published_text: value.published_text, |
| 563 | } |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | impl From<invidious::universal::Playlist> for crate::global::common::universal::Playlist { |
| 568 | fn from(value: invidious::universal::Playlist) -> Self { |
| 569 | Self { |
| 570 | title: value.title, |
| 571 | id: value.id, |
| 572 | thumbnail: value.thumbnail, |
| 573 | author: value.author, |
| 574 | author_id: value.author_id, |
| 575 | author_thumbnails: value |
| 576 | .author_thumbnails |
| 577 | .into_iter() |
| 578 | .map(|v| v.into()) |
| 579 | .collect(), |
| 580 | description: value.description, |
| 581 | description_html: value.description_html, |
| 582 | video_count: value.video_count, |
| 583 | views: value.views, |
| 584 | updated: value.updated, |
| 585 | listed: value.listed, |
| 586 | videos: value.videos.into_iter().map(|v| v.into()).collect(), |
| 587 | } |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | impl From<invidious::hidden::PlaylistItem> for crate::global::common::hidden::PlaylistItem { |
| 592 | fn from(value: invidious::hidden::PlaylistItem) -> Self { |
| 593 | Self { |
| 594 | title: value.title, |
| 595 | id: value.id, |
| 596 | author: value.author, |
| 597 | author_id: value.author_id, |
| 598 | author_url: value.author_url, |
| 599 | thumbnails: value.thumbnails.into_iter().map(|v| v.into()).collect(), |
| 600 | index: value.index, |
| 601 | length: value.length, |
| 602 | } |
| 603 | } |
| 604 | } |
| 605 | |
| 16 | 606 | impl SearchProviderTrait for InvidiousClient { |
| 17 | 607 | fn supports_video(&self) -> bool { |
| 18 | 608 | true |
| 19 | 609 | } |
| 20 | 610 | |
| 21 | | fn video(&self, id: &str) -> Result<invidious::video::Video, Box<dyn std::error::Error>> { |
| 22 | | self.0.video(id, None).map_err(|e| e.into()) |
| 611 | fn video( |
| 612 | &self, |
| 613 | id: &str, |
| 614 | ) -> Result<crate::global::common::video::Video, Box<dyn std::error::Error>> { |
| 615 | match self.0.video(id, None) { |
| 616 | Ok(k) => Ok(k.into()), |
| 617 | Err(e) => Err(e.into()), |
| 618 | } |
| 23 | 619 | } |
| 24 | 620 | |
| 25 | 621 | fn supports_search(&self) -> bool { |
| @@ -29,41 +625,51 @@ impl SearchProviderTrait for InvidiousClient { |
| 29 | 625 | fn search( |
| 30 | 626 | &self, |
| 31 | 627 | filters: &crate::config::Search, |
| 32 | | ) -> Result<Vec<invidious::hidden::SearchItem>, Box<dyn std::error::Error>> { |
| 33 | | self.0 |
| 34 | | .search(Some(&filters.to_string())) |
| 35 | | .map(|res| res.items) |
| 36 | | .map_err(|e| e.into()) |
| 628 | ) -> Result<Vec<crate::global::common::hidden::SearchItem>, Box<dyn std::error::Error>> { |
| 629 | match self.0.search(Some(&filters.to_string())) { |
| 630 | Ok(k) => Ok(k.items.into_iter().map(|v| v.into()).collect()), |
| 631 | Err(e) => Err(e.into()), |
| 632 | } |
| 37 | 633 | } |
| 38 | 634 | |
| 39 | 635 | fn supports_channel(&self) -> bool { |
| 40 | 636 | true |
| 41 | 637 | } |
| 42 | 638 | |
| 43 | | fn channel(&self, id: &str) -> Result<invidious::channel::Channel, Box<dyn std::error::Error>> { |
| 44 | | self.0.channel(id, None).map_err(|e| e.into()) |
| 639 | fn channel( |
| 640 | &self, |
| 641 | id: &str, |
| 642 | ) -> Result<crate::global::common::channel::Channel, Box<dyn std::error::Error>> { |
| 643 | match self.0.channel(id, None) { |
| 644 | Ok(k) => Ok(k.into()), |
| 645 | Err(e) => Err(e.into()), |
| 646 | } |
| 45 | 647 | } |
| 46 | 648 | |
| 47 | 649 | fn supports_popular(&self) -> bool { |
| 48 | 650 | true |
| 49 | 651 | } |
| 50 | 652 | |
| 51 | | fn popular(&self) -> Result<Vec<invidious::hidden::PopularItem>, Box<dyn std::error::Error>> { |
| 52 | | self.0 |
| 53 | | .popular(None) |
| 54 | | .map(|res| res.items) |
| 55 | | .map_err(|e| e.into()) |
| 653 | fn popular( |
| 654 | &self, |
| 655 | ) -> Result<Vec<crate::global::common::hidden::PopularItem>, Box<dyn std::error::Error>> { |
| 656 | match self.0.popular(None) { |
| 657 | Ok(k) => Ok(k.items.into_iter().map(|v| v.into()).collect()), |
| 658 | Err(e) => Err(e.into()), |
| 659 | } |
| 56 | 660 | } |
| 57 | 661 | |
| 58 | 662 | fn supports_trending(&self) -> bool { |
| 59 | 663 | true |
| 60 | 664 | } |
| 61 | 665 | |
| 62 | | fn trending(&self) -> Result<Vec<invidious::CommonVideo>, Box<dyn std::error::Error>> { |
| 63 | | self.0 |
| 64 | | .trending(None) |
| 65 | | .map(|res| res.videos) |
| 66 | | .map_err(|e| e.into()) |
| 666 | fn trending( |
| 667 | &self, |
| 668 | ) -> Result<Vec<crate::global::common::CommonVideo>, Box<dyn std::error::Error>> { |
| 669 | match self.0.trending(None) { |
| 670 | Ok(k) => Ok(k.videos.into_iter().map(|v| v.into()).collect()), |
| 671 | Err(e) => Err(e.into()), |
| 672 | } |
| 67 | 673 | } |
| 68 | 674 | |
| 69 | 675 | fn supports_playlist(&self) -> bool { |
| @@ -73,8 +679,11 @@ impl SearchProviderTrait for InvidiousClient { |
| 73 | 679 | fn playlist( |
| 74 | 680 | &self, |
| 75 | 681 | id: &str, |
| 76 | | ) -> Result<invidious::universal::Playlist, Box<dyn std::error::Error>> { |
| 77 | | self.0.playlist(id, None).map_err(|e| e.into()) |
| 682 | ) -> Result<crate::global::common::universal::Playlist, Box<dyn std::error::Error>> { |
| 683 | match self.0.playlist(id, None) { |
| 684 | Ok(k) => Ok(k.into()), |
| 685 | Err(e) => Err(e.into()), |
| 686 | } |
| 78 | 687 | } |
| 79 | 688 | |
| 80 | 689 | fn supports_channel_videos(&self) -> bool { |
| @@ -84,11 +693,11 @@ impl SearchProviderTrait for InvidiousClient { |
| 84 | 693 | fn channel_videos( |
| 85 | 694 | &self, |
| 86 | 695 | id: &str, |
| 87 | | ) -> Result<Vec<invidious::CommonVideo>, Box<dyn std::error::Error>> { |
| 88 | | self.0 |
| 89 | | .channel_videos(id, None) |
| 90 | | .map(|res| res.videos) |
| 91 | | .map_err(|e| e.into()) |
| 696 | ) -> Result<Vec<crate::global::common::CommonVideo>, Box<dyn std::error::Error>> { |
| 697 | match self.0.channel_videos(id, None) { |
| 698 | Ok(k) => Ok(k.videos.into_iter().map(|v| v.into()).collect()), |
| 699 | Err(e) => Err(e.into()), |
| 700 | } |
| 92 | 701 | } |
| 93 | 702 | |
| 94 | 703 | fn supports_channel_playlists(&self) -> bool { |
| @@ -98,10 +707,10 @@ impl SearchProviderTrait for InvidiousClient { |
| 98 | 707 | fn channel_playlists( |
| 99 | 708 | &self, |
| 100 | 709 | id: &str, |
| 101 | | ) -> Result<Vec<invidious::CommonPlaylist>, Box<dyn std::error::Error>> { |
| 102 | | self.0 |
| 103 | | .channel_playlists(id, None) |
| 104 | | .map(|res| res.playlists) |
| 105 | | .map_err(|e| e.into()) |
| 710 | ) -> Result<Vec<crate::global::common::CommonPlaylist>, Box<dyn std::error::Error>> { |
| 711 | match self.0.channel_playlists(id, None) { |
| 712 | Ok(k) => Ok(k.playlists.into_iter().map(|v| v.into()).collect()), |
| 713 | Err(e) => Err(e.into()), |
| 714 | } |
| 106 | 715 | } |
| 107 | 716 | } |