-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added youtube links to the first few hits and added youtube download …
…when starting up the server
- Loading branch information
Showing
5 changed files
with
136 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
Interpret;Jahr;Titel | ||
O-Zone;2003;Dragostea Din Tei | ||
Dr. Alban;1993;Sing Hallelujah! | ||
Sister Sledge;1979;We Are Family | ||
Spider Murphy Gang;1987;So a Nacht | ||
Jennifer Lopez;1999;If You Had My Love | ||
Gebrüder Blattschuss;1978;Kreuzberger Nächte | ||
Andrea Jürgens;1990;Wir tanzen Lambada | ||
Culture Beat;1993;Mr. Vain | ||
The Bangles;1986;Manic Monday | ||
Udo Jürgens;1965;Siebzehn Jahr, blondes Haar | ||
U96;1992;Das Boot | ||
Hans Kröger;1988;Der blonde Hans | ||
Andrea Jürgens;1991;Santa Catarina | ||
Wencke Myhre;1970;Er hat ein knallrotes Gummiboot | ||
Fats Domino;1955;Ain't That A Shame | ||
Drafi Deutscher;1965;Marmor, Stein und Eisen bricht | ||
Juli;2004;Perfekte Welle | ||
Duffy;2008;Mercy | ||
Sigrid & Marina;2010;Zwei Senoritas | ||
Chicago;1976;If You Leave Me Right Now | ||
Ben Zucker;2018;Der Sonne entgegen | ||
P!nk (feat. Nate Reuss);2013;Just Give Me A Reason | ||
Michael Holm;1974;Tränen lügen nicht | ||
Maite Kelly;2016;Sieben Leben für dich | ||
Stefan Raab;1999;Maschen-Draht-Zaun | ||
Stefan Waggershausen, Viktor Lazlo;1990;Das erste Mal tat's noch weh | ||
Oliver Haidt;1996;Lebenslänglich Du | ||
The Kinks;1970;Lola | ||
Nelly (feat.Kelly Rowland);2002;Dilemma | ||
Demis Roussos;1973;Schönes Mädchen aus Arcadia | ||
Dschinghis Khan;1979;Moskau | ||
Liane ;2014;Ich lass' nur noch Sonne in mein Herz | ||
Gitti und Erica;1977;Heidi | ||
Connie Francis;1964;Schöner fremder Mann | ||
Wildecker Herzbuben;1990;Herzilein | ||
Carly Simon;1972;You're So Vain | ||
Farank Lars;2010;Ich kann nicht ohne dich | ||
Glenn Miller;1939;In The Mood | ||
Brunner & Brunner;1994;Für dich | ||
Die Toten Hosen;2012;Tage wie diese | ||
Christoff;2012;Ich Hab Alain Delon geseh'n | ||
Bill Medley & Jennifer Warnes;1987;(I've Had) The Time Of My Life | ||
Ibo;1998;Ein Himmelbett im Internet | ||
Klostertaler;1997;Ha-Le-Lu-Ja | ||
Freddy Quinn;1956;Heimweh (Dort wo die Blumen blüh'n) | ||
Oliver Pocher;2006;Schwarz und weiss | ||
Wolkenfrei;2014;Ich versprech Dir nichts und geb' Dir alles | ||
Eurythmics;1983;Sweet Dreams (Are Made Of This) | ||
Peter Wackel;2005;Oberammergau | ||
Interpret;Jahr;Titel;Yutube-Link;Abspiel-Beginn (in Sekunden) | ||
O-Zone;2003;Dragostea Din Tei;https://www.youtube.com/watch?v=YnopHCL1Jk8;53 | ||
Dr. Alban;1993;Sing Hallelujah!;https://www.youtube.com/watch?v=pKxJca7LLNM;0 | ||
Sister Sledge;1979;We Are Family;https://www.youtube.com/watch?v=uyGY2NfYpeE;0 | ||
Spider Murphy Gang;1987;So a Nacht;https://www.youtube.com/watch?v=sox_-1x-VGw;0 | ||
Jennifer Lopez;1999;If You Had My Love;https://www.youtube.com/watch?v=lYfkl-HXfuU;35 | ||
Gebrüder Blattschuss;1978;Kreuzberger Nächte;https://www.youtube.com/watch?v=GNTo1LWnFjg;18 | ||
Andrea Jürgens;1990;Wir tanzen Lambada;; | ||
Culture Beat;1993;Mr. Vain;; | ||
The Bangles;1986;Manic Monday;; | ||
Udo Jürgens;1965;Siebzehn Jahr, blondes Haar;; | ||
U96;1992;Das Boot;; | ||
Hans Kröger;1988;Der blonde Hans;; | ||
Andrea Jürgens;1991;Santa Catarina;; | ||
Wencke Myhre;1970;Er hat ein knallrotes Gummiboot;; | ||
Fats Domino;1955;Ain't That A Shame;; | ||
Drafi Deutscher;1965;Marmor, Stein und Eisen bricht;; | ||
Juli;2004;Perfekte Welle;; | ||
Duffy;2008;Mercy;; | ||
Sigrid & Marina;2010;Zwei Senoritas;; | ||
Chicago;1976;If You Leave Me Right Now;; | ||
Ben Zucker;2018;Der Sonne entgegen;; | ||
P!nk (feat. Nate Reuss);2013;Just Give Me A Reason;; | ||
Michael Holm;1974;Tränen lügen nicht;; | ||
Maite Kelly;2016;Sieben Leben für dich;; | ||
Stefan Raab;1999;Maschen-Draht-Zaun;; | ||
Stefan Waggershausen, Viktor Lazlo;1990;Das erste Mal tat's noch weh;; | ||
Oliver Haidt;1996;Lebenslänglich Du;; | ||
The Kinks;1970;Lola;; | ||
Nelly (feat.Kelly Rowland);2002;Dilemma;; | ||
Demis Roussos;1973;Schönes Mädchen aus Arcadia;; | ||
Dschinghis Khan;1979;Moskau;; | ||
Liane ;2014;Ich lass' nur noch Sonne in mein Herz;; | ||
Gitti und Erica;1977;Heidi;; | ||
Connie Francis;1964;Schöner fremder Mann;; | ||
Wildecker Herzbuben;1990;Herzilein;; | ||
Carly Simon;1972;You're So Vain;; | ||
Farank Lars;2010;Ich kann nicht ohne dich;; | ||
Glenn Miller;1939;In The Mood;; | ||
Brunner & Brunner;1994;Für dich;; | ||
Die Toten Hosen;2012;Tage wie diese;; | ||
Christoff;2012;Ich Hab Alain Delon geseh'n;; | ||
Bill Medley & Jennifer Warnes;1987;(I've Had) The Time Of My Life;; | ||
Ibo;1998;Ein Himmelbett im Internet;; | ||
Klostertaler;1997;Ha-Le-Lu-Ja;; | ||
Freddy Quinn;1956;Heimweh (Dort wo die Blumen blüh'n);; | ||
Oliver Pocher;2006;Schwarz und weiss;; | ||
Wolkenfrei;2014;Ich versprech Dir nichts und geb' Dir alles;; | ||
Eurythmics;1983;Sweet Dreams (Are Made Of This);; | ||
Peter Wackel;2005;Oberammergau;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,75 @@ | ||
use regex::Regex; | ||
use rocket::{ | ||
fairing::{Fairing, Info, Kind}, | ||
Orbit, Rocket, | ||
}; | ||
use rusty_ytdl::{Video, VideoOptions, VideoQuality, VideoSearchOptions}; | ||
use std::{env, fs::create_dir_all, path::Path}; | ||
|
||
include!(concat!(env!("OUT_DIR"), "/hits.rs")); | ||
|
||
pub struct Hit { | ||
pub interpret: String, | ||
pub title: String, | ||
pub year: u32, | ||
pub yt_url: String, | ||
pub playback_offset: u16, | ||
} | ||
|
||
#[derive(Default)] | ||
pub struct HitsterDownloader {} | ||
|
||
#[rocket::async_trait] | ||
impl Fairing for HitsterDownloader { | ||
fn info(&self) -> Info { | ||
Info { | ||
kind: Kind::Liftoff, | ||
name: "Download hits", | ||
} | ||
} | ||
|
||
async fn on_liftoff(&self, _rocket: &Rocket<Orbit>) { | ||
let yt_id: Regex = Regex::new( | ||
r"^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*", | ||
) | ||
.unwrap(); | ||
|
||
let download_dir = env::var("DOWNLOAD_DIRECTORY").unwrap_or("./hits".to_string()); | ||
|
||
let _ = create_dir_all(download_dir.clone()); | ||
|
||
println!("Starting download of missing hits. This may take a while..."); | ||
|
||
for hit in get_all().iter() { | ||
if let Some(caps) = yt_id.captures(hit.yt_url.as_str()) { | ||
let id = &caps[7]; | ||
|
||
if !Path::new(&download_dir) | ||
.join(format!("{}.opus", id)) | ||
.is_file() | ||
{ | ||
let options = VideoOptions { | ||
quality: VideoQuality::HighestAudio, | ||
filter: VideoSearchOptions::Audio, | ||
..Default::default() | ||
}; | ||
let video = Video::new_with_options(id, options).unwrap(); | ||
|
||
println!( | ||
"Download {}: {} to {}.opus", | ||
hit.interpret.as_str(), | ||
hit.title.as_str(), | ||
id | ||
); | ||
|
||
video | ||
.download(format!("{}/{}.mp4", download_dir.as_str(), id)) | ||
.await | ||
.unwrap(); | ||
} | ||
} | ||
} | ||
|
||
println!("Download finished."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters