feat: add youtube search #8
| @ -1,17 +1,17 @@ | ||||
| [package] | ||||
| name = "songlify" | ||||
| version = "0.3.3" | ||||
| version = "0.3.3-beta" | ||||
| edition = "2018" | ||||
| 
 | ||||
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||||
| 
 | ||||
| [dependencies] | ||||
| teloxide = { version = "0.9.1", features = ["auto-send", "macros"] } | ||||
| teloxide = { version = "0.9.2", features = ["auto-send", "macros"] } | ||||
| log = "0.4.17" | ||||
| 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"]} | ||||
| sentry = "0.26.0" | ||||
| sentry = "0.27.0" | ||||
| invidious = "0.2.1" | ||||
| chrono = "0.4.19" | ||||
| itertools = "0.10.3" | ||||
|  | ||||
| @ -1,17 +1,14 @@ | ||||
| use log::{debug, info, log, LevelFilter}; | ||||
| use log::{debug, info, LevelFilter}; | ||||
| use search::spotify; | ||||
| use sentry::ClientInitGuard; | ||||
| use std::env; | ||||
| use std::process::id; | ||||
| use std::sync::Arc; | ||||
| use teloxide::prelude::*; | ||||
| 
 | ||||
| use search::spotify::ContentKind::Track; | ||||
| use search::spotify::{PlayableKind, TrackInfo}; | ||||
| use search::spotify::TrackInfo; | ||||
| 
 | ||||
| use crate::search::get_spotify_kind; | ||||
| use crate::spotify::ContentKind; | ||||
| use search::spotify::ContentKind::{Album, Episode, Playlist, Podcast}; | ||||
| use search::spotify::ContentKind::{Album, Playlist}; | ||||
| 
 | ||||
| mod search; | ||||
| mod tgformatter; | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| use crate::spotify::{get_entry_kind, AlbumInfo, PlaylistInfo}; | ||||
| use crate::TrackInfo; | ||||
| use log::info; | ||||
| use spotify::ContentKind; | ||||
| use std::collections::HashSet; | ||||
| 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
 | ||||
| // tracks, albums and playlists
 | ||||
| #[derive(Debug, Clone)] | ||||
|  | ||||
| @ -1,8 +1,7 @@ | ||||
| use rspotify::model::PlayableItem::{Episode, Track}; | ||||
| use rspotify::model::{AlbumId, FullTrack, PlaylistId, TrackId}; | ||||
| use rspotify::model::{AlbumId, PlaylistId, TrackId}; | ||||
| use rspotify::prelude::*; | ||||
| use rspotify::{ClientCredsSpotify, Credentials}; | ||||
| use std::any::Any; | ||||
| use std::sync::Arc; | ||||
| use std::time::Duration; | ||||
| 
 | ||||
|  | ||||
| @ -1,13 +1,8 @@ | ||||
| mod utils; | ||||
| 
 | ||||
| use crate::search::{AlbumItem, ArtistComposed, PlaylistItem, TrackItem}; | ||||
| use crate::TrackInfo; | ||||
| use log::{info, log}; | ||||
| use std::borrow::Borrow; | ||||
| use std::collections::HashSet; | ||||
| use std::fmt::format; | ||||
| use std::time::Duration; | ||||
| use teloxide::repl; | ||||
| 
 | ||||
| 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()) | ||||
|     ); | ||||
| 
 | ||||
|     let mut album_genres = get_album_genres(boxed_info.clone()); | ||||
|     let album_genres = get_album_genres(boxed_info.clone()); | ||||
|     if album_genres.len() > 0 { | ||||
|         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 mut reply = format!( | ||||
|     let reply = format!( | ||||
|         "Playlist information:\n\ | ||||
| ✒️ Playlist name: {}\n\ | ||||
| 🧞 Made by: {}\n\ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user