Move listenbrainz user to env var

This commit is contained in:
jude 2023-09-09 20:48:46 +01:00
parent 9c689d73d6
commit 5ff56d8396
3 changed files with 18 additions and 16 deletions

View File

@ -13,18 +13,9 @@
<cargoProject FILE="$PROJECT_DIR$/navidrome/Cargo.toml" />
</component>
<component name="ChangeListManager">
<list default="true" id="52900e09-9584-4b6c-95ff-fbd4ed5d8b2c" name="Changes" comment="Structure">
<change afterPath="$PROJECT_DIR$/navidrome/src/client/library.rs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/daemon/mod.rs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/daemon/update_tracks.rs" afterDir="false" />
<list default="true" id="52900e09-9584-4b6c-95ff-fbd4ed5d8b2c" name="Changes" comment="Track media server songs list">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/navidrome/src/client/builder.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/client/builder.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/navidrome/src/client/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/client/mod.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/navidrome/src/client/playlists.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/client/playlists.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/navidrome/src/models/navidrome.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/models/navidrome.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/daemon.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/daemon/update_playlists.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/listenbrainz.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/listenbrainz.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.rs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -109,6 +100,7 @@
<env name="DATABASE_URL" value="postgres:///navidrome-playlists" />
<env name="NAVIDROME_BASE" value="https://navidrome.jellypro.xyz" />
<env name="NAVIDROME_TOKEN" value="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG0iOnRydWUsImV4cCI6MTY5NDM2MjkyNywiaWF0IjoxNjk0MjcyNzE1LCJpc3MiOiJORCIsInN1YiI6Imp1ZGUiLCJ1aWQiOiIyZjljNTFiMi03MThmLTRiZmYtYjhkYi03MzE0ODdmZmFhYmIifQ.XNpfkjJI7wXq4EzGM-s7dQAXyCBAyN4Dmy4frbRMXPU" />
<env name="LISTENBRAINZ_USER" value="jellywx" />
</envs>
<option name="isRedirectInput" value="false" />
<option name="redirectInputPath" value="" />
@ -136,7 +128,7 @@
<workItem from="1692003763542" duration="5103000" />
<workItem from="1692042976149" duration="10055000" />
<workItem from="1694271920428" duration="9295000" />
<workItem from="1694285959491" duration="137000" />
<workItem from="1694285959491" duration="2258000" />
</task>
<task id="LOCAL-00001" summary="Structure">
<created>1692008860369</created>
@ -145,7 +137,15 @@
<option name="project" value="LOCAL" />
<updated>1692008860369</updated>
</task>
<option name="localTasksCounter" value="2" />
<task id="LOCAL-00002" summary="Track media server songs list">
<option name="closed" value="true" />
<created>1694286183476</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1694286183476</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -153,7 +153,8 @@
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Structure" />
<option name="LAST_COMMIT_MESSAGE" value="Structure" />
<MESSAGE value="Track media server songs list" />
<option name="LAST_COMMIT_MESSAGE" value="Track media server songs list" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View File

@ -1,4 +1,5 @@
use serde::Deserialize;
use std::fmt::Display;
const BASE: &'static str = "https://api.listenbrainz.org/1";
@ -74,7 +75,7 @@ pub struct RecordingsEntry {
}
pub async fn recordings(
user: &str,
user: impl Display,
range: StatsRange,
) -> Result<RecordingsPayload, reqwest::Error> {
let url = format!(

View File

@ -61,7 +61,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
async fn index(State(pool): State<PgPool>) -> String {
let response = listenbrainz::recordings("jellywx", StatsRange::Week)
let response = listenbrainz::recordings(env::var("LISTENBRAINZ_USER")?, StatsRange::Week)
.await
.unwrap();