Skip to content

Commit 088620c

Browse files
authored
Merge branch 'jpochyla:main' into user-view
2 parents 8f91928 + 31861f4 commit 088620c

File tree

36 files changed

+130
-131
lines changed

36 files changed

+130
-131
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
target: x86_64-unknown-linux-gnu
4141
- os: ubuntu-latest
4242
target: aarch64-unknown-linux-gnu
43-
- os: macOS-latest
43+
- os: macos-latest
4444
- os: windows-latest
4545

4646
runs-on: ${{ matrix.os }}
@@ -130,9 +130,8 @@ jobs:
130130
--icon "Psst.app" 150 160 \
131131
--hide-extension "Psst.app" \
132132
--app-drop-link 450 160 \
133-
--no-internet-enable \
134133
"Psst.dmg" \
135-
"target/release/bundle/osx/Psst.app"
134+
"../target/release/bundle/osx/Psst.app"
136135
working-directory: psst-gui
137136

138137
- name: Upload macOS DMG

psst-core/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use time::OffsetDateTime;
44

55
fn main() {
66
let outdir = env::var("OUT_DIR").unwrap();
7-
let outfile = format!("{}/build-time.txt", outdir);
7+
let outfile = format!("{outdir}/build-time.txt");
88

99
let mut fh = fs::File::create(outfile).unwrap();
1010
let now = OffsetDateTime::now_local().unwrap_or_else(|_| OffsetDateTime::now_utc());
11-
write!(fh, r#""{}""#, now).ok();
11+
write!(fh, r#""{now}""#).ok();
1212

1313
let git_config = File::from_git_dir("../.git/".into()).expect("Git Config not found!");
1414
// Get Git's 'Origin' URL
@@ -37,7 +37,7 @@ fn main() {
3737
let trimmed_url = remote_url.trim_end_matches(".git");
3838
remote_url.clone_from(&String::from(trimmed_url));
3939

40-
let outfile = format!("{}/remote-url.txt", outdir);
40+
let outfile = format!("{outdir}/remote-url.txt");
4141
let mut file = fs::File::create(outfile).unwrap();
42-
write!(file, r#""{}""#, remote_url).ok();
42+
write!(file, r#""{remote_url}""#).ok();
4343
}

psst-core/src/actor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub trait Actor: Sized {
5050
act = match self.handle(msg) {
5151
Ok(act) => act,
5252
Err(err) => {
53-
log::error!("error: {}", err);
53+
log::error!("error: {err}");
5454
break;
5555
}
5656
};

psst-core/src/audio/decode.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl AudioDecoder {
116116
return None; // End of this stream.
117117
}
118118
Err(err) => {
119-
log::error!("format error: {}", err);
119+
log::error!("format error: {err}");
120120
return None; // We cannot recover from format errors, quit.
121121
}
122122
};
@@ -137,16 +137,16 @@ impl AudioDecoder {
137137
}
138138
Err(SymphoniaError::IoError(err)) => {
139139
// The packet failed to decode due to an IO error, skip the packet.
140-
log::error!("io decode error: {}", err);
140+
log::error!("io decode error: {err}");
141141
continue;
142142
}
143143
Err(SymphoniaError::DecodeError(err)) => {
144144
// The packet failed to decode due to invalid data, skip the packet.
145-
log::error!("decode error: {}", err);
145+
log::error!("decode error: {err}");
146146
continue;
147147
}
148148
Err(err) => {
149-
log::error!("fatal decode error: {}", err);
149+
log::error!("fatal decode error: {err}");
150150
return None;
151151
}
152152
};

psst-core/src/audio/output/cpal.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl CpalOutput {
2424
.ok_or(cpal::DefaultStreamConfigError::DeviceNotAvailable)?;
2525

2626
if let Ok(name) = device.name() {
27-
log::info!("using audio device: {:?}", name);
27+
log::info!("using audio device: {name:?}");
2828
}
2929

3030
// Get the default device config, so we know what sample format and sample rate
@@ -159,14 +159,14 @@ impl Stream {
159159
state: CallbackState::Paused,
160160
};
161161

162-
log::info!("opening output stream: {:?}", config);
162+
log::info!("opening output stream: {config:?}");
163163
let stream = device.build_output_stream(
164164
&config,
165165
move |output, _| {
166166
callback.write_samples(output);
167167
},
168168
|err| {
169-
log::error!("audio output error: {}", err);
169+
log::error!("audio output error: {err}");
170170
},
171171
None,
172172
)?;
@@ -187,14 +187,14 @@ impl Actor for Stream {
187187
StreamMsg::Pause => {
188188
log::debug!("pausing audio output stream");
189189
if let Err(err) = self.stream.pause() {
190-
log::error!("failed to stop stream: {}", err);
190+
log::error!("failed to stop stream: {err}");
191191
}
192192
Ok(Act::Continue)
193193
}
194194
StreamMsg::Resume => {
195195
log::debug!("resuming audio output stream");
196196
if let Err(err) = self.stream.play() {
197-
log::error!("failed to start stream: {}", err);
197+
log::error!("failed to start stream: {err}");
198198
}
199199
Ok(Act::Continue)
200200
}

psst-core/src/cache.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn create_cache_dirs(base: &Path) -> io::Result<()> {
3030

3131
impl Cache {
3232
pub fn new(base: PathBuf) -> Result<CacheHandle, Error> {
33-
log::info!("using cache: {:?}", base);
33+
log::info!("using cache: {base:?}");
3434

3535
// Create the cache structure.
3636
create_cache_dirs(&base)?;
@@ -65,7 +65,7 @@ impl Cache {
6565
}
6666

6767
pub fn save_track(&self, item_id: ItemId, track: &Track) -> Result<(), Error> {
68-
log::debug!("saving track to cache: {:?}", item_id);
68+
log::debug!("saving track to cache: {item_id:?}");
6969
fs::write(self.track_path(item_id), serialize_protobuf(track)?)?;
7070
Ok(())
7171
}
@@ -83,7 +83,7 @@ impl Cache {
8383
}
8484

8585
pub fn save_episode(&self, item_id: ItemId, episode: &Episode) -> Result<(), Error> {
86-
log::debug!("saving episode to cache: {:?}", item_id);
86+
log::debug!("saving episode to cache: {item_id:?}");
8787
fs::write(self.episode_path(item_id), serialize_protobuf(episode)?)?;
8888
Ok(())
8989
}
@@ -106,7 +106,7 @@ impl Cache {
106106
file_id: FileId,
107107
key: &AudioKey,
108108
) -> Result<(), Error> {
109-
log::debug!("saving audio key to cache: {:?}:{:?}", item_id, file_id);
109+
log::debug!("saving audio key to cache: {item_id:?}:{file_id:?}");
110110
fs::write(self.audio_key_path(item_id, file_id), key.0)?;
111111
Ok(())
112112
}
@@ -126,7 +126,7 @@ impl Cache {
126126
}
127127

128128
pub fn save_audio_file(&self, file_id: FileId, from_path: PathBuf) -> Result<(), Error> {
129-
log::debug!("saving audio file to cache: {:?}", file_id);
129+
log::debug!("saving audio file to cache: {file_id:?}");
130130
fs::copy(from_path, self.audio_file_path(file_id))?;
131131
Ok(())
132132
}

psst-core/src/cdn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl From<ureq::Error> for Error {
121121
/// Constructs a Range header value for given offset and length.
122122
fn range_header(offfset: u64, length: u64) -> String {
123123
let last_byte = offfset + length - 1; // Offset of the last byte of the range is inclusive.
124-
format!("bytes={}-{}", offfset, last_byte)
124+
format!("bytes={offfset}-{last_byte}")
125125
}
126126

127127
/// Parses a total content length from a Content-Range response header.

psst-core/src/connection/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl Transport {
106106
ap_list
107107
}
108108
Err(err) => {
109-
log::error!("error while resolving APs, using fallback: {:?}", err);
109+
log::error!("error while resolving APs, using fallback: {err:?}");
110110
vec![AP_FALLBACK.into()]
111111
}
112112
}
@@ -119,7 +119,7 @@ impl Transport {
119119
}
120120

121121
let agent: ureq::Agent = default_ureq_agent_builder(proxy_url).build().into();
122-
log::info!("requesting AP list from {}", AP_RESOLVE_ENDPOINT);
122+
log::info!("requesting AP list from {AP_RESOLVE_ENDPOINT}");
123123
let data: APResolveData = agent
124124
.get(AP_RESOLVE_ENDPOINT)
125125
.call()?
@@ -145,23 +145,23 @@ impl Transport {
145145
match Self::stream_through_proxy(ap, url) {
146146
Ok(s) => s,
147147
Err(e) => {
148-
log::warn!("failed to connect to AP {} through proxy: {:?}", ap, e);
148+
log::warn!("failed to connect to AP {ap} through proxy: {e:?}");
149149
continue;
150150
}
151151
}
152152
} else {
153153
match Self::stream_without_proxy(ap) {
154154
Ok(s) => s,
155155
Err(e) => {
156-
log::warn!("failed to connect to AP {} without proxy: {:?}", ap, e);
156+
log::warn!("failed to connect to AP {ap} without proxy: {e:?}");
157157
continue;
158158
}
159159
}
160160
};
161161
if let Err(err) = stream.set_write_timeout(Some(NET_IO_TIMEOUT)) {
162-
log::warn!("failed to set TCP write timeout: {:?}", err);
162+
log::warn!("failed to set TCP write timeout: {err:?}");
163163
}
164-
log::info!("successfully connected to AP: {}", ap);
164+
log::info!("successfully connected to AP: {ap}");
165165
return Self::exchange_keys(stream);
166166
}
167167
log::error!("failed to connect to any access point");

psst-core/src/error.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ impl fmt::Display for Error {
4545
15 => write!(f, "Authentication failed: extra verification required"),
4646
16 => write!(f, "Authentication failed: invalid app key"),
4747
17 => write!(f, "Authentication failed: application banned"),
48-
_ => write!(f, "Authentication failed with error code {}", code),
48+
_ => write!(f, "Authentication failed with error code {code}"),
4949
},
5050
Self::ConnectionFailed => write!(f, "Failed to connect to any access point"),
5151
Self::ResamplingError(code) => {
52-
write!(f, "Resampling failed with error code {}", code)
52+
write!(f, "Resampling failed with error code {code}")
5353
}
54-
Self::ConfigError(msg) => write!(f, "Configuration error: {}", msg),
54+
Self::ConfigError(msg) => write!(f, "Configuration error: {msg}"),
5555
Self::JsonError(err)
5656
| Self::AudioFetchingError(err)
5757
| Self::AudioDecodingError(err)
@@ -60,9 +60,9 @@ impl fmt::Display for Error {
6060
| Self::AudioProbeError(err) => err.fmt(f),
6161
Self::IoError(err) => err.fmt(f),
6262
Self::SendError => write!(f, "Failed to send into a channel"),
63-
Self::RecvTimeoutError(err) => write!(f, "Channel receive timeout: {}", err),
63+
Self::RecvTimeoutError(err) => write!(f, "Channel receive timeout: {err}"),
6464
Self::JoinError => write!(f, "Failed to join thread"),
65-
Self::OAuthError(msg) => write!(f, "OAuth error: {}", msg),
65+
Self::OAuthError(msg) => write!(f, "OAuth error: {msg}"),
6666
}
6767
}
6868
}

psst-core/src/item_id.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ impl ItemId {
111111
pub fn to_uri(&self) -> Option<String> {
112112
let b64 = self.to_base62();
113113
match self.id_type {
114-
ItemIdType::Track => Some(format!("spotify:track:{}", b64)),
115-
ItemIdType::Podcast => Some(format!("spotify:podcast:{}", b64)),
114+
ItemIdType::Track => Some(format!("spotify:track:{b64}")),
115+
ItemIdType::Podcast => Some(format!("spotify:podcast:{b64}")),
116116
// TODO: support adding local files to playlists
117117
ItemIdType::LocalFile => None,
118118
ItemIdType::Unknown => None,
@@ -176,7 +176,7 @@ impl FileId {
176176
pub fn to_base16(&self) -> String {
177177
self.0
178178
.iter()
179-
.map(|b| format!("{:02x}", b))
179+
.map(|b| format!("{b:02x}"))
180180
.collect::<Vec<String>>()
181181
.concat()
182182
}

0 commit comments

Comments
 (0)