├── .gitignore ├── assets └── demo.png ├── main.go ├── .github └── workflows │ └── build.yml ├── config.go ├── go.mod ├── README.md ├── keys.go ├── utils.go ├── model.go ├── music.go ├── go.sum └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | podden 2 | -------------------------------------------------------------------------------- /assets/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leanghok120/podden/HEAD/assets/demo.png -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | 8 | "github.com/0xAX/notificator" 9 | tea "github.com/charmbracelet/bubbletea" 10 | ) 11 | 12 | var ( 13 | musicDirFlag = flag.String("m", "", "set your music directory (the directory where all your musics are in)") 14 | cfg config 15 | notify *notificator.Notificator 16 | ) 17 | 18 | func main() { 19 | flag.Parse() 20 | notify = notificator.New(notificator.Options{}) 21 | loadConfig(&cfg) 22 | initStyles() 23 | 24 | p := tea.NewProgram(initModel(), tea.WithAltScreen()) 25 | if _, err := p.Run(); err != nil { 26 | fmt.Println("Error running program:", err) 27 | os.Exit(1) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build and Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: 'Version tag (e.g. v1.0.0)' 8 | required: true 9 | default: 'v1.0.0' 10 | 11 | permissions: 12 | contents: write 13 | 14 | jobs: 15 | build-and-release: 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: Checkout code 20 | uses: actions/checkout@v4 21 | 22 | - name: Setup Go 23 | uses: actions/setup-go@v4 24 | with: 25 | go-version: '1.24.3' 26 | 27 | # Linux builds 28 | - name: Build linux amd64 29 | run: GOOS=linux GOARCH=amd64 go build -o dist/podden-linux-amd64 . 30 | 31 | - name: Build linux arm64 32 | run: GOOS=linux GOARCH=arm64 go build -o dist/podden-linux-arm64 . 33 | 34 | # macOS builds 35 | - name: Build macOS amd64 36 | run: GOOS=darwin GOARCH=amd64 go build -o dist/podden-macos-amd64 . 37 | 38 | - name: Build macOS arm64 39 | run: GOOS=darwin GOARCH=arm64 go build -o dist/podden-macos-arm64 . 40 | 41 | # Windows builds 42 | - name: Build windows amd64 43 | run: GOOS=windows GOARCH=amd64 go build -o dist/podden-windows-amd64.exe . 44 | 45 | - name: Build windows arm64 46 | run: GOOS=windows GOARCH=arm64 go build -o dist/podden-windows-arm64.exe . 47 | 48 | # Create GitHub Release 49 | - name: Create GitHub Release 50 | uses: softprops/action-gh-release@v2 51 | with: 52 | tag_name: ${{ github.event.inputs.version }} 53 | name: "Release ${{ github.event.inputs.version }}" 54 | files: | 55 | dist/podden-linux-amd64 56 | dist/podden-linux-arm64 57 | dist/podden-macos-amd64 58 | dist/podden-macos-arm64 59 | dist/podden-windows-amd64.exe 60 | dist/podden-windows-arm64.exe 61 | env: 62 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 63 | -------------------------------------------------------------------------------- /config.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "io" 5 | "log" 6 | "os" 7 | "path/filepath" 8 | 9 | "gopkg.in/yaml.v3" 10 | ) 11 | 12 | type config struct { 13 | HeadingForeground string `yaml:"heading_foreground"` 14 | HeadingBackground string `yaml:"heading_background"` 15 | BorderForeground string `yaml:"border_foreground"` 16 | NormalTitleForeground string `yaml:"normal_title_foreground"` 17 | NormalDescForeground string `yaml:"normal_desc_foreground"` 18 | SelectedTitleBorderForeground string `yaml:"selected_title_border_foreground"` 19 | SelectedTitleForeground string `yaml:"selected_title_foreground"` 20 | SelectedDescForeground string `yaml:"selected_desc_foreground"` 21 | DimmedTitleForeground string `yaml:"dimmed_title_foreground"` 22 | DimmedDescForeground string `yaml:"dimmed_desc_foreground"` 23 | ArtistForeground string `yaml:"artist_foreground"` 24 | TimeForeground string `yaml:"time_foreground"` 25 | LyricsForeground string `yaml:"lyrics_foreground"` 26 | ShowHelp bool `yaml:"show_help"` 27 | } 28 | 29 | var defaultConfigYaml = `# heading styles (album, songs, artists) 30 | heading_background: "" 31 | heading_foreground: "" 32 | border_foreground: "" 33 | 34 | # list styles 35 | normal_title_foreground: "" 36 | normal_desc_foreground: "" 37 | 38 | selected_title_border_foreground: "" 39 | selected_title_foreground: "" 40 | selected_desc_foreground: "" 41 | 42 | dimmed_title_foreground: "" 43 | dimmed_desc_foreground: "" 44 | 45 | # playing styles 46 | artist_foreground: "" 47 | time_foreground: "" 48 | lyrics_foreground: "" 49 | 50 | show_help: true 51 | ` 52 | 53 | func loadConfig(cfg *config) { 54 | configDir, err := os.UserConfigDir() 55 | if err != nil { 56 | log.Fatal(err) 57 | } 58 | 59 | configPath := filepath.Join(configDir, "podden", "config.yml") 60 | 61 | // check if ~/.config/podden exists 62 | if _, err := os.Stat(configPath); os.IsNotExist(err) { 63 | os.MkdirAll(filepath.Dir(configPath), 0755) 64 | err = os.WriteFile(configPath, []byte(defaultConfigYaml), 0644) 65 | if err != nil { 66 | log.Fatal(err) 67 | } 68 | } 69 | 70 | f, err := os.Open(configPath) 71 | if err != nil { 72 | log.Fatal(err) 73 | } 74 | 75 | decoder := yaml.NewDecoder(f) 76 | err = decoder.Decode(cfg) 77 | if err != nil && err != io.EOF { 78 | log.Fatal(err) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/leanghok120/podden 2 | 3 | go 1.24.0 4 | 5 | toolchain go1.24.7 6 | 7 | require ( 8 | github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557 9 | github.com/charmbracelet/bubbles v0.21.0 10 | github.com/charmbracelet/bubbletea v1.3.4 11 | github.com/charmbracelet/lipgloss v1.1.0 12 | github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8 13 | github.com/gopxl/beep v1.4.1 14 | gopkg.in/yaml.v3 v3.0.1 15 | ) 16 | 17 | require ( 18 | github.com/atotto/clipboard v0.1.4 // indirect 19 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect 20 | github.com/blacktop/go-termimg v0.1.20 // indirect 21 | github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect 22 | github.com/charmbracelet/x/ansi v0.9.3 // indirect 23 | github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect 24 | github.com/charmbracelet/x/mosaic v0.0.0-20250702191427-5bdfc8f2e4ff // indirect 25 | github.com/charmbracelet/x/term v0.2.1 // indirect 26 | github.com/ebitengine/oto/v3 v3.1.0 // indirect 27 | github.com/ebitengine/purego v0.7.1 // indirect 28 | github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect 29 | github.com/hajimehoshi/go-mp3 v0.3.4 // indirect 30 | github.com/kr/pretty v0.3.1 // indirect 31 | github.com/lucasb-eyer/go-colorful v1.2.0 // indirect 32 | github.com/makeworld-the-better-one/dither/v2 v2.4.0 // indirect 33 | github.com/mattn/go-isatty v0.0.20 // indirect 34 | github.com/mattn/go-localereader v0.0.1 // indirect 35 | github.com/mattn/go-runewidth v0.0.16 // indirect 36 | github.com/mattn/go-sixel v0.0.5 // indirect 37 | github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect 38 | github.com/muesli/cancelreader v0.2.2 // indirect 39 | github.com/muesli/termenv v0.16.0 // indirect 40 | github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect 41 | github.com/pkg/errors v0.9.1 // indirect 42 | github.com/rivo/uniseg v0.4.7 // indirect 43 | github.com/sahilm/fuzzy v0.1.1 // indirect 44 | github.com/soniakeys/quant v1.0.0 // indirect 45 | github.com/stretchr/testify v1.10.0 // indirect 46 | github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect 47 | golang.org/x/image v0.25.0 // indirect 48 | golang.org/x/sync v0.12.0 // indirect 49 | golang.org/x/sys v0.33.0 // indirect 50 | golang.org/x/term v0.32.0 // indirect 51 | golang.org/x/text v0.23.0 // indirect 52 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect 53 | ) 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # podden 2 | 3 | ![demo](./assets/demo.png) 4 | 5 | A minimal **TUI MP3 player** written in Go with [Bubble Tea](https://github.com/charmbracelet/bubbletea) and [beep](https://github.com/gopxl/beep). 6 | 7 | Inspired by the **iPod Classic (5th Gen)**. 8 | 9 | ## ✨ Features 10 | 11 | - **Songs view:** Browse and play songs from your music folder. 12 | - **Albums view:** Browse albums. 13 | - **Artists view:** Browse artists. 14 | - **Playing view:** Show currently playing song details. 15 | - **Playback Controls:** Pause, next, previous, fast forward, rewind. 16 | - **Lyrics:** Synchronized song lyrics. 17 | - **Configuration:** Customize podden to look how you want it to. 18 | - **Desktop Notifications:** Cross platform desktop notifications 19 | - **Volume Control:** Control songs volume 20 | 21 | ## 📦 Installation 22 | 23 | Make sure you have [Go](https://go.dev/dl/) installed (version 1.21+ recommended). 24 | Then run: 25 | 26 | ```sh 27 | go install github.com/leanghok120/podden@latest 28 | ``` 29 | 30 | ## 🚀 Usage 31 | 32 | After installing, simply run: 33 | 34 | ```sh 35 | podden 36 | ``` 37 | 38 | If you want to use your own music driectory: 39 | 40 | ```sh 41 | podden -m path 42 | ``` 43 | 44 | ### Notes 45 | 46 | - Podden is still in very early stages. 47 | - By default, it looks for music in the ~/Music directory. (Use -m to change to your own music directory) 48 | - Plays only `.mp3`, `.flac`, `.m4a` files. 49 | 50 | ## 🗒️ Todos 51 | 52 | - [x] play songs with beep 53 | - [x] pause, next, prev songs 54 | - [x] play the next song after finished 55 | - [x] add albums page 56 | - [x] add artists page 57 | - [x] show elapsed time / total time 58 | - [x] add lyrics 59 | - [x] fast forward/rewind songs 60 | - [x] allow user to choose their own music folder 61 | - [x] add config 62 | - [x] add a help menu 63 | - [ ] highlight lyrics 64 | - [x] system notifications 65 | - [x] volume control 66 | - [ ] add cover image (fix styling and image not working in albums and artists page) 67 | - [ ] fix recursive file search 68 | 69 | ## 🤝 Contributing 70 | 71 | Contributions are welcome as long as **they align with what the project's needs**! 72 | If you’d like to help improve podden, you can: 73 | 74 | 1. Fork the repository 75 | 2. Commit your changes 76 | 3. Open a Pull Request 77 | 78 | ## 🙏 Acknowledgements 79 | 80 | - [Charmbracelet](https://github.com/charmbracelet) for the TUI libraries 81 | - [gopxl](https://github.com/gopxl/beep) for the beep audio library 82 | - [0xAX](https://github.com/0xAX/notificator) for the desktop notification library 83 | - [lrclib](https://lrclib.net) for the synchronized lyrics 84 | - The iPod Classic (5th Gen) — for inspiring the look & feel 85 | -------------------------------------------------------------------------------- /keys.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/charmbracelet/bubbles/key" 4 | 5 | // ShortHelp returns keybindings to be shown in the mini help view. It's part 6 | // of the key.Map interface. 7 | func (k keyMap) ShortHelp() []key.Binding { 8 | return []key.Binding{k.Help, k.Quit} 9 | } 10 | 11 | // FullHelp returns keybindings for the expanded help view. It's part of the 12 | // key.Map interface. 13 | func (k keyMap) FullHelp() [][]key.Binding { 14 | return [][]key.Binding{ 15 | {k.Up, k.Down, k.Next, k.Prev}, 16 | {k.Albums, k.Songs, k.Artists, k.Playing}, 17 | {k.Play, k.Pause, k.Forward, k.Rewind}, 18 | {k.Help, k.Quit, k.Increase, k.Decrease}, 19 | } 20 | } 21 | 22 | type keyMap struct { 23 | // list navigation 24 | Up key.Binding 25 | Down key.Binding 26 | 27 | // playback control 28 | Play key.Binding 29 | Pause key.Binding 30 | Next key.Binding 31 | Prev key.Binding 32 | Forward key.Binding 33 | Rewind key.Binding 34 | 35 | // volume control 36 | Increase key.Binding 37 | Decrease key.Binding 38 | 39 | // page navigation 40 | Albums key.Binding 41 | Songs key.Binding 42 | Artists key.Binding 43 | Playing key.Binding 44 | Help key.Binding 45 | Quit key.Binding 46 | } 47 | 48 | var keys = keyMap{ 49 | // list navigation 50 | Up: key.NewBinding( 51 | key.WithKeys("up", "k"), 52 | key.WithHelp("↑/k", "move up"), 53 | ), 54 | Down: key.NewBinding( 55 | key.WithKeys("down", "j"), 56 | key.WithHelp("↓/j", "move down"), 57 | ), 58 | 59 | // playback control 60 | Play: key.NewBinding( 61 | key.WithKeys("enter"), 62 | key.WithHelp("enter", "play"), 63 | ), 64 | Pause: key.NewBinding( 65 | key.WithKeys("space"), 66 | key.WithHelp("space", "pause/resume"), 67 | ), 68 | Next: key.NewBinding( 69 | key.WithKeys("n"), 70 | key.WithHelp("n", "next song"), 71 | ), 72 | Prev: key.NewBinding( 73 | key.WithKeys("p"), 74 | key.WithHelp("p", "prev song"), 75 | ), 76 | Forward: key.NewBinding( 77 | key.WithKeys("right"), 78 | key.WithHelp("→", "fast forward"), 79 | ), 80 | Rewind: key.NewBinding( 81 | key.WithKeys("left"), 82 | key.WithHelp("←", "rewind"), 83 | ), 84 | 85 | // volume control 86 | Increase: key.NewBinding( 87 | key.WithKeys("+"), 88 | key.WithHelp("+", "increase volume"), 89 | ), 90 | Decrease: key.NewBinding( 91 | key.WithKeys("-"), 92 | key.WithHelp("-", "decrease volume"), 93 | ), 94 | 95 | // page navigation 96 | Albums: key.NewBinding( 97 | key.WithKeys("a"), 98 | key.WithHelp("a", "album"), 99 | ), 100 | Songs: key.NewBinding( 101 | key.WithKeys("s"), 102 | key.WithHelp("s", "songs"), 103 | ), 104 | Artists: key.NewBinding( 105 | key.WithKeys("d"), 106 | key.WithHelp("d", "artists"), 107 | ), 108 | Playing: key.NewBinding( 109 | key.WithKeys("f"), 110 | key.WithHelp("f", "playing"), 111 | ), 112 | Help: key.NewBinding( 113 | key.WithKeys("?"), 114 | key.WithHelp("?", "toggle help"), 115 | ), 116 | Quit: key.NewBinding( 117 | key.WithKeys("q", "ctrl+c"), 118 | key.WithHelp("q/ctrl+c", "quit"), 119 | ), 120 | } 121 | -------------------------------------------------------------------------------- /utils.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "regexp" 7 | "strconv" 8 | "strings" 9 | 10 | "github.com/0xAX/notificator" 11 | "github.com/charmbracelet/bubbles/list" 12 | tea "github.com/charmbracelet/bubbletea" 13 | "github.com/charmbracelet/lipgloss" 14 | ) 15 | 16 | type lyricLine struct { 17 | Time float64 18 | Text string 19 | } 20 | 21 | // styles 22 | var ( 23 | screenStyle lipgloss.Style 24 | titleStyle lipgloss.Style 25 | titleBackgroundStyle lipgloss.Style 26 | artistStyle lipgloss.Style 27 | lyricStyle lipgloss.Style 28 | timeStyle lipgloss.Style 29 | helpMenu lipgloss.Style 30 | ) 31 | 32 | func fallbackColor(value, def string) lipgloss.Color { 33 | if value == "" { 34 | return lipgloss.Color(def) 35 | } 36 | return lipgloss.Color(value) 37 | } 38 | 39 | // returns either lipgloss.Color or lipgloss.AdaptiveColor 40 | func fallbackAdaptiveColor(value string, def lipgloss.AdaptiveColor) lipgloss.TerminalColor { 41 | if value == "" { 42 | return def 43 | } 44 | return lipgloss.Color(value) 45 | } 46 | 47 | func initStyles() { 48 | screenStyle = lipgloss.NewStyle(). 49 | Border(lipgloss.RoundedBorder()). 50 | BorderForeground(lipgloss.Color(cfg.BorderForeground)). 51 | Padding(1, 2). 52 | Width(30). 53 | MaxWidth(35). 54 | Height(14) 55 | 56 | titleStyle = lipgloss.NewStyle(). 57 | Foreground(fallbackColor(cfg.HeadingForeground, "230")). 58 | Background(fallbackColor(cfg.HeadingBackground, "62")). 59 | Padding(0, 1) 60 | 61 | artistStyle = lipgloss.NewStyle(). 62 | Foreground(fallbackColor(cfg.ArtistForeground, "243")) // muted gray 63 | 64 | lyricStyle = lipgloss.NewStyle(). 65 | Width(26). 66 | Align(lipgloss.Center). 67 | Foreground(fallbackColor(cfg.LyricsForeground, "252")). 68 | Italic(true) 69 | 70 | timeStyle = lipgloss.NewStyle(). 71 | Foreground(fallbackColor(cfg.TimeForeground, "240")) 72 | 73 | helpMenu = lipgloss.NewStyle(). 74 | Padding(0, 1) 75 | } 76 | 77 | // helper functions 78 | // update the styles of bubbles component 79 | func setCustomBubblesStyle() list.Styles { 80 | styles := list.DefaultStyles() 81 | 82 | styles.Title = lipgloss.NewStyle(). 83 | Background(fallbackColor(cfg.HeadingBackground, "62")). 84 | Foreground(fallbackColor(cfg.HeadingForeground, "230")). 85 | Padding(0, 1) 86 | 87 | return styles 88 | } 89 | 90 | func customDelegate() list.ItemDelegate { 91 | delegate := list.NewDefaultDelegate() 92 | s := &delegate.Styles 93 | 94 | s.NormalTitle = lipgloss.NewStyle(). 95 | Foreground(fallbackAdaptiveColor(cfg.NormalTitleForeground, 96 | lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"})). 97 | Padding(0, 0, 0, 2) //nolint:mnd 98 | 99 | s.NormalDesc = s.NormalTitle. 100 | Foreground(fallbackAdaptiveColor(cfg.NormalDescForeground, 101 | lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"})) 102 | 103 | s.SelectedTitle = lipgloss.NewStyle(). 104 | Border(lipgloss.NormalBorder(), false, false, false, true). 105 | BorderForeground(fallbackAdaptiveColor(cfg.SelectedTitleBorderForeground, 106 | lipgloss.AdaptiveColor{Light: "#F793FF", Dark: "#AD58B4"})). 107 | Foreground(fallbackAdaptiveColor(cfg.SelectedTitleForeground, 108 | lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"})). 109 | Padding(0, 0, 0, 1) 110 | 111 | s.SelectedDesc = s.SelectedTitle. 112 | Foreground(fallbackAdaptiveColor(cfg.SelectedDescForeground, 113 | lipgloss.AdaptiveColor{Light: "#F793FF", Dark: "#AD58B4"})) 114 | 115 | s.DimmedTitle = lipgloss.NewStyle(). 116 | Foreground(fallbackAdaptiveColor(cfg.DimmedTitleForeground, 117 | lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"})). 118 | Padding(0, 0, 0, 2) //nolint:mnd 119 | 120 | s.DimmedDesc = s.DimmedTitle. 121 | Foreground(fallbackAdaptiveColor(cfg.DimmedDescForeground, 122 | lipgloss.AdaptiveColor{Light: "#C2B8C2", Dark: "#4D4D4D"})) 123 | 124 | return delegate 125 | } 126 | 127 | // place content in the center and add a help menu 128 | func (m model) center(content string) string { 129 | screen := lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, content) 130 | 131 | if cfg.ShowHelp { 132 | return lipgloss.JoinVertical(lipgloss.Left, screen, helpMenu.Render(m.help.View(keys))) 133 | } 134 | return screen 135 | } 136 | 137 | // play next song 138 | func (m model) nextSong(l list.Model) (list.Model, tea.Cmd) { 139 | l.CursorDown() 140 | selected, ok := l.SelectedItem().(music) 141 | if !ok { 142 | return l, nil 143 | } 144 | return l, func() tea.Msg { return playMusic(selected) } 145 | } 146 | 147 | // play previous song 148 | func (m model) prevSong(l list.Model) (list.Model, tea.Cmd) { 149 | l.CursorUp() 150 | selected, ok := l.SelectedItem().(music) 151 | if !ok { 152 | return l, nil 153 | } 154 | return l, func() tea.Msg { return playMusic(selected) } 155 | } 156 | 157 | // handle album selection in list 158 | func (m model) handleAlbumSelection() model { 159 | if selected, ok := m.list.SelectedItem().(album); ok { 160 | items := make([]list.Item, len(selected.tracks)) 161 | for i, track := range selected.tracks { 162 | items[i] = track 163 | } 164 | m.list.SetItems(items) 165 | m.list.Title = selected.title 166 | m.showAlbums = false 167 | m.loaded = true 168 | m.list.SetFilterState(list.Unfiltered) 169 | } 170 | return m 171 | } 172 | 173 | // handle artist selection in list 174 | func (m model) handleArtistSelection() model { 175 | if selected, ok := m.list.SelectedItem().(artist); ok { 176 | items := make([]list.Item, len(selected.tracks)) 177 | for i, track := range selected.tracks { 178 | items[i] = track 179 | } 180 | m.list.SetItems(items) 181 | m.list.Title = selected.name 182 | m.showArtists = false 183 | m.loaded = true 184 | m.list.SetFilterState(list.Unfiltered) 185 | } 186 | return m 187 | } 188 | 189 | func parseLRC(raw string) ([]lyricLine, error) { 190 | var lyrics []lyricLine 191 | 192 | // regex to match [mm:ss.xx] 193 | re := regexp.MustCompile(`\[(\d+):(\d+\.\d+)\](.*)`) 194 | 195 | lines := strings.Split(raw, "\n") 196 | for _, line := range lines { 197 | matches := re.FindStringSubmatch(line) 198 | if len(matches) == 4 { 199 | minutes, _ := strconv.Atoi(matches[1]) 200 | seconds, _ := strconv.ParseFloat(matches[2], 64) 201 | text := strings.TrimSpace(matches[3]) 202 | totalTime := float64(minutes)*60 + seconds 203 | lyrics = append(lyrics, lyricLine{Time: totalTime, Text: text}) 204 | } 205 | } 206 | 207 | return lyrics, nil 208 | } 209 | 210 | func sendNotification(m music, body string) { 211 | f, err := os.CreateTemp("", "cover-image") 212 | if err != nil { 213 | return 214 | } 215 | defer os.Remove(f.Name()) 216 | 217 | _, err = f.Write(m.cover) 218 | if err != nil { 219 | return 220 | } 221 | f.Close() 222 | 223 | notifyTitle := fmt.Sprintf("%s - %s", m.title, m.artist) 224 | notify.Push(notifyTitle, body, f.Name(), notificator.UR_NORMAL) 225 | } 226 | -------------------------------------------------------------------------------- /model.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | 7 | "github.com/blacktop/go-termimg" 8 | "github.com/charmbracelet/bubbles/help" 9 | "github.com/charmbracelet/bubbles/list" 10 | tea "github.com/charmbracelet/bubbletea" 11 | "github.com/charmbracelet/lipgloss" 12 | "github.com/gopxl/beep" 13 | "github.com/gopxl/beep/effects" 14 | "github.com/gopxl/beep/speaker" 15 | ) 16 | 17 | type model struct { 18 | help help.Model 19 | list list.Model 20 | img *termimg.ImageWidget 21 | width int 22 | height int 23 | loaded bool 24 | showAlbums bool // for albums page 25 | showArtists bool // for artists page 26 | playing bool 27 | paused bool 28 | lyrics []lyricLine 29 | currLyric string 30 | elapsed time.Duration 31 | total time.Duration 32 | currPlaying music 33 | streamer beep.StreamSeekCloser 34 | volume *effects.Volume 35 | sampleRate beep.SampleRate 36 | } 37 | 38 | func initModel() model { 39 | help := help.New() 40 | 41 | return model{loaded: false, playing: false, paused: false, help: help} 42 | } 43 | 44 | func (m model) Init() tea.Cmd { 45 | return fetchMusics 46 | } 47 | 48 | func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { 49 | switch msg := msg.(type) { 50 | case tea.WindowSizeMsg: 51 | m.width = msg.Width 52 | m.height = msg.Height 53 | 54 | case tea.KeyMsg: 55 | if m.list.FilterState() != list.Filtering { 56 | switch msg.String() { 57 | case "q", "ctrl+c": 58 | return m, tea.Quit 59 | 60 | case "?": 61 | m.help.ShowAll = !m.help.ShowAll 62 | return m, nil 63 | 64 | case "enter": 65 | // handle album selection 66 | if m.showAlbums { 67 | m = m.handleAlbumSelection() 68 | return m, nil 69 | } 70 | // handle artist selection 71 | if m.showArtists { 72 | m = m.handleArtistSelection() 73 | return m, nil 74 | } 75 | // handle song selection and playback 76 | if selected, ok := m.list.SelectedItem().(music); ok { 77 | return m, func() tea.Msg { return playMusic(selected) } 78 | } 79 | 80 | case " ": 81 | if m.paused { 82 | speaker.Unlock() 83 | m.paused = false 84 | } else { 85 | speaker.Lock() 86 | m.paused = true 87 | sendNotification(m.currPlaying, "paused") 88 | } 89 | 90 | case ">", "right": 91 | samplesToJump := m.sampleRate.N(5 * time.Second) 92 | m.streamer.Seek(m.sampleRate.N(m.elapsed) + samplesToJump) 93 | 94 | case "<", "left": 95 | samplesToJump := m.sampleRate.N(5 * time.Second) 96 | newPos := m.sampleRate.N(m.elapsed) - samplesToJump 97 | if newPos < 0 { 98 | newPos = 0 99 | } 100 | m.streamer.Seek(newPos) 101 | 102 | case "n": 103 | var cmd tea.Cmd 104 | m.list, cmd = m.nextSong(m.list) 105 | return m, cmd 106 | 107 | case "p": 108 | var cmd tea.Cmd 109 | m.list, cmd = m.prevSong(m.list) 110 | return m, cmd 111 | 112 | case "s": 113 | m.playing = false 114 | m.showAlbums = false 115 | m.showArtists = false 116 | 117 | return m, func() tea.Msg { return fetchMusics() } 118 | 119 | case "a": 120 | m.playing = false 121 | m.loaded = false 122 | m.showArtists = false 123 | 124 | return m, func() tea.Msg { return fetchAlbums() } 125 | 126 | case "d": 127 | m.playing = false 128 | m.loaded = false 129 | m.showAlbums = false 130 | 131 | return m, func() tea.Msg { return fetchArtists() } 132 | 133 | case "f": 134 | m.playing = true 135 | m.loaded = false 136 | m.showArtists = false 137 | m.showAlbums = false 138 | 139 | case "+": 140 | speaker.Lock() 141 | m.volume.Volume += 0.5 142 | speaker.Unlock() 143 | 144 | case "-": 145 | speaker.Lock() 146 | m.volume.Volume -= 0.5 147 | speaker.Unlock() 148 | } 149 | } 150 | 151 | case musicsMsg: 152 | items := make([]list.Item, len(msg.musics)) 153 | for i, m := range msg.musics { 154 | items[i] = m 155 | } 156 | l := list.New(items, customDelegate(), 30, 10) 157 | l.Title = "Songs" 158 | l.Styles = setCustomBubblesStyle() 159 | 160 | m.list = l 161 | m.loaded = true 162 | 163 | case albumsMsg: 164 | items := make([]list.Item, len(msg.albums)) 165 | for i, a := range msg.albums { 166 | items[i] = a 167 | } 168 | l := list.New(items, customDelegate(), 30, 10) 169 | l.Title = "Albums" 170 | l.Styles = setCustomBubblesStyle() 171 | 172 | m.list = l 173 | m.showAlbums = true 174 | 175 | case artistsMsg: 176 | items := make([]list.Item, len(msg.artists)) 177 | for i, a := range msg.artists { 178 | items[i] = a 179 | } 180 | l := list.New(items, customDelegate(), 30, 10) 181 | l.Title = "Artists" 182 | l.Styles = setCustomBubblesStyle() 183 | 184 | m.list = l 185 | m.showArtists = true 186 | 187 | case playingMsg: 188 | m.loaded = false 189 | m.playing = true 190 | m.currPlaying = msg.music 191 | m.streamer = msg.streamer 192 | m.volume = msg.volume 193 | m.sampleRate = msg.sampleRate 194 | m.lyrics = nil // Reset lyrics for the new song 195 | m.currLyric = "♪" 196 | m.paused = false 197 | m.elapsed = 0 198 | m.total = 0 199 | 200 | case progressMsg: 201 | m.elapsed = msg.elapsed 202 | m.total = msg.total 203 | 204 | for _, l := range m.lyrics { 205 | if m.elapsed.Seconds() >= l.Time { 206 | m.currLyric = l.Text 207 | } else { 208 | break 209 | } 210 | } 211 | 212 | return m, tickCmd(m.streamer, m.sampleRate) 213 | 214 | case lyricsMsg: 215 | m.lyrics = msg.lyrics 216 | if len(m.lyrics) > 0 && m.lyrics[0].Time > 0 { 217 | m.currLyric = "♪" 218 | } 219 | 220 | case finishedMsg: 221 | var cmd tea.Cmd 222 | m.list, cmd = m.nextSong(m.list) 223 | return m, cmd 224 | 225 | case coverMsg: 226 | m.img = msg.img 227 | return m, nil 228 | } 229 | 230 | if m.loaded || m.showAlbums || m.showArtists { 231 | var cmd tea.Cmd 232 | m.list, cmd = m.list.Update(msg) 233 | m.list.SetShowHelp(false) 234 | m.list.SetShowStatusBar(false) 235 | return m, cmd 236 | } 237 | return m, nil 238 | } 239 | 240 | func (m model) View() string { 241 | if m.playing { 242 | title := titleStyle.Render(m.currPlaying.title) 243 | artist := artistStyle.Render(m.currPlaying.artist) 244 | timeInfo := timeStyle.Render(fmt.Sprintf("%s / %s", m.elapsed, m.total)) 245 | lyric := lyricStyle.Render(m.currLyric) 246 | 247 | mainContent := lipgloss.JoinVertical( 248 | lipgloss.Left, 249 | title, 250 | artist, 251 | "", 252 | timeInfo, 253 | "", 254 | "", 255 | lyric, 256 | ) 257 | mainBox := screenStyle.Render(mainContent) 258 | 259 | finalBox := mainBox 260 | 261 | if m.img != nil { 262 | cover, _ := m.img.Render() 263 | finalBox = lipgloss.JoinHorizontal(0, mainBox, cover) 264 | } 265 | 266 | return finalBox 267 | } 268 | 269 | if m.loaded || m.showAlbums || m.showArtists { 270 | return m.center(screenStyle.Render(m.list.View())) 271 | } 272 | 273 | return m.center(screenStyle.Render("loading...")) 274 | } 275 | -------------------------------------------------------------------------------- /music.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io" 7 | "io/fs" 8 | "net/http" 9 | "net/url" 10 | "os" 11 | "path/filepath" 12 | "strings" 13 | "time" 14 | 15 | "github.com/blacktop/go-termimg" 16 | tea "github.com/charmbracelet/bubbletea" 17 | "github.com/dhowden/tag" 18 | "github.com/gopxl/beep" 19 | "github.com/gopxl/beep/effects" 20 | "github.com/gopxl/beep/mp3" 21 | "github.com/gopxl/beep/speaker" 22 | ) 23 | 24 | type music struct { 25 | title string 26 | artist string 27 | path string 28 | album string 29 | cover []byte 30 | } 31 | 32 | type album struct { 33 | title string 34 | artist string 35 | tracks []music 36 | } 37 | 38 | type artist struct { 39 | name string 40 | tracks []music 41 | } 42 | 43 | type ( 44 | errMsg struct{ err error } 45 | musicsMsg struct{ musics []music } 46 | albumsMsg struct{ albums []album } 47 | artistsMsg struct{ artists []artist } 48 | lyricsMsg struct{ lyrics []lyricLine } 49 | coverMsg struct{ img *termimg.ImageWidget } 50 | finishedMsg struct{} 51 | ) 52 | 53 | type progressMsg struct { 54 | elapsed time.Duration 55 | total time.Duration 56 | } 57 | 58 | type playingMsg struct { 59 | music music 60 | streamer beep.StreamSeekCloser 61 | sampleRate beep.SampleRate 62 | volume *effects.Volume 63 | } 64 | 65 | type lrcLibResponse struct { 66 | SyncedLyrics string `json:"syncedLyrics"` 67 | } 68 | 69 | // list.Item implementation 70 | func (s music) Title() string { return s.title } 71 | func (s music) Description() string { return s.artist } 72 | func (s music) FilterValue() string { return s.title } 73 | 74 | func (a album) Title() string { return a.title } 75 | func (a album) Description() string { return a.artist } 76 | func (a album) FilterValue() string { return a.title } 77 | 78 | func (a artist) Title() string { return a.name } 79 | func (a artist) Description() string { return "" } 80 | func (a artist) FilterValue() string { return a.name } 81 | 82 | func tickCmd(streamer beep.StreamSeekCloser, sr beep.SampleRate) tea.Cmd { 83 | return tea.Tick(time.Second, func(time.Time) tea.Msg { 84 | speaker.Lock() 85 | elapsed := sr.D(streamer.Position()).Round(time.Second) 86 | total := sr.D(streamer.Len()).Round(time.Second) 87 | speaker.Unlock() 88 | return progressMsg{elapsed, total} 89 | }) 90 | } 91 | 92 | // global volume streamer 93 | var volume = &effects.Volume{ 94 | Base: 2, 95 | Volume: 0, 96 | Silent: false, 97 | } 98 | 99 | func fetchMusics() tea.Msg { 100 | var musics []music 101 | var dir string 102 | 103 | // use default music dir 104 | if *musicDirFlag == "" { 105 | homeDir, _ := os.UserHomeDir() 106 | dir = filepath.Join(homeDir, "Music") 107 | } else { 108 | dir = *musicDirFlag 109 | } 110 | 111 | filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { 112 | if err != nil { 113 | return nil 114 | } 115 | 116 | // get common audio file 117 | ext := filepath.Ext(path) 118 | if ext != ".mp3" && ext != ".flac" && ext != ".m4a" { 119 | return nil 120 | } 121 | 122 | f, err := os.Open(path) 123 | if err != nil { 124 | return nil 125 | } 126 | defer f.Close() 127 | 128 | metadata, err := tag.ReadFrom(f) 129 | if err != nil { 130 | return nil 131 | } 132 | 133 | title := metadata.Title() 134 | if title == "" { 135 | title = strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)) 136 | } 137 | 138 | artist := metadata.Artist() 139 | if artist == "" { 140 | artist = "Unknown Artist" 141 | } 142 | 143 | album := metadata.Album() 144 | cover := metadata.Picture().Data 145 | 146 | musics = append(musics, music{ 147 | title: title, 148 | artist: artist, 149 | path: path, 150 | album: album, 151 | cover: cover, 152 | }) 153 | return nil 154 | }) 155 | 156 | return musicsMsg{musics} 157 | } 158 | 159 | func fetchAlbums() tea.Msg { 160 | albumsMap := make(map[string]album) 161 | var dir string 162 | 163 | if *musicDirFlag == "" { 164 | homeDir, _ := os.UserHomeDir() 165 | dir = filepath.Join(homeDir, "Music") 166 | } else { 167 | dir = *musicDirFlag 168 | } 169 | 170 | filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { 171 | if err != nil { 172 | return nil 173 | } 174 | 175 | ext := filepath.Ext(path) 176 | if ext != ".mp3" && ext != ".flac" && ext != ".m4a" { 177 | return nil 178 | } 179 | 180 | f, err := os.Open(path) 181 | if err != nil { 182 | return nil 183 | } 184 | defer f.Close() 185 | 186 | metadata, err := tag.ReadFrom(f) 187 | if err != nil { 188 | return nil 189 | } 190 | 191 | // check if no album 192 | if metadata.Album() == "" { 193 | return nil 194 | } 195 | 196 | // create a key for map 197 | albumKey := metadata.AlbumArtist() + " - " + metadata.Album() 198 | 199 | currentMusic := music{ 200 | title: metadata.Title(), 201 | artist: metadata.Artist(), 202 | path: path, 203 | } 204 | 205 | // check if the album already exists in map 206 | if existingAlbum, ok := albumsMap[albumKey]; ok { 207 | existingAlbum.tracks = append(existingAlbum.tracks, currentMusic) 208 | albumsMap[albumKey] = existingAlbum 209 | } else { 210 | newAlbum := album{ 211 | title: metadata.Album(), 212 | artist: metadata.Artist(), 213 | tracks: []music{currentMusic}, 214 | } 215 | albumsMap[albumKey] = newAlbum 216 | } 217 | 218 | return nil 219 | }) 220 | 221 | // convert the map values into a slice of albums 222 | var albums []album 223 | for _, album := range albumsMap { 224 | albums = append(albums, album) 225 | } 226 | 227 | return albumsMsg{albums} 228 | } 229 | 230 | func fetchArtists() tea.Msg { 231 | artistsMap := make(map[string]artist) 232 | var dir string 233 | 234 | if *musicDirFlag == "" { 235 | homeDir, _ := os.UserHomeDir() 236 | dir = filepath.Join(homeDir, "Music") 237 | } else { 238 | dir = *musicDirFlag 239 | } 240 | 241 | filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error { 242 | if err != nil { 243 | return nil 244 | } 245 | 246 | ext := filepath.Ext(path) 247 | if ext != ".mp3" && ext != ".flac" && ext != ".m4a" { 248 | return nil 249 | } 250 | 251 | f, err := os.Open(path) 252 | if err != nil { 253 | return nil 254 | } 255 | defer f.Close() 256 | 257 | metadata, err := tag.ReadFrom(f) 258 | if err != nil { 259 | return nil 260 | } 261 | 262 | // create a key for map 263 | artistKey := metadata.Artist() 264 | 265 | currentMusic := music{ 266 | title: metadata.Title(), 267 | artist: metadata.Artist(), 268 | path: path, 269 | } 270 | 271 | // check if the artist already exists in map 272 | if existingArtist, ok := artistsMap[artistKey]; ok { 273 | existingArtist.tracks = append(existingArtist.tracks, currentMusic) 274 | artistsMap[artistKey] = existingArtist 275 | } else { 276 | newArtist := artist{ 277 | name: metadata.Artist(), 278 | tracks: []music{currentMusic}, 279 | } 280 | artistsMap[artistKey] = newArtist 281 | } 282 | 283 | return nil 284 | }) 285 | 286 | // convert the map values into a slice of artists 287 | var artists []artist 288 | for _, artist := range artistsMap { 289 | artists = append(artists, artist) 290 | } 291 | 292 | return artistsMsg{artists} 293 | } 294 | 295 | func playMusic(m music) tea.Msg { 296 | f, err := os.Open(m.path) 297 | if err != nil { 298 | return errMsg{err} 299 | } 300 | 301 | streamer, format, err := mp3.Decode(f) 302 | if err != nil { 303 | f.Close() 304 | return errMsg{err} 305 | } 306 | volume.Streamer = streamer 307 | 308 | speaker.Clear() 309 | 310 | speaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10)) 311 | 312 | finishedMsgChan := make(chan tea.Msg, 1) 313 | 314 | go func() { 315 | speaker.Play(beep.Seq(volume, beep.Callback(func() { 316 | finishedMsgChan <- finishedMsg{} 317 | }))) 318 | }() 319 | 320 | sendNotification(m, m.album) 321 | 322 | return tea.Batch( 323 | func() tea.Msg { 324 | return playingMsg{music: m, streamer: streamer, volume: volume, sampleRate: format.SampleRate} 325 | }, 326 | func() tea.Msg { return drawCover(m.cover) }, 327 | func() tea.Msg { return <-finishedMsgChan }, 328 | func() tea.Msg { return fetchLyrics(m.title, m.artist) }, 329 | tickCmd(streamer, format.SampleRate), 330 | )() 331 | } 332 | 333 | func fetchLyrics(title, artist string) tea.Msg { 334 | if title == "" || artist == "" { 335 | return lyricsMsg{[]lyricLine{{Text: "Missing info to fetch lyrics."}}} 336 | } 337 | encodedTitle := url.QueryEscape(title) 338 | encodedArtist := url.QueryEscape(artist) 339 | 340 | apiURL := fmt.Sprintf("https://lrclib.net/api/get?track_name=%s&artist_name=%s", encodedTitle, encodedArtist) 341 | 342 | resp, err := http.Get(apiURL) 343 | if err != nil { 344 | return lyricsMsg{[]lyricLine{{Text: "Failed to fetch lyrics."}}} 345 | } 346 | defer resp.Body.Close() 347 | 348 | if resp.StatusCode == http.StatusNotFound { 349 | return lyricsMsg{[]lyricLine{{Text: "No lyrics found for this song."}}} 350 | } 351 | 352 | body, err := io.ReadAll(resp.Body) 353 | if err != nil { 354 | return lyricsMsg{[]lyricLine{{Text: "Failed to read lyrics response."}}} 355 | } 356 | 357 | var lrcResponse lrcLibResponse 358 | if err := json.Unmarshal(body, &lrcResponse); err != nil { 359 | return lyricsMsg{[]lyricLine{{Text: "Failed to parse lyrics response."}}} 360 | } 361 | 362 | // check if synced lyrics are available 363 | if lrcResponse.SyncedLyrics == "" { 364 | return lyricsMsg{[]lyricLine{{Text: "No synced lyrics available."}}} 365 | } 366 | 367 | lyrics, err := parseLRC(lrcResponse.SyncedLyrics) 368 | if err != nil { 369 | return lyricsMsg{[]lyricLine{{Text: "Error parsing LRC lyrics."}}} 370 | } 371 | 372 | return lyricsMsg{lyrics} 373 | } 374 | 375 | func drawCover(data []byte) tea.Msg { 376 | f, err := os.CreateTemp("", "cover-image") 377 | if err != nil { 378 | return errMsg{err} 379 | } 380 | defer os.Remove(f.Name()) 381 | 382 | _, err = f.Write(data) 383 | if err != nil { 384 | return errMsg{err} 385 | } 386 | f.Close() 387 | 388 | img, err := termimg.NewImageWidgetFromFile(f.Name()) 389 | if err != nil { 390 | return errMsg{err} 391 | } 392 | img.SetSize(12, 7) 393 | 394 | return coverMsg{img} 395 | } 396 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557 h1:l6surSnJ3RP4qA1qmKJ+hQn3UjytosdoG27WGjrDlVs= 2 | github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557/go.mod h1:sTrmvD/TxuypdOERsDOS7SndZg0rzzcCi1b6wQMXUYM= 3 | github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= 4 | github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= 5 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= 6 | github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= 7 | github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= 8 | github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= 9 | github.com/blacktop/go-termimg v0.1.20 h1:+EAUc3c9hwE/fUYaqRV1BSLvAlOuLySgLTEBzxGbYK4= 10 | github.com/blacktop/go-termimg v0.1.20/go.mod h1:nwxrOjfFcBjtS358oIGBLfscSLnCpNdRlMVRxsnZwMU= 11 | github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs= 12 | github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg= 13 | github.com/charmbracelet/bubbletea v1.3.4 h1:kCg7B+jSCFPLYRA52SDZjr51kG/fMUEoPoZrkaDHyoI= 14 | github.com/charmbracelet/bubbletea v1.3.4/go.mod h1:dtcUCyCGEX3g9tosuYiut3MXgY/Jsv9nKVdibKKRRXo= 15 | github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= 16 | github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= 17 | github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= 18 | github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= 19 | github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= 20 | github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q= 21 | github.com/charmbracelet/x/ansi v0.9.3 h1:BXt5DHS/MKF+LjuK4huWrC6NCvHtexww7dMayh6GXd0= 22 | github.com/charmbracelet/x/ansi v0.9.3/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE= 23 | github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8= 24 | github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= 25 | github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= 26 | github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= 27 | github.com/charmbracelet/x/mosaic v0.0.0-20250702191427-5bdfc8f2e4ff h1:OVBKPzoa0k5ZVMoor27BReRZxER1IEDtLHXkRjaHElg= 28 | github.com/charmbracelet/x/mosaic v0.0.0-20250702191427-5bdfc8f2e4ff/go.mod h1:5qLP4S++M5quSc/xbvWWW8vKkgKwOqOT/IVhAas26XI= 29 | github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= 30 | github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= 31 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 32 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 33 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 34 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 35 | github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8 h1:OtSeLS5y0Uy01jaKK4mA/WVIYtpzVm63vLVAPzJXigg= 36 | github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8/go.mod h1:apkPC/CR3s48O2D7Y++n1XWEpgPNNCjXYga3PPbJe2E= 37 | github.com/ebitengine/oto/v3 v3.1.0 h1:9tChG6rizyeR2w3vsygTTTVVJ9QMMyu00m2yBOCch6U= 38 | github.com/ebitengine/oto/v3 v3.1.0/go.mod h1:IK1QTnlfZK2GIB6ziyECm433hAdTaPpOsGMLhEyEGTg= 39 | github.com/ebitengine/purego v0.7.1 h1:6/55d26lG3o9VCZX8lping+bZcmShseiqlh2bnUDiPA= 40 | github.com/ebitengine/purego v0.7.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= 41 | github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= 42 | github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= 43 | github.com/gopxl/beep v1.4.1 h1:WqNs9RsDAhG9M3khMyc1FaVY50dTdxG/6S6a3qsUHqE= 44 | github.com/gopxl/beep v1.4.1/go.mod h1:A1dmiUkuY8kxsvcNJNUBIEcchmiP6eUyCHSxpXl0YO0= 45 | github.com/hajimehoshi/go-mp3 v0.3.4 h1:NUP7pBYH8OguP4diaTZ9wJbUbk3tC0KlfzsEpWmYj68= 46 | github.com/hajimehoshi/go-mp3 v0.3.4/go.mod h1:fRtZraRFcWb0pu7ok0LqyFhCUrPeMsGRSVop0eemFmo= 47 | github.com/hajimehoshi/oto/v2 v2.3.1/go.mod h1:seWLbgHH7AyUMYKfKYT9pg7PhUu9/SisyJvNTT+ASQo= 48 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 49 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 50 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 51 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 52 | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 53 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 54 | github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= 55 | github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= 56 | github.com/makeworld-the-better-one/dither/v2 v2.4.0 h1:Az/dYXiTcwcRSe59Hzw4RI1rSnAZns+1msaCXetrMFE= 57 | github.com/makeworld-the-better-one/dither/v2 v2.4.0/go.mod h1:VBtN8DXO7SNtyGmLiGA7IsFeKrBkQPze1/iAeM95arc= 58 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 59 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 60 | github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= 61 | github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= 62 | github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= 63 | github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= 64 | github.com/mattn/go-sixel v0.0.5 h1:55w2FR5ncuhKhXrM5ly1eiqMQfZsnAHIpYNGZX03Cv8= 65 | github.com/mattn/go-sixel v0.0.5/go.mod h1:h2Sss+DiUEHy0pUqcIB6PFXo5Cy8sTQEFr3a9/5ZLNw= 66 | github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= 67 | github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= 68 | github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= 69 | github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= 70 | github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= 71 | github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= 72 | github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= 73 | github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= 74 | github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 75 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 76 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 77 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 78 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 79 | github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= 80 | github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= 81 | github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= 82 | github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= 83 | github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= 84 | github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= 85 | github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= 86 | github.com/soniakeys/quant v1.0.0 h1:N1um9ktjbkZVcywBVAAYpZYSHxEfJGzshHCxx/DaI0Y= 87 | github.com/soniakeys/quant v1.0.0/go.mod h1:HI1k023QuVbD4H8i9YdfZP2munIHU4QpjsImz6Y6zds= 88 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 89 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 90 | github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= 91 | github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 92 | github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= 93 | github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= 94 | golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E= 95 | golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= 96 | golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ= 97 | golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs= 98 | golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= 99 | golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= 100 | golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 101 | golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 102 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 103 | golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= 104 | golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 105 | golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= 106 | golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 107 | golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= 108 | golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= 109 | golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= 110 | golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= 111 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 112 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= 113 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 114 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 115 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 116 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 117 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------