feat: add youtube search #8
| @ -1,17 +1,17 @@ | |||||||
| [package] | [package] | ||||||
| name = "songlify" | name = "songlify" | ||||||
| version = "0.3.3" | version = "0.3.3-beta" | ||||||
| edition = "2018" | edition = "2018" | ||||||
| 
 | 
 | ||||||
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||||||
| 
 | 
 | ||||||
| [dependencies] | [dependencies] | ||||||
| teloxide = { version = "0.9.1", features = ["auto-send", "macros"] } | teloxide = { version = "0.9.2", features = ["auto-send", "macros"] } | ||||||
| log = "0.4.17" | log = "0.4.17" | ||||||
| pretty_env_logger = "0.4.0" | pretty_env_logger = "0.4.0" | ||||||
| tokio = { version =  "1.18.2", features = ["rt-multi-thread", "macros"] } | tokio = { version =  "1.20.0", features = ["rt-multi-thread", "macros"] } | ||||||
| rspotify = { version = "0.11.5", features = ["default"]} | rspotify = { version = "0.11.5", features = ["default"]} | ||||||
| sentry = "0.26.0" | sentry = "0.27.0" | ||||||
| invidious = "0.2.1" | invidious = "0.2.1" | ||||||
| chrono = "0.4.19" | chrono = "0.4.19" | ||||||
| itertools = "0.10.3" | itertools = "0.10.3" | ||||||
|  | |||||||
| @ -1,17 +1,14 @@ | |||||||
| use log::{debug, info, log, LevelFilter}; | use log::{debug, info, LevelFilter}; | ||||||
| use search::spotify; | use search::spotify; | ||||||
| use sentry::ClientInitGuard; | use sentry::ClientInitGuard; | ||||||
| use std::env; | use std::env; | ||||||
| use std::process::id; |  | ||||||
| use std::sync::Arc; |  | ||||||
| use teloxide::prelude::*; | use teloxide::prelude::*; | ||||||
| 
 | 
 | ||||||
| use search::spotify::ContentKind::Track; | use search::spotify::ContentKind::Track; | ||||||
| use search::spotify::{PlayableKind, TrackInfo}; | use search::spotify::TrackInfo; | ||||||
| 
 | 
 | ||||||
| use crate::search::get_spotify_kind; | use crate::search::get_spotify_kind; | ||||||
| use crate::spotify::ContentKind; | use search::spotify::ContentKind::{Album, Playlist}; | ||||||
| use search::spotify::ContentKind::{Album, Episode, Playlist, Podcast}; |  | ||||||
| 
 | 
 | ||||||
| mod search; | mod search; | ||||||
| mod tgformatter; | mod tgformatter; | ||||||
|  | |||||||
| @ -1,6 +1,5 @@ | |||||||
| use crate::spotify::{get_entry_kind, AlbumInfo, PlaylistInfo}; | use crate::spotify::{get_entry_kind, AlbumInfo, PlaylistInfo}; | ||||||
| use crate::TrackInfo; | use crate::TrackInfo; | ||||||
| use log::info; |  | ||||||
| use spotify::ContentKind; | use spotify::ContentKind; | ||||||
| use std::collections::HashSet; | use std::collections::HashSet; | ||||||
| use youtube::Video; | use youtube::Video; | ||||||
| @ -89,14 +88,6 @@ impl ArtistComposed for PlaylistItem { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // The enum holds all the currently supported type of Id which the engine can search for
 |  | ||||||
| #[derive(Debug, Clone, PartialEq, Eq, Hash)] |  | ||||||
| pub(crate) enum ServiceIdKind { |  | ||||||
|     Spotify(String), |  | ||||||
|     Youtube(String), |  | ||||||
|     Automatic(String), |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // This struct will allow us in the future to search, cache and store data and metadata regarding
 | // This struct will allow us in the future to search, cache and store data and metadata regarding
 | ||||||
| // tracks, albums and playlists
 | // tracks, albums and playlists
 | ||||||
| #[derive(Debug, Clone)] | #[derive(Debug, Clone)] | ||||||
|  | |||||||
| @ -1,8 +1,7 @@ | |||||||
| use rspotify::model::PlayableItem::{Episode, Track}; | use rspotify::model::PlayableItem::{Episode, Track}; | ||||||
| use rspotify::model::{AlbumId, FullTrack, PlaylistId, TrackId}; | use rspotify::model::{AlbumId, PlaylistId, TrackId}; | ||||||
| use rspotify::prelude::*; | use rspotify::prelude::*; | ||||||
| use rspotify::{ClientCredsSpotify, Credentials}; | use rspotify::{ClientCredsSpotify, Credentials}; | ||||||
| use std::any::Any; |  | ||||||
| use std::sync::Arc; | use std::sync::Arc; | ||||||
| use std::time::Duration; | use std::time::Duration; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,13 +1,8 @@ | |||||||
| mod utils; | mod utils; | ||||||
| 
 | 
 | ||||||
| use crate::search::{AlbumItem, ArtistComposed, PlaylistItem, TrackItem}; | use crate::search::{AlbumItem, ArtistComposed, PlaylistItem, TrackItem}; | ||||||
| use crate::TrackInfo; |  | ||||||
| use log::{info, log}; |  | ||||||
| use std::borrow::Borrow; |  | ||||||
| use std::collections::HashSet; | use std::collections::HashSet; | ||||||
| use std::fmt::format; |  | ||||||
| use std::time::Duration; | use std::time::Duration; | ||||||
| use teloxide::repl; |  | ||||||
| 
 | 
 | ||||||
| static MAX_ARTISTS_CHARS: usize = 200; | static MAX_ARTISTS_CHARS: usize = 200; | ||||||
| 
 | 
 | ||||||
| @ -58,7 +53,7 @@ pub(crate) fn format_album_message(album_info: AlbumItem) -> Option<String> { | |||||||
|         get_artists(boxed_info.clone()) |         get_artists(boxed_info.clone()) | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     let mut album_genres = get_album_genres(boxed_info.clone()); |     let album_genres = get_album_genres(boxed_info.clone()); | ||||||
|     if album_genres.len() > 0 { |     if album_genres.len() > 0 { | ||||||
|         reply.push_str(format!("\n💿 Genre(s): {}", itertools::join(&album_genres, ", ")).as_str()); |         reply.push_str(format!("\n💿 Genre(s): {}", itertools::join(&album_genres, ", ")).as_str()); | ||||||
|     } |     } | ||||||
| @ -74,7 +69,7 @@ pub(crate) fn format_playlist_message(playlist_info: PlaylistItem) -> Option<Str | |||||||
| 
 | 
 | ||||||
|     let artists = boxed_info.clone().get_artists_name().len(); |     let artists = boxed_info.clone().get_artists_name().len(); | ||||||
| 
 | 
 | ||||||
|     let mut reply = format!( |     let reply = format!( | ||||||
|         "Playlist information:\n\ |         "Playlist information:\n\ | ||||||
| ✒️ Playlist name: {}\n\ | ✒️ Playlist name: {}\n\ | ||||||
| 🧞 Made by: {}\n\ | 🧞 Made by: {}\n\ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user