-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpoolsuite
More file actions
executable file
·162 lines (142 loc) · 5.12 KB
/
poolsuite
File metadata and controls
executable file
·162 lines (142 loc) · 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env bash
# Poolsuite FM CLI Player
# An unofficial command-line player for Poolsuite FM's curated playlists
#
# All music curation credit goes to Poolsuite FM (https://poolsuite.net/)
# This is an unofficial tool that streams their public SoundCloud playlists
#
# Support the original: https://poolsuite.net/
set -e
VERSION="1.0.0"
PLAYER="${POOLSUITE_PLAYER:-mpv}"
# Color codes
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Playlists
declare -A PLAYLISTS=(
["official"]="https://soundcloud.com/poolsuite/sets/poolsuite-fm-official-playlist"
["official2"]="https://soundcloud.com/poolsuite/sets/poolsuite-fm-official-playlist-two"
["mixtapes"]="https://soundcloud.com/poolsuite/sets/poolsuite-mixtapes"
["balearic"]="https://soundcloud.com/poolsuite/sets/balearic-sundown"
["indie"]="https://soundcloud.com/poolsuite/sets/indie-summer"
["tokyo"]="https://soundcloud.com/poolsuite/sets/tokyo-disco"
["friday"]="https://soundcloud.com/poolsuite/sets/friday-nite-heat"
["hangover"]="https://soundcloud.com/poolsuite/sets/hangover-club"
)
show_banner() {
echo -e "${CYAN}"
cat << 'EOF'
____ __ _ __
/ __ \____ ____ / /______ __(_) /____
/ /_/ / __ \/ __ \/ / ___/ / / / / __/ _ \
/ ____/ /_/ / /_/ / (__ ) /_/ / / /_/ __/
/_/ \____/\____/_/____/\__,_/_/\__/\___/
CLI v${VERSION}
EOF
echo -e "${NC}"
echo -e "${BLUE}Ultra-summer internet radio from the command line${NC}\n"
}
show_help() {
show_banner
echo -e "${GREEN}Usage:${NC}"
echo -e " poolsuite ${YELLOW}[playlist]${NC} ${YELLOW}[options]${NC}"
echo
echo -e "${GREEN}Playlists:${NC}"
echo -e " ${YELLOW}official${NC} Official Poolsuite FM Playlist (default)"
echo -e " ${YELLOW}official2${NC} Official Poolsuite FM Playlist Two"
echo -e " ${YELLOW}mixtapes${NC} Poolsuite Mixtapes Collection"
echo -e " ${YELLOW}balearic${NC} Balearic Sundown"
echo -e " ${YELLOW}indie${NC} Indie Summer"
echo -e " ${YELLOW}tokyo${NC} Tokyo Disco"
echo -e " ${YELLOW}friday${NC} Friday Nite Heat"
echo -e " ${YELLOW}hangover${NC} Hangover Club"
echo
echo -e "${GREEN}Options:${NC}"
echo -e " ${YELLOW}-l, --list${NC} List all available playlists"
echo -e " ${YELLOW}-s, --shuffle${NC} Shuffle playlist"
echo -e " ${YELLOW}-h, --help${NC} Show this help message"
echo -e " ${YELLOW}-v, --version${NC} Show version"
echo
echo -e "${GREEN}Examples:${NC}"
echo -e " poolsuite"
echo -e " poolsuite tokyo"
echo -e " poolsuite official --shuffle"
echo
echo -e "${GREEN}Environment Variables:${NC}"
echo -e " ${YELLOW}POOLSUITE_PLAYER${NC} Player to use (default: mpv)"
echo
echo -e "${BLUE}Note:${NC} This is an unofficial tool. All music curation credit"
echo -e " goes to Poolsuite FM. Support them at ${CYAN}https://poolsuite.net${NC}"
echo
}
list_playlists() {
show_banner
echo -e "${GREEN}Available Playlists:${NC}\n"
for key in "${!PLAYLISTS[@]}"; do
echo -e " ${YELLOW}$key${NC}"
done
echo
}
play_playlist() {
local playlist_name="${1:-official}"
local shuffle="${2:-}"
if [[ ! -v "PLAYLISTS[$playlist_name]" ]]; then
echo -e "${RED}Error: Unknown playlist '${playlist_name}'${NC}"
echo -e "Run ${YELLOW}poolsuite --list${NC} to see available playlists"
exit 1
fi
local url="${PLAYLISTS[$playlist_name]}"
show_banner
echo -e "${GREEN}Now Playing:${NC} ${YELLOW}${playlist_name}${NC}"
echo -e "${GREEN}URL:${NC} ${url}"
if [[ "$shuffle" == "shuffle" ]]; then
echo -e "${GREEN}Mode:${NC} ${YELLOW}Shuffle${NC}"
fi
echo -e "\n${CYAN}♪♫ Starting playback... ♫♪${NC}\n"
# Check which player is available
if command -v mpv &> /dev/null; then
if [[ "$shuffle" == "shuffle" ]]; then
mpv --no-video --shuffle "$url"
else
mpv --no-video "$url"
fi
elif command -v yt-dlp &> /dev/null && command -v ffplay &> /dev/null; then
echo -e "${YELLOW}Note: Using yt-dlp + ffplay. For better experience, install mpv.${NC}\n"
yt-dlp -o - "$url" | ffplay -nodisp -autoexit -
else
echo -e "${RED}Error: No compatible player found${NC}"
echo -e "Please install one of: mpv, or (yt-dlp + ffplay)"
exit 1
fi
}
# Main script
main() {
if [[ $# -eq 0 ]]; then
play_playlist "official"
exit 0
fi
case "$1" in
-h|--help)
show_help
;;
-v|--version)
echo "poolsuite v${VERSION}"
;;
-l|--list)
list_playlists
;;
*)
local playlist="$1"
local shuffle=""
if [[ $# -gt 1 ]] && [[ "$2" == "-s" || "$2" == "--shuffle" ]]; then
shuffle="shuffle"
fi
play_playlist "$playlist" "$shuffle"
;;
esac
}
main "$@"