Autoformat
This commit is contained in:
parent
12c5a1f731
commit
85f0b77b2b
2 changed files with 16 additions and 9 deletions
|
@ -532,14 +532,15 @@ fn list_playlists(request: &mut Request, db: &DB) -> IronResult<Response> {
|
|||
}
|
||||
|
||||
let playlist_name = playlist::list_playlists(&username, db)?;
|
||||
let playlists: Vec<ListPlaylistsOutput> = playlist_name.into_iter().map(|p| ListPlaylistsOutput{
|
||||
name: p,
|
||||
}).collect();
|
||||
let playlists: Vec<ListPlaylistsOutput> = playlist_name
|
||||
.into_iter()
|
||||
.map(|p| ListPlaylistsOutput { name: p })
|
||||
.collect();
|
||||
|
||||
let result_json = serde_json::to_string(&playlists);
|
||||
let result_json = match result_json {
|
||||
Ok(j) => j,
|
||||
Err(e) => return Err(IronError::new(e, status::InternalServerError)),
|
||||
};
|
||||
Ok(Response::with((status::Ok, result_json)))
|
||||
Ok(Response::with((status::Ok, result_json)))
|
||||
}
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -109,7 +109,9 @@ fn run() -> Result<()> {
|
|||
options.optopt("w", "web", "set the path to web client files", "DIRECTORY");
|
||||
|
||||
#[cfg(unix)]
|
||||
options.optflag("f", "foreground", "run polaris in the foreground instead of daemonizing");
|
||||
options.optflag("f",
|
||||
"foreground",
|
||||
"run polaris in the foreground instead of daemonizing");
|
||||
|
||||
options.optflag("h", "help", "print this help menu");
|
||||
|
||||
|
@ -151,9 +153,9 @@ fn run() -> Result<()> {
|
|||
let index_sender = Arc::new(Mutex::new(index_sender));
|
||||
let db_ref = db.clone();
|
||||
std::thread::spawn(move || {
|
||||
let db = db_ref.deref();
|
||||
index::update_loop(db, index_receiver);
|
||||
});
|
||||
let db = db_ref.deref();
|
||||
index::update_loop(db, index_receiver);
|
||||
});
|
||||
|
||||
// Trigger auto-indexing
|
||||
let db_ref = db.clone();
|
||||
|
@ -178,7 +180,11 @@ fn run() -> Result<()> {
|
|||
mount.mount("/", Static::new(web_dir_path));
|
||||
|
||||
println!("Starting up server");
|
||||
let port: u16 = matches.opt_str("p").unwrap_or("5050".to_owned()).parse().or(Err("invalid port number"))?;
|
||||
let port: u16 = matches
|
||||
.opt_str("p")
|
||||
.unwrap_or("5050".to_owned())
|
||||
.parse()
|
||||
.or(Err("invalid port number"))?;
|
||||
let mut server = match Iron::new(mount).http(("0.0.0.0", port)) {
|
||||
Ok(s) => s,
|
||||
Err(e) => bail!("Error starting up server: {}", e),
|
||||
|
|
Loading…
Add table
Reference in a new issue