Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to cloofy. The format follows [Keep a Changelog](https://kee

## [Unreleased]

## [0.5.2] - 2026-11-10

YouTube Music's Home looks and works as in its own apps, and cloofy asks once for a star.

### Added

- **Moods on YouTube Music's Home.** Chips like Relax, Workout or Focus above the shelves show the Home of that mood, as on music.youtube.com, and picked again the whole Home. <kbd>↑</kbd> from the first shelf reaches them.
- **Quick picks as songs.** Quick picks and Trending songs show as songs in columns of four, with a small cover and the artists under the title. <kbd>↑</kbd> <kbd>↓</kbd> move within a column, <kbd>←</kbd> <kbd>→</kbd> from column to column. **Play all** plays the whole shelf in order.
- **The line above a shelf,** like "THE BEST HITS FOR INSTANT MORNING ENERGY.", where YouTube Music has one.
- **A star on GitHub.** On the second day you use cloofy, it asks once whether you'd give it a star on GitHub. Whatever you answer, it doesn't ask again.

### Changed

- **Songs on YouTube Music's Home play at once,** with their radio after them, as in YouTube Music's own apps, instead of opening the radio as a page. Their menu is a song's: add to queue, like, add to playlist.

### Fixed

- **An expired YouTube Music sign-in** stays at the bottom until you close it, instead of for a few seconds, and a click copies `cloofy login ytmusic` ([#27](https://github.com/parda21/cloofy/issues/27)).
- **YouTube's bot check.** When YouTube asks your connection to prove it isn't a bot, no song plays. cloofy said nothing and skipped song after song; now it says why at the bottom until music plays again, and so do `cloofy doctor` and `cloofy play`.

## [0.5.1] - 2026-11-05

cloofy takes on your terminal's colors or your own, and song notifications reach every terminal on Linux.
Expand Down Expand Up @@ -146,7 +166,8 @@ The first release.
- **Session restore.** The page, the selection and the last track come back after a restart.
- **Installer.** It sets everything up step by step.

[Unreleased]: https://github.com/parda21/cloofy/compare/v0.5.1...HEAD
[Unreleased]: https://github.com/parda21/cloofy/compare/v0.5.2...HEAD
[0.5.2]: https://github.com/parda21/cloofy/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/parda21/cloofy/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/parda21/cloofy/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/parda21/cloofy/compare/v0.3.0...v0.4.0
Expand Down
15 changes: 8 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = ["crates/*"]
exclude = ["vendor"]

[workspace.package]
version = "0.5.1"
version = "0.5.2"
edition = "2024"
rust-version = "1.90"
license = "MIT"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cloofy plays Spotify and YouTube Music in the terminal, one of them or both side
- **Plays on its own.** Spotify plays through librespot, and cloofy is a Spotify Connect device. It controls your other devices too, and follows them live. YouTube Music plays through mpv, which cloofy starts and stops itself, with no gap between songs.
- **Spotify, YouTube Music or both.** Install one, or both side by side: <kbd>S</kbd> or the switch in the top bar shows the other's Home, library and pages, as you left them.
- **YouTube Music without an account.** Home, search, every page, lyrics and song radios work signed out. Sign in with your browser for your library and likes.
- **YouTube Music's Home, as in its apps.** Moods like Relax or Workout narrow it down, and Quick picks show as songs that play at once, or all in a row.
- **Home and the DJ.** Your shelves and mixes, and on Spotify Made For You and the DJ with its voice between tracks. Ask the DJ for something, as in Spotify's apps, or let it pick something different. Crossfade if you like.
- **Your library.** Playlists, albums, artists, and on Spotify podcasts, in a sidebar or as a full page with covers.
- **Every page.** Playlists, albums and artist pages with popular tracks and releases, plus search with artwork.
Expand Down
45 changes: 42 additions & 3 deletions crates/cloofy-core/src/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,48 @@

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct Home {
pub greeting: String,
/// Moods and kinds of music that narrow Home down, shown above its shelves the way
/// music.youtube.com shows them. Empty for services without.
#[serde(default)]
pub chips: Vec<Chip>,
pub shelves: Vec<Shelf>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
impl Home {
/// The chip Home is narrowed to, if any.
pub fn chip(&self) -> Option<&Chip> {
self.chips.iter().find(|chip| chip.selected)
}
}

/// A mood or kind of music Home can be narrowed to, e.g. "Relax".
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Chip {
pub title: String,
/// What the service needs to show Home for this chip.
pub id: String,
/// Whether this Home is the chip's.
pub selected: bool,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct Shelf {
pub uri: String,
pub title: String,
/// A line above the title, e.g. "THE BEST HITS FOR INSTANT MORNING ENERGY.".
#[serde(default)]
pub strapline: String,
/// The compact grid of shortcuts at the top of Home.
pub shortcuts: bool,
/// Songs in columns of a few rows, like YouTube Music's Quick picks, instead of cards.
#[serde(default)]
pub songs: bool,
/// What the shelf's Play all button plays, when it has one.
#[serde(default)]
pub play_all: Option<String>,
pub items: Vec<HomeItem>,
}

Expand All @@ -37,6 +67,15 @@ pub struct HomeItem {
/// Playlist owner, to tell own playlists from the service's.
pub owner_id: String,
pub owner_name: String,
/// What to play: the show for an episode, the item itself otherwise.
/// What to play: the show for an episode, the song for a song's radio, the item itself
/// otherwise.
pub context_uri: String,
}

impl HomeItem {
/// A song shown as its radio: it plays at once, as in the services' own apps, and opens as
/// the radio.
pub fn is_song(&self) -> bool {
self.kind == ItemKind::Playlist && self.context_uri != self.uri
}
}
5 changes: 5 additions & 0 deletions crates/cloofy-core/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ pub enum PlayerEvent {
uri: String,
refused: bool,
},
/// Nothing can play until something outside cloofy changes, such as YouTube asking the
/// connection to prove it isn't a bot. Said once, until music plays again.
Blocked {
reason: String,
},
}

/// A track that plays later, as the player listed it.
Expand Down
2 changes: 2 additions & 0 deletions crates/cloofy-core/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use sha2::{Digest, Sha256};
use crate::paths::Paths;

const REPO: &str = "parda21/cloofy";
/// cloofy's page on GitHub.
pub const REPO_URL: &str = "https://github.com/parda21/cloofy";
const USER_AGENT: &str = concat!("cloofy/", env!("CARGO_PKG_VERSION"));
/// GitHub answers 60 requests an hour without an account; a look every few hours is plenty.
const CHECK_INTERVAL: Duration = Duration::from_secs(6 * 60 * 60);
Expand Down
2 changes: 1 addition & 1 deletion crates/cloofy-spotify/src/artist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ fn parse(data: &Value) -> Result<ArtistPage> {
let shelf = |title: &str, items: Vec<HomeItem>| Shelf {
uri: String::new(),
title: title.to_owned(),
shortcuts: false,
items,
..Shelf::default()
};
let shelves = [
shelf("Popular releases", releases(&discography["popularReleasesAlbums"], false)),
Expand Down
3 changes: 2 additions & 1 deletion crates/cloofy-spotify/src/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn parse(data: &Value) -> Result<Home> {
.flatten()
.filter_map(shelf)
.collect();
Ok(Home { greeting: text(home, "/greeting/transformedLabel"), shelves })
Ok(Home { greeting: text(home, "/greeting/transformedLabel"), shelves, ..Home::default() })
}

fn shelf(section: &Value) -> Option<Shelf> {
Expand All @@ -56,6 +56,7 @@ fn shelf(section: &Value) -> Option<Shelf> {
title: text(section, "/data/title/transformedLabel"),
shortcuts: section.pointer("/data/__typename").and_then(Value::as_str) == Some("HomeShortsSectionData"),
items,
..Shelf::default()
})
}

Expand Down
1 change: 1 addition & 0 deletions crates/cloofy-tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ futures.workspace = true
icy_sixel.workspace = true
image.workspace = true
nucleo-matcher.workspace = true
open.workspace = true
ratatui.workspace = true
ratatui-image.workspace = true
reqwest.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/cloofy-tui/src/app/browsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl App {
self.loader.library();
}
if let View::Home(v) = &self.view {
self.loader.home(v.id);
self.loader.home(v.id, v.filter.as_ref().map(|c| c.id.clone()));
}
if !self.demo {
self.load_cache();
Expand Down
10 changes: 9 additions & 1 deletion crates/cloofy-tui/src/app/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ impl App {
}

fn home_target(&self, item: &HomeItem) -> ContextTarget {
// A song shown as its radio is the song, as in YouTube Music's own menus.
if item.is_song() {
return target(&item.context_uri, &item.title, TargetKind::Track, item.image_url.clone());
}
let kind = match item.kind {
ItemKind::Playlist => TargetKind::Playlist,
ItemKind::Album => TargetKind::Album,
Expand Down Expand Up @@ -383,7 +387,11 @@ fn menu_items(target: &ContextTarget, saved: bool) -> Vec<(MenuAction, String)>
}

/// OSC 52: the terminal puts the text on the clipboard, which also works over SSH.
fn copy_to_clipboard(text: &str) {
pub(super) fn copy_to_clipboard(text: &str) {
// Tests have no terminal to tell.
if cfg!(test) {
return;
}
let mut stdout = std::io::stdout();
let _ = write!(stdout, "\x1b]52;c;{}\x07", STANDARD.encode(text));
let _ = stdout.flush();
Expand Down
Loading
Loading