Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
Fix flickering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
goulinkh committed Apr 5, 2020
1 parent bc84dbe commit aea3d87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Top-like interface for listening podcasts
`podcast-cli` lets you play your podcasts from the terminal:
<p align="center"><img src="/ressources/img/demo.gif" alt="podcast-cli"/></p>

`podcast-cli` is built entirely with Go, you can run it on `Linux` and `Windows`.
`podcast-cli` is built entirely with Go, you can run it on `Linux`, `Mac OS` and `Windows`.

## Install
Fetch the [latest release](https://github.com/goulinkh/podcast-cli/releases)
Expand Down Expand Up @@ -33,4 +33,3 @@ Fetch the [latest release](https://github.com/goulinkh/podcast-cli/releases)
**Issues**

* Unable to get audio length of a remote content, I have to download the audio file before playing it
* No Mac OS support due to a problem with the audio player
14 changes: 10 additions & 4 deletions ui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func Show() {
uiEvents := ui.PollEvents()
for {
select {
case <-time.After(time.Microsecond * 500):
case <-time.After(time.Microsecond * 700):
if audioplayer.MainCtrl != nil {
if audioplayer.MainCtrl.Paused == false {
position := audioplayer.Position()
Expand All @@ -96,8 +96,10 @@ func Show() {
if audioDuration > 0 {
audioDurationWidget.Percent = (position * 100) / audioDuration
}
rerender()
} else if audioplayer.MainCtrl.Paused == true {
audioDurationWidget.Title = "Stopped"
rerender()
}
}
case e := <-uiEvents:
Expand All @@ -123,7 +125,7 @@ func Show() {
if err != nil {
audioDurationWidget.Title = "Unsupported audio content"
}
frameUpdate()
rerender()
}()
}
}
Expand Down Expand Up @@ -187,12 +189,16 @@ func Show() {
currentListWidget = podcastsListWidget
currentDetailsWidget = podcastDetailsWidget
updateDetailsWidget()
frameUpdate()
}
frameUpdate()
rerender()
}
}
}

func rerender() {
ui.Clear()
ui.Render(grid, helpBarWidget)
}
func frameUpdate() {
initGrid()
}
Expand Down

0 comments on commit aea3d87

Please sign in to comment.