This commit is contained in:
Jordan Petridis 2018-03-03 16:45:37 +02:00
parent 3da503cdea
commit bb467b7aba
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6
5 changed files with 53 additions and 70 deletions

View File

@ -16,7 +16,7 @@ type Pool = r2d2::Pool<ConnectionManager<SqliteConnection>>;
embed_migrations!("migrations/");
lazy_static!{
lazy_static! {
static ref POOL: Pool = init_pool(DB_PATH.to_str().unwrap());
}
@ -30,10 +30,7 @@ extern crate tempdir;
#[cfg(test)]
lazy_static! {
static ref TEMPDIR: tempdir::TempDir = {
tempdir::TempDir::new("hammond_unit_test").unwrap()
};
static ref TEMPDIR: tempdir::TempDir = { tempdir::TempDir::new("hammond_unit_test").unwrap() };
static ref DB_PATH: PathBuf = TEMPDIR.path().join("hammond.db");
}

View File

@ -311,7 +311,6 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_MINIMAL_INTERCEPTED_2: NewEpisodeMinimal = {
NewEpisodeMinimalBuilder::default()
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
@ -325,13 +324,12 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_INTERCEPTED_1: NewEpisode = {
let descr = "NSA whistleblower Edward Snowden discusses the massive Equifax data breach \
and allegations of Russian interference in the US election. Commentator \
Shaun King explains his call for a boycott of the NFL and talks about his \
campaign to bring violent neo-Nazis to justice. Rapper Open Mike Eagle \
performs.";
let descr = "NSA whistleblower Edward Snowden discusses the massive Equifax data \
breach and allegations of Russian interference in the US election. \
Commentator Shaun King explains his call for a boycott of the NFL and \
talks about his campaign to bring violent neo-Nazis to justice. Rapper \
Open Mike Eagle performs.";
NewEpisodeBuilder::default()
.title("The Super Bowl of Racism")
@ -347,16 +345,15 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_INTERCEPTED_2: NewEpisode = {
let descr = "This week on Intercepted: Jeremy gives an update on the aftermath of \
Blackwaters 2007 massacre of Iraqi civilians. Intercept reporter Lee Fang \
lays out how a network of libertarian think tanks called the Atlas Network \
is insidiously shaping political infrastructure in Latin America. We speak \
with attorney and former Hugo Chavez adviser Eva Golinger about the \
Venezuela\'s political turmoil.And we hear Claudia Lizardo of the \
Caracas-based band, La Pequeña Revancha, talk about her music and hopes for \
Venezuela.";
Blackwaters 2007 massacre of Iraqi civilians. Intercept reporter Lee \
Fang lays out how a network of libertarian think tanks called the Atlas \
Network is insidiously shaping political infrastructure in Latin \
America. We speak with attorney and former Hugo Chavez adviser Eva \
Golinger about the Venezuela\'s political turmoil.And we hear Claudia \
Lizardo of the Caracas-based band, La Pequeña Revancha, talk about her \
music and hopes for Venezuela.";
NewEpisodeBuilder::default()
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
@ -372,7 +369,6 @@ mod tests {
.build()
.unwrap()
};
static ref UPDATED_DURATION_INTERCEPTED_1: NewEpisode = {
NewEpisodeBuilder::default()
.title("The Super Bowl of Racism")
@ -388,7 +384,6 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_MINIMAL_LUP_1: NewEpisodeMinimal = {
NewEpisodeMinimalBuilder::default()
.title("Hacking Devices with Kali Linux | LUP 214")
@ -402,7 +397,6 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_MINIMAL_LUP_2: NewEpisodeMinimal = {
NewEpisodeMinimalBuilder::default()
.title("Gnome Does it Again | LUP 213")
@ -416,12 +410,11 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_LUP_1: NewEpisode = {
let descr = "Audit your network with a couple of easy commands on Kali Linux. Chris \
decides to blow off a little steam by attacking his IoT devices, Wes has the \
scope on Equifax blaming open source &amp; the Beard just saved the show. \
Its a really packed episode!";
decides to blow off a little steam by attacking his IoT devices, Wes has \
the scope on Equifax blaming open source &amp; the Beard just saved the \
show. Its a really packed episode!";
NewEpisodeBuilder::default()
.title("Hacking Devices with Kali Linux | LUP 214")
@ -437,13 +430,13 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_LUP_2: NewEpisode = {
let descr = "The Gnome project is about to solve one of our audience's biggest Waylands \
concerns. But as the project takes on a new level of relevance, decisions for the \
next version of Gnome have us worried about the future.\nPlus we chat with Wimpy \
about the Ubuntu Rally in NYC, Microsofts sneaky move to turn Windows 10 into the \
ULTIMATE LINUX RUNTIME, community news &amp; more!";
let descr = "The Gnome project is about to solve one of our audience's biggest \
Waylands concerns. But as the project takes on a new level of \
relevance, decisions for the next version of Gnome have us worried about \
the future.\nPlus we chat with Wimpy about the Ubuntu Rally in NYC, \
Microsofts sneaky move to turn Windows 10 into the ULTIMATE LINUX \
RUNTIME, community news &amp; more!";
NewEpisodeBuilder::default()
.title("Gnome Does it Again | LUP 213")

View File

@ -162,13 +162,14 @@ mod tests {
use std::io::BufReader;
// Pre-built expected NewPodcast structs.
lazy_static!{
lazy_static! {
static ref EXPECTED_INTERCEPTED: NewPodcast = {
let descr = "The people behind The Intercepts fearless reporting and incisive \
commentaryJeremy Scahill, Glenn Greenwald, Betsy Reed and othersdiscuss \
the crucial issues of our time: national security, civil liberties, foreign \
policy, and criminal justice. Plus interviews with artists, thinkers, and \
newsmakers who challenge our preconceptions about the world we live in.";
commentaryJeremy Scahill, Glenn Greenwald, Betsy Reed and \
othersdiscuss the crucial issues of our time: national security, civil \
liberties, foreign policy, and criminal justice. Plus interviews with \
artists, thinkers, and newsmakers who challenge our preconceptions about \
the world we live in.";
NewPodcastBuilder::default()
.title("Intercepted with Jeremy Scahill")
@ -183,11 +184,10 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_LUP: NewPodcast = {
let descr = "An open show powered by community LINUX Unplugged takes the best attributes \
of open collaboration and focuses them into a weekly lifestyle show about \
Linux.";
let descr = "An open show powered by community LINUX Unplugged takes the best \
attributes of open collaboration and focuses them into a weekly \
lifestyle show about Linux.";
NewPodcastBuilder::default()
.title("LINUX Unplugged Podcast")
@ -200,17 +200,16 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_TIPOFF: NewPodcast = {
let desc = "Welcome to The Tip Off- the podcast where we take you behind the scenes of \
some of the best investigative journalism from recent years. Each episode \
well be digging into an investigative scoop- hearing from the journalists \
behind the work as they tell us about the leads, the dead-ends and of course, \
the tip offs. Therell be car chases, slammed doors, terrorist cells, \
meetings in dimly lit bars and cafes, wrangling with despotic regimes and \
much more. So if youre curious about the fun, complicated detective work \
that goes into doing great investigative journalism- then this is the podcast \
for you.";
let desc = "Welcome to The Tip Off- the podcast where we take you behind the scenes \
of some of the best investigative journalism from recent years. Each \
episode well be digging into an investigative scoop- hearing from the \
journalists behind the work as they tell us about the leads, the \
dead-ends and of course, the tip offs. Therell be car chases, slammed \
doors, terrorist cells, meetings in dimly lit bars and cafes, wrangling \
with despotic regimes and much more. So if youre curious about the fun, \
complicated detective work that goes into doing great investigative \
journalism- then this is the podcast for you.";
NewPodcastBuilder::default()
.title("The Tip Off")
@ -223,15 +222,13 @@ mod tests {
.source_id(42)
.build()
.unwrap()
};
static ref EXPECTED_STARS: NewPodcast = {
let descr = "<p>The first audio drama from Tor Labs and Gideon Media, Steal the Stars is \
a gripping noir science fiction thriller in 14 episodes: Forbidden love, a \
crashed UFO, an alien body, and an impossible heist unlike any ever \
attempted - scripted by Mac Rogers, the award-winning playwright and writer \
of the multi-million download The Message and LifeAfter.</p>";
let descr = "<p>The first audio drama from Tor Labs and Gideon Media, Steal the Stars \
is a gripping noir science fiction thriller in 14 episodes: Forbidden \
love, a crashed UFO, an alien body, and an impossible heist unlike any \
ever attempted - scripted by Mac Rogers, the award-winning playwright \
and writer of the multi-million download The Message and LifeAfter.</p>";
let img = "https://dfkfj8j276wwv.cloudfront.net/images/2c/5f/a0/1a/2c5fa01a-ae78-4a8c-\
b183-7311d2e436c3/b3a4aa57a576bb662191f2a6bc2a436c8c4ae256ecffaff5c4c54fd42e\
923914941c264d01efb1833234b52c9530e67d28a8cebbe3d11a4bc0fbbdf13ecdf1c3.jpeg";
@ -245,11 +242,10 @@ mod tests {
.build()
.unwrap()
};
static ref EXPECTED_CODE: NewPodcast = {
let descr = "A podcast about humans and technology. Panelists: Coraline Ada Ehmke, David \
Brady, Jessica Kerr, Jay Bobo, Astrid Countee and Sam Livingston-Gray. \
Brought to you by @therubyrep.";
let descr = "A podcast about humans and technology. Panelists: Coraline Ada Ehmke, \
David Brady, Jessica Kerr, Jay Bobo, Astrid Countee and Sam \
Livingston-Gray. Brought to you by @therubyrep.";
NewPodcastBuilder::default()
.title("Greater Than Code")
@ -262,7 +258,6 @@ mod tests {
.build()
.unwrap()
};
static ref UPDATED_DESC_INTERCEPTED: NewPodcast = {
NewPodcastBuilder::default()
.title("Intercepted with Jeremy Scahill")

View File

@ -73,9 +73,8 @@ impl DownloadProgress for Progress {
}
lazy_static! {
pub static ref ACTIVE_DOWNLOADS: Arc<RwLock<HashMap<i32, Arc<Mutex<Progress>>>>> = {
Arc::new(RwLock::new(HashMap::new()))
};
pub static ref ACTIVE_DOWNLOADS: Arc<RwLock<HashMap<i32, Arc<Mutex<Progress>>>>> =
{ Arc::new(RwLock::new(HashMap::new())) };
}
pub fn add(id: i32, directory: &str, sender: Sender<Action>) -> Result<(), Error> {

View File

@ -74,9 +74,8 @@ fn refresh_feed(source: Option<Vec<Source>>, sender: Sender<Action>) -> Result<(
}
lazy_static! {
static ref CACHED_PIXBUFS: RwLock<HashMap<(i32, u32), Mutex<SendCell<Pixbuf>>>> = {
RwLock::new(HashMap::new())
};
static ref CACHED_PIXBUFS: RwLock<HashMap<(i32, u32), Mutex<SendCell<Pixbuf>>>> =
{ RwLock::new(HashMap::new()) };
}
// Since gdk_pixbuf::Pixbuf is refference counted and every episode,