song updates

This commit is contained in:
Gvidas Juknevičius 2024-04-15 20:58:38 +03:00
parent 057816bd65
commit e377c0bd77
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
5 changed files with 247 additions and 117 deletions

View File

@ -1,28 +1,22 @@
{
"format": "m4a",
"genres": {
"rave": [
"noclue": [
{
"name": "EVERYTHING WHAT",
"url": "https://www.youtube.com/watch?v=Gjdsq4kc5cA"
"name": "Bad Boys",
"url": "https://www.youtube.com/watch?v=NTC7RD8xzCY"
},
{
"name": "Tricky Disco",
"url": "https://www.youtube.com/watch?v=t78qVdbAiXw"
"name": "DR. VODKA - DZIEWCZYNO Z TIKTOKA",
"url": "https://www.youtube.com/watch?v=HLbw1WQt64o"
},
{
"name": "DR. VODKA - Tricky Disco",
"url": "https://www.youtube.com/watch?v=IknAUhl3i2o"
}
],
"hip-hop": [
{
"name": "Afroman - Because I Got High",
"url": "https://www.youtube.com/watch?v=WeYsTmIzjkw"
"name": "Maco Mamuko - Whiskey, Cola i Tequila",
"url": "https://www.youtube.com/watch?v=aBrN0k0Phtc"
},
{
"name": "Drenchill - Freed from Desire",
"url": "https://www.youtube.com/watch?v=6b6FBneAENQ"
"name": "Discobitch - C'est Beau La Bourgeoisie",
"url": "https://www.youtube.com/watch?v=RCeQN2aEWxo"
}
],
"rusiskos": [
@ -41,20 +35,66 @@
{
"name": "Dzaro and hansa - Visky Kola karaleva trans pola",
"url": "https://www.youtube.com/watch?v=fflrMvZ2HtA"
},
{
"name": "Kanikuli",
"url": "https://www.youtube.com/watch?v=GNMiDZTL7jo"
},
{
"name": "Katja lel - moi marmeladni (paprobui mua mua)",
"url": "https://www.youtube.com/watch?v=0JMdXFHo5SY"
},
{
"name": "Arash - Temptation",
"url": "https://www.youtube.com/watch?v=6X3ZJh762-I"
},
{
"name": "Eldzej and Feduk - Rozovoe vino",
"url": "https://www.youtube.com/watch?v=S9oXj3a4gZ4"
},
{
"name": "Ruki Verch - 18 mne uze",
"url": "https://www.youtube.com/watch?v=Hxab_Sr132o"
}
],
"pop": [
"electronic": [
{
"name": "Green Day - Basket Case",
"url": "https://www.youtube.com/watch?v=wZ8eZRxFA-0"
"name": "Zombie Nation - Kernkraft 400",
"url": "https://www.youtube.com/watch?v=z5LW07FTJbI"
},
{
"name": "Icona Pop - I Love It",
"url": "https://www.youtube.com/watch?v=UxxajLWwzqY"
"name": "Benny Benassi - Satisfaction",
"url": "https://www.youtube.com/watch?v=a0fkNdPiIL4"
}
],
"reggea": [
{
"name": "Shaggy - It Wasn't Me",
"url": "https://www.youtube.com/watch?v=ssVj50ombaM"
}
],
"hip-hop": [
{
"name": "Afroman - Because I Got High",
"url": "https://www.youtube.com/watch?v=WeYsTmIzjkw"
},
{
"name": "Modern Talking - You're My Heart, You're My Soul",
"url": "https://www.youtube.com/watch?v=4kHl4FoK1Ys"
"name": "Drenchill - Freed from Desire",
"url": "https://www.youtube.com/watch?v=6b6FBneAENQ"
}
],
"rave": [
{
"name": "EVERYTHING WHAT",
"url": "https://www.youtube.com/watch?v=Gjdsq4kc5cA"
},
{
"name": "Tricky Disco",
"url": "https://www.youtube.com/watch?v=t78qVdbAiXw"
},
{
"name": "DR. VODKA - Tricky Disco",
"url": "https://www.youtube.com/watch?v=IknAUhl3i2o"
}
],
"house": [
@ -99,30 +139,18 @@
"url": "https://www.youtube.com/watch?v=SnnqDdZJpzA"
}
],
"electronic": [
"alt": [
{
"name": "Zombie Nation - Kernkraft 400",
"url": "https://www.youtube.com/watch?v=z5LW07FTJbI"
"name": "ROMANCEPLANET - FALL FROM THE SKY",
"url": "https://www.youtube.com/watch?v=HMhzxzXBisw"
},
{
"name": "Benny Benassi - Satisfaction",
"url": "https://www.youtube.com/watch?v=a0fkNdPiIL4"
}
],
"lietuviskos/rave": [
{
"name": "VainHouse - Malunas Prie Kelio",
"url": "https://www.youtube.com/watch?v=bbwuNjDXCiM"
"name": "ROMANCEPLANET - PLAIN WHITE TEE",
"url": "https://www.youtube.com/watch?v=tdVQbNwjGac"
},
{
"name": "Sokoledas - Mano Skonis Sokolado (Matuze & Arnisxd Remix)",
"url": "https://www.youtube.com/watch?v=hb41bfQxiM0"
}
],
"reggea": [
{
"name": "Shaggy - It Wasn't Me",
"url": "https://www.youtube.com/watch?v=ssVj50ombaM"
"name": "ROMANCEPLANET - DANCE",
"url": "https://www.youtube.com/watch?v=ircOfMb4gEw"
}
],
"rock": [
@ -131,66 +159,6 @@
"url": "https://www.youtube.com/watch?v=BOTIIw76qiE"
}
],
"noclue": [
{
"name": "Bad Boys",
"url": "https://www.youtube.com/watch?v=NTC7RD8xzCY"
},
{
"name": "DR. VODKA - DZIEWCZYNO Z TIKTOKA",
"url": "https://www.youtube.com/watch?v=HLbw1WQt64o"
},
{
"name": "Maco Mamuko - Whiskey, Cola i Tequila",
"url": "https://www.youtube.com/watch?v=aBrN0k0Phtc"
},
{
"name": "Discobitch - C'est Beau La Bourgeoisie",
"url": "https://www.youtube.com/watch?v=RCeQN2aEWxo"
}
],
"techno": [
{
"name": "Dance For Me",
"url": "https://www.youtube.com/watch?v=5DTSvGO_944"
},
{
"name": "Give It To Me",
"url": "https://www.youtube.com/watch?v=upQe8EeSyZU"
},
{
"name": "Empire Of The Sun, southstar - We Are The People",
"url": "https://www.youtube.com/watch?v=qguEGR5BK2k"
},
{
"name": "Beggin' (Techno)",
"url": "https://www.youtube.com/watch?v=tXPs1FwW6lk"
},
{
"name": "Lily Allen - Not Fair",
"url": "https://www.youtube.com/watch?v=WON_YIbeLis"
},
{
"name": "I WAS MADE FOR LOVIN' YOU (TECHNO)",
"url": "https://www.youtube.com/watch?v=asVznhccYao"
},
{
"name": "Nicolas Julian - Applause",
"url": "https://www.youtube.com/watch?v=-pXlrWVICAE"
},
{
"name": "08 Blumchen - Blaue Augen",
"url": "https://www.youtube.com/watch?v=mE4PZcUfiwE"
},
{
"name": "MUTA - Party maker",
"url": "https://www.youtube.com/watch?v=LT9VNK1aCXY"
},
{
"name": "Restricted - Big Jet Plane",
"url": "https://www.youtube.com/watch?v=NpVF0z5N-tE"
}
],
"lietuviskos": [
{
"name": "Adomas Vysniauskas - As Judu",
@ -475,20 +443,166 @@
{
"name": "Ka Tu Ka Vakare",
"url": "https://www.youtube.com/watch?v=6SOS4ljHbJY"
},
{
"name": "69 Danguje - Gyvenu",
"url": "https://www.youtube.com/watch?v=HMXlhmAoux4"
},
{
"name": "69 Danguje - 16 metu",
"url": "https://www.youtube.com/watch?v=nwjoqPcUPrw"
},
{
"name": "Zilviokas - Ryk Zuvedra ryk",
"url": "https://www.youtube.com/watch?v=eN6BOI7UlSE"
},
{
"name": "Vytautas siskauskas - Lietuva (Nebelinksmas musu kaimas)",
"url": "https://www.youtube.com/watch?v=31UkGzde14c"
},
{
"name": "Vairas - Svajoklis",
"url": "https://www.youtube.com/watch?v=hs8_KTV0Vrw"
},
{
"name": "Rytis Cicinas - Ne, nereikia asaru",
"url": "https://www.youtube.com/watch?v=48GSg1q2kPE"
},
{
"name": "Funky - Be taves",
"url": "https://www.youtube.com/watch?v=heTDrDukLWU"
},
{
"name": "PROFLAME - biznis",
"url": "https://www.youtube.com/watch?v=t139Vd83pgs"
}
],
"alt": [
"lietuviskos/rave": [
{
"name": "ROMANCEPLANET - FALL FROM THE SKY",
"url": "https://www.youtube.com/watch?v=HMhzxzXBisw"
"name": "VainHouse - Malunas Prie Kelio",
"url": "https://www.youtube.com/watch?v=bbwuNjDXCiM"
},
{
"name": "ROMANCEPLANET - PLAIN WHITE TEE",
"url": "https://www.youtube.com/watch?v=tdVQbNwjGac"
"name": "Sokoledas - Mano Skonis Sokolado (Matuze & Arnisxd Remix)",
"url": "https://www.youtube.com/watch?v=hb41bfQxiM0"
}
],
"techno": [
{
"name": "Dance For Me",
"url": "https://www.youtube.com/watch?v=5DTSvGO_944"
},
{
"name": "ROMANCEPLANET - DANCE",
"url": "https://www.youtube.com/watch?v=ircOfMb4gEw"
"name": "Give It To Me",
"url": "https://www.youtube.com/watch?v=upQe8EeSyZU"
},
{
"name": "Empire Of The Sun, southstar - We Are The People",
"url": "https://www.youtube.com/watch?v=qguEGR5BK2k"
},
{
"name": "Beggin' (Techno)",
"url": "https://www.youtube.com/watch?v=tXPs1FwW6lk"
},
{
"name": "Lily Allen - Not Fair",
"url": "https://www.youtube.com/watch?v=WON_YIbeLis"
},
{
"name": "I WAS MADE FOR LOVIN' YOU (TECHNO)",
"url": "https://www.youtube.com/watch?v=asVznhccYao"
},
{
"name": "Nicolas Julian - Applause",
"url": "https://www.youtube.com/watch?v=-pXlrWVICAE"
},
{
"name": "08 Blumchen - Blaue Augen",
"url": "https://www.youtube.com/watch?v=mE4PZcUfiwE"
},
{
"name": "MUTA - Party maker",
"url": "https://www.youtube.com/watch?v=LT9VNK1aCXY"
},
{
"name": "Restricted - Big Jet Plane",
"url": "https://www.youtube.com/watch?v=NpVF0z5N-tE"
},
{
"name": "Raffaella Carra - Pedro (Jaxomy & Agatino Romero Remix)",
"url": "https://www.youtube.com/watch?v=AIGnRc7F86Q"
},
{
"name": "Gigi D'Agostino - Bla Bla Bla",
"url": "https://www.youtube.com/watch?v=yKapqR2XRJE"
},
{
"name": "Manian - Welcome To The Club",
"url": "https://www.youtube.com/watch?v=7F9xDewtgNA"
}
],
"lietuviskos/sel": [
{
"name": "SEL - Lyja",
"url": "https://www.youtube.com/watch?v=KL6JBWnXCxw"
},
{
"name": "SEL - Gyvenimo man vieno neuztenka",
"url": "https://youtu.be/7Gd9XaEG5o4"
},
{
"name": "SEL - Ten kazkur giliai",
"url": "https://youtu.be/N7YNlegeiqs?si=9BBH6hjrgOjJ01Nz"
},
{
"name": "SEL - Uzmerkiu akis",
"url": "https://youtu.be/SdWj06XRZms?si=9TNGzjK9ITom-jaD"
},
{
"name": "SEL - As ziuriu i tave pasauli",
"url": "https://youtu.be/_SPDjl80kKw"
},
{
"name": "SEL - Tarp amzinybes",
"url": "https://youtu.be/UfPj-0QpGFA"
},
{
"name": "SEL - Tik Tok",
"url": "https://youtu.be/RkaIUateIxg"
},
{
"name": "SEL - Ten kur sapnai",
"url": "https://youtu.be/GDj3NgjDbRo"
},
{
"name": "SEL - Nes as tik vejas",
"url": "https://youtu.be/acMG37IZ6z8"
},
{
"name": "SEL - Skrendu",
"url": "https://youtu.be/G5Q_asvrXlA"
},
{
"name": "SEL - Leisk",
"url": "https://youtu.be/DDPmFMrffXQ"
}
],
"pop": [
{
"name": "Green Day - Basket Case",
"url": "https://www.youtube.com/watch?v=wZ8eZRxFA-0"
},
{
"name": "Icona Pop - I Love It",
"url": "https://www.youtube.com/watch?v=UxxajLWwzqY"
},
{
"name": "Modern Talking - You're My Heart, You're My Soul",
"url": "https://www.youtube.com/watch?v=4kHl4FoK1Ys"
},
{
"name": "Cheri cheri lady",
"url": "https://www.youtube.com/watch?v=lrIKt5uDWZo"
}
]
}

View File

@ -4,26 +4,33 @@ use crate::{config::ConfigWrapper, downloader::Downloader, manifest::{Manifest,
pub async fn add(cfg: &ConfigWrapper, manifest: &mut Manifest, downloader: &mut Downloader, url: &Option<String>, name: &Option<String>, genre: &Option<String>) -> anyhow::Result<()> {
let genres = manifest.genres.keys().map(|f| f.clone()).collect::<Vec<String>>();
log::debug!("Genre: {genre:?}");
log::debug!("url: {url:?}");
log::debug!("name: {name:?}");
let genre = genre.clone().unwrap_or(
crate::prompt::prompt_with_list_or_str("Enter song genre", &genres)
);
let mut genres = manifest.genres.keys().map(|f| f.clone()).collect::<Vec<String>>();
log::debug!("Genre: {genre}");
genres.sort();
let url = url.clone().unwrap_or(
let genre = genre.clone().unwrap_or_else( || {
let g = crate::prompt::prompt_with_list_or_str("Enter song genre", &genres);
log::info!("Genre: {g}");
g
});
let url = url.clone().unwrap_or_else( ||
crate::prompt::simple_prompt("Enter song youtube url, make sure its not a playlist, (yt only for now)")
);
let name = name.clone().unwrap_or(
let name = name.clone().unwrap_or_else( ||
crate::prompt::simple_prompt("Enter song name with like this: {Author} - {Song name}")
);
manifest.add_song(genre.clone(), name.clone(), url.clone())?;
manifest.save()?;
let should_download = crate::prompt::prompt_bool("Download song now?", Some(true));
let should_download = crate::prompt::prompt_bool("Download song now?", Some(false));
if should_download {
let song = &ManifestSong {
@ -32,6 +39,7 @@ pub async fn add(cfg: &ConfigWrapper, manifest: &mut Manifest, downloader: &mut
};
downloader.download_song(cfg, song, &genre, &manifest.format()?).await?;
downloader.wait_for_procs(0).await?;
}
Ok(())

View File

@ -31,8 +31,11 @@ pub enum CliCommand {
#[default]
Download,
Add {
#[arg(long, short)]
url: Option<String>,
#[arg(long, short)]
name: Option<String>,
#[arg(long, short)]
genre: Option<String>
}
}

View File

@ -87,7 +87,7 @@ impl Downloader {
Ok(())
}
async fn wait_for_procs(&mut self, until: usize) -> anyhow::Result<()> {
pub async fn wait_for_procs(&mut self, until: usize) -> anyhow::Result<()> {
// NOTE: This looks really fucked because i dont want to deadlock the processes so i lock PROCESSES for as little as possible
// NOTE: So its also kinda really slow
loop {

View File

@ -50,6 +50,11 @@ impl Manifest {
}
pub fn add_song(&mut self, genre: String, name: String, url: String) -> anyhow::Result<()> {
if !self.genres.contains_key(&genre) {
self.genres.insert(genre.clone(), Vec::new());
}
let Some(genre_ref) = self.genres.get_mut(&genre) else {
log::error!("Invalid genre '{}'", genre);
bail!("Invalid genre")