Skip to content

Commit b3c8cf7

Browse files
authored
Merge pull request #113 from shinokada/feat/v3.7
feat: v3.7.0 Play history * **New Features** * Recently Played section in main menu (below Quick Play) with keyboard shortcuts and playback from recent list * Play History settings: enable/disable, size, duplicate handling, clear history * **Changed** * “Search History” renamed to “History” to consolidate search and play history controls * Quick Play layout and shortcut numbering updated * Play History now persisted with sensible defaults and validation * **Documentation** * README and guides updated for Recently Played and History settings * **Tests** * Added tests for Recently Played and Play History defaults/validation
2 parents 8c96eef + 4f75a73 commit b3c8cf7

File tree

10 files changed

+952
-367
lines changed

10 files changed

+952
-367
lines changed

v3/CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ All notable changes to TERA will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.7.0] - 2026-03-08
9+
10+
### Added
11+
- **Recently Played** — Last N stations now appear in the main menu below Quick Play Favorites, with number shortcuts continuing from where Quick Play ends.
12+
- Navigate and play with `↑↓` + `Enter` or number shortcuts
13+
- Shows station name, country, and time since last played
14+
- `` indicator marks the currently playing station
15+
- Zero new storage — reuses `station_metadata.json` via `MetadataManager`
16+
- **Play History settings** (`Settings > History > Play History`)
17+
- Toggle show/hide (`1`)
18+
- Increase/decrease section size, 1–20 stations (`2`/`3`)
19+
- Toggle Allow Duplicate (`4`)
20+
- Clear all play history (`5`)
21+
- **History top-level menu**`Settings > 5. History` now acts as a switcher between Search History and Play History sub-menus, with stats (search items count, tracked stations count).
22+
23+
### Changed
24+
- Settings menu item `Search History` renamed to `History` to cover both search and play history.
25+
- `PlayHistoryConfig` added to unified `config.yaml` (`play_history` section).
26+
27+
### Tests
28+
- Added `internal/ui/app_test.go`: `TestLoadRecentlyPlayed_*` and `TestPlayRecentStation_*` covering disabled state, nil manager, empty history, size clamping, valid/invalid indices.
29+
- `internal/config/config_test.go`: `TestPlayHistoryConfigDefaults` and `TestPlayHistoryConfigValidation` (added in Phase 1).
30+
831
## [3.5.1] - 2026-02-26
932

1033
* **Documentation**

v3/README.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ A terminal-based internet radio player powered by [Radio Browser](https://www.ra
1010
-**Star Ratings** - Rate stations 1-5 stars and browse your top-rated collection
1111
- 🏷️ **Custom Tags** - Tag stations with personal labels and build dynamic playlists
1212
-**Quick Play** - Direct playback from main menu (shortcuts 10-99+)
13+
- 🕐 **Recently Played** - Last N stations shown below Quick Play Favorites in the main menu
1314
- 🔊 **Playback Control** - Play/pause with persistent status, adjust volume, and mute during playback
1415
- 🚫 **Block List** - Block unwanted stations from appearing in searches and auto-play
1516
- ☁️ **Gist Sync** - Backup and restore favorites via GitHub Gists
@@ -300,7 +301,7 @@ Access app configuration from the main menu (Settings: `-`):
300301
- **Appearance** - Customize header display (text, ASCII art, alignment, colors, padding)
301302
- **Connection Settings** - Auto-reconnect and buffering for unstable networks (4G/GPRS)
302303
- **Shuffle Settings** - Configure shuffle mode behavior (auto-advance, history size)
303-
- **Search History** - View and clear your search history
304+
- **History** - Search history and Recently Played display settings
304305
- **Check for Updates** - View current version and check for new releases
305306
- **About TERA** - See version, installation method, and update command
306307

@@ -338,40 +339,45 @@ For users on unstable networks (mobile data, GPRS, 4G), configure automatic reco
338339

339340
Settings stored in the config directory (see [File Locations](#file-locations)).
340341

341-
### Quick Play from Main Menu
342+
### Quick Play & Recently Played
342343

343-
The main menu shows your "My-favorites" list with shortcuts 10-99+. Type the number to play instantly:
344+
The main menu shows two instant-access sections below the regular menu:
344345

345-
```
346+
```text
346347
Main Menu & Quick Play
347348
348349
Choose an option:
349350
350351
1. Play from Favorites
351-
2. Search Stations
352-
3. Most Played
353-
4. Top Rated
354-
5. Browse by Tag
355-
6. Tag Playlists
356-
7. Manage Lists
357-
8. Block List
358-
9. I Feel Lucky
359-
0. Gist Management
352+
...
360353
-. Settings
361354
362355
─── Quick Play Favorites ───
363356
10. Jazz FM • UK • MP3 192kbps
364357
11. BBC Radio 6 Music • UK • AAC 128kbps
365-
12. KEXP 90.3 FM • US • AAC 128kbps
366358
367-
Type 10-12 to play instantly!
359+
─── Recently Played ───
360+
12. WBGO Jazz 88.3 • United States • 3 minutes ago
361+
13. FIP • France • 1 hour ago
362+
14. Radio Swiss Jazz • Switzerland • Yesterday
363+
364+
Type 10-14 to play instantly!
368365
```
369366

367+
**Quick Play Favorites:** Stations from "My-favorites.json" with shortcuts starting at 10.
368+
369+
**Recently Played:** Your last N stations (default 5), shown in most-recently-played order. Shortcuts continue from where Quick Play Favorites end.
370+
370371
**How it works:**
371-
- Stations from "My-favorites.json" appear with shortcuts 10+
372-
- Type the number (e.g., `11`) and press Enter
373-
- Station plays immediately
372+
- Type the shortcut number and press Enter, or navigate with `↑↓` and press Enter
373+
- Station plays immediately via the shared player
374374
- Press `Esc` to stop playback
375+
- The `` indicator marks the currently playing station in both sections
376+
377+
**Configure Recently Played:**
378+
1. Press `-` from the main menu → Settings
379+
2. Select **5. History → 2. Play History**
380+
3. Toggle show/hide, adjust size (1-20), toggle allow duplicate, or clear history
375381

376382
## Theme Configuration
377383

@@ -584,7 +590,7 @@ You can edit this file directly or use the Settings menu.
584590
| -------- | ---------------------------- |
585591
| `0` | Gist Management |
586592
| `1-9` | Quick select menu item |
587-
| `10-99+` | Quick play from My-favorites |
593+
| `10-99+` | Quick play from My-favorites / Recently Played |
588594
| `-` | Settings |
589595

590596
### Playback Controls

v3/internal/config/config.go

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ const (
1313

1414
// Config represents the unified application configuration
1515
type Config struct {
16-
Version string `yaml:"version"`
17-
Player PlayerConfig `yaml:"player"`
18-
UI UIConfig `yaml:"ui"`
19-
Network NetworkConfig `yaml:"network"`
20-
Shuffle ShuffleConfig `yaml:"shuffle"`
21-
Blocklist BlocklistConfig `yaml:"blocklist"`
16+
Version string `yaml:"version"`
17+
Player PlayerConfig `yaml:"player"`
18+
UI UIConfig `yaml:"ui"`
19+
Network NetworkConfig `yaml:"network"`
20+
Shuffle ShuffleConfig `yaml:"shuffle"`
21+
Blocklist BlocklistConfig `yaml:"blocklist"`
22+
PlayHistory PlayHistoryConfig `yaml:"play_history"`
2223
}
2324

2425
// PlayerConfig represents player settings
@@ -83,6 +84,22 @@ type ShuffleConfig struct {
8384
MaxHistory int `yaml:"max_history"` // Number of stations to remember
8485
}
8586

87+
// PlayHistoryConfig holds Recently Played display settings for the main menu
88+
type PlayHistoryConfig struct {
89+
Enabled bool `yaml:"enabled"` // Show Recently Played section in main menu (default: true)
90+
Size int `yaml:"size"` // Number of stations to display, range [1, 20] (default: 5)
91+
AllowDuplicate bool `yaml:"allow_duplicate"` // Allow same station to appear more than once (default: false)
92+
}
93+
94+
// DefaultPlayHistoryConfig returns a PlayHistoryConfig with sensible defaults.
95+
func DefaultPlayHistoryConfig() PlayHistoryConfig {
96+
return PlayHistoryConfig{
97+
Enabled: true,
98+
Size: 5,
99+
AllowDuplicate: false,
100+
}
101+
}
102+
86103
// DefaultConfig returns a new Config with sensible defaults
87104
func DefaultConfig() Config {
88105
return Config{
@@ -138,6 +155,7 @@ func DefaultConfig() Config {
138155
RememberHistory: true,
139156
MaxHistory: 5,
140157
},
158+
PlayHistory: DefaultPlayHistoryConfig(),
141159
}
142160
}
143161

@@ -170,6 +188,11 @@ func (c *Config) Validate() error {
170188
errs = append(errs, fmt.Sprintf("shuffle: %v", err))
171189
}
172190

191+
// Validate PlayHistory config
192+
if err := c.PlayHistory.Validate(); err != nil {
193+
errs = append(errs, fmt.Sprintf("play_history: %v", err))
194+
}
195+
173196
if len(errs) > 0 {
174197
return errors.New(strings.Join(errs, "; "))
175198
}
@@ -436,3 +459,22 @@ func (s *ShuffleConfig) Validate() error {
436459
}
437460
return nil
438461
}
462+
463+
// Validate validates PlayHistoryConfig, clamping Size to [1, 20].
464+
func (p *PlayHistoryConfig) Validate() error {
465+
var errs []string
466+
467+
if p.Size < 1 {
468+
p.Size = 1
469+
errs = append(errs, "size must be >= 1, set to 1")
470+
}
471+
if p.Size > 20 {
472+
p.Size = 20
473+
errs = append(errs, "size must be <= 20, set to 20")
474+
}
475+
476+
if len(errs) > 0 {
477+
return errors.New(strings.Join(errs, "; "))
478+
}
479+
return nil
480+
}

0 commit comments

Comments
 (0)