Skip to content

Commit 2433a08

Browse files
authored
Merge branch 'jpochyla:main' into main
2 parents d5637bc + 31861f4 commit 2433a08

39 files changed

+320
-263
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 23 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
@@ -301,33 +300,28 @@ jobs:
301300
with:
302301
path: artifacts
303302

304-
- name: Prepare Linux Release Assets
305-
run: |
306-
if [ -f "artifacts/psst-x86_64-unknown-linux-gnu/psst" ]; then
307-
mv "artifacts/psst-x86_64-unknown-linux-gnu/psst" "artifacts/psst-linux-x86_64" && \
308-
rmdir "artifacts/psst-x86_64-unknown-linux-gnu"
309-
fi
310-
if [ -f "artifacts/psst-aarch64-unknown-linux-gnu/psst" ]; then
311-
mv "artifacts/psst-aarch64-unknown-linux-gnu/psst" "artifacts/psst-linux-aarch64" && \
312-
rmdir "artifacts/psst-aarch64-unknown-linux-gnu"
313-
fi
314-
315303
- name: Prepare Release Body Data
316304
id: release_data
317305
run: |
318306
echo "CURRENT_DATE_STR=$(date)" >> $GITHUB_ENV
319307
320-
- name: Prepare All Release Assets
308+
- name: Prepare Release Assets
321309
id: prep_assets
322310
run: |
323-
V="${{ env.RELEASE_VERSION }}"
324-
mv artifacts/Psst.dmg/Psst.dmg "artifacts/Psst-${V}.dmg"
325-
mv artifacts/Psst.exe/psst-gui.exe "artifacts/Psst-${V}.exe"
326-
mv artifacts/psst-linux-x86_64 "artifacts/psst-linux-x86_64-${V}"
327-
mv artifacts/psst-linux-aarch64 "artifacts/psst-linux-aarch64-${V}"
328-
mv artifacts/psst-deb-amd64/psst-amd64.deb "artifacts/psst-amd64-${V}.deb"
329-
mv artifacts/psst-deb-arm64/psst-arm64.deb "artifacts/psst-arm64-${V}.deb"
330-
ls -R artifacts
311+
set -e
312+
mkdir -p artifacts_final
313+
314+
find artifacts -type f -name 'Psst.dmg' -exec mv {} artifacts_final/Psst.dmg \;
315+
find artifacts -type f -name 'psst-gui.exe' -exec mv {} artifacts_final/Psst.exe \;
316+
find artifacts -type f -name 'psst-amd64.deb' -exec mv {} artifacts_final/psst-amd64.deb \;
317+
find artifacts -type f -name 'psst-arm64.deb' -exec mv {} artifacts_final/psst-arm64.deb \;
318+
319+
find artifacts -type f -name 'psst' -path '*/psst-x86_64-unknown-linux-gnu/*' -exec mv {} artifacts_final/psst-linux-x86_64 \;
320+
find artifacts -type f -name 'psst' -path '*/psst-aarch64-unknown-linux-gnu/*' -exec mv {} artifacts_final/psst-linux-aarch64 \;
321+
322+
rm -rf artifacts
323+
mv artifacts_final artifacts
324+
ls -l artifacts/
331325
332326
- name: Create Main Release
333327
uses: softprops/action-gh-release@v2

.homebrew/generate_formula.sh

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,24 @@ set -eo pipefail
55
REPO_OWNER="jpochyla"
66
REPO_NAME="psst"
77

8-
# Get the latest release
9-
RELEASE_INFO_JSON=$(curl -sL "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest")
10-
: "${RELEASE_INFO_JSON:?Error: Could not fetch latest release info.}"
11-
12-
# Find the latest Psst.dmg, get its version, URL, and SHA256
13-
DATA=$(echo "$RELEASE_INFO_JSON" | jq -r '
14-
if .assets then
15-
.assets[]
16-
| select(.name | test("Psst-.*\\.dmg$"))
17-
| .name + " " + .browser_download_url + " " + .digest
18-
else
19-
empty
20-
end
21-
' | sort -V | tail -n 1)
22-
23-
# Check if we got data
24-
: "${DATA:?Error: Could not find a matching Psst.dmg asset.}"
25-
26-
# Extract variables from the data
27-
DMG_NAME=$(echo "$DATA" | awk '{print $1}')
28-
DMG_URL=$(echo "$DATA" | awk '{print $2}')
29-
SHA256=$(echo "$DATA" | awk '{print $3}' | sed 's/sha256://')
30-
31-
VERSION=$(echo "$DMG_NAME" | sed -n 's/^Psst-\(.*\)\.dmg$/\1/p')
32-
: "${VERSION:?Error: Could not extract version from DMG name.}"
33-
348
cat <<EOF
359
cask "psst" do
36-
version "${VERSION}"
37-
sha256 "${SHA256}"
10+
version :latest
11+
sha256 :no_check
3812
39-
url "${DMG_URL}",
40-
verified: "github.com/${REPO_OWNER}/${REPO_NAME}/"
13+
url "https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/latest/download/Psst.dmg"
4114
name "Psst"
4215
desc "Fast and native Spotify client"
4316
homepage "https://github.com/${REPO_OWNER}/${REPO_NAME}/"
4417
45-
livecheck do
46-
url "https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/latest"
47-
strategy :github_latest
48-
regex(%r{href=.*?/Psst-([^/]+?)\.dmg}i)
49-
end
18+
depends_on macos: ">= :big_sur"
5019
5120
app "Psst.app"
5221
53-
depends_on macos: ">= :big_sur"
54-
5522
zap trash: [
5623
"~/Library/Application Support/Psst",
57-
"~/Library/Caches/Psst",
5824
"~/Library/Caches/com.jpochyla.psst",
25+
"~/Library/Caches/Psst",
5926
"~/Library/HTTPStorages/com.jpochyla.psst",
6027
"~/Library/Preferences/com.jpochyla.psst.plist",
6128
"~/Library/Saved Application State/com.jpochyla.psst.savedState",

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You can download the latest release for Windows, Linux, and macOS from the [GitH
2323
| Debian Package (amd64) | [Download](https://github.com/jpochyla/psst/releases/latest/download/psst-amd64.deb) |
2424
| Debian Package (arm64) | [Download](https://github.com/jpochyla/psst/releases/latest/download/psst-arm64.deb) |
2525
| macOS | [Download](https://github.com/jpochyla/psst/releases/latest/download/Psst.dmg) |
26-
| Windows | [Download](https://github.com/jpochyla/psst/releases/latest/download/psst-gui.exe) |
26+
| Windows | [Download](https://github.com/jpochyla/psst/releases/latest/download/Psst.exe) |
2727

2828
Unofficial builds of Psst are also available through the [AUR](https://aur.archlinux.org/packages/psst-git) and [Homebrew](https://formulae.brew.sh/cask/psst).
2929

@@ -39,13 +39,13 @@ Our user-interface library, Druid, has two possible backends on Linux: GTK and p
3939
The default Linux backend is GTK.
4040
Before building on Linux, make sure the required dependencies are installed.
4141

42-
#### Debian/Ubuntu:
42+
### Debian/Ubuntu
4343

4444
```shell
4545
sudo apt-get install libssl-dev libgtk-3-dev libcairo2-dev libasound2-dev
4646
```
4747

48-
#### RHEL/Fedora:
48+
### RHEL/Fedora
4949

5050
```shell
5151
sudo dnf install openssl-devel gtk3-devel cairo-devel alsa-lib-devel
@@ -86,21 +86,21 @@ ulimit -d $(( 2 * `ulimit -d` ))
8686

8787
---
8888

89-
#### Build from Source:
89+
#### Build from Source
9090

9191
```shell
9292
cargo build
9393
# Append `--release` for a release build.
9494
```
9595

96-
#### Run from Source:
96+
#### Run from Source
9797

9898
```shell
9999
cargo run --bin psst-gui
100100
# Append `--release` for a release build.
101101
```
102102

103-
#### Build Installation Bundle (i.e., macOS .app):
103+
#### Build Installation Bundle (i.e., macOS .app)
104104

105105
```shell
106106
cargo install cargo-bundle

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");

0 commit comments

Comments
 (0)