Skip to content

Commit

Permalink
added video duration in online music adder
Browse files Browse the repository at this point in the history
  • Loading branch information
evanhyd committed Apr 24, 2023
1 parent c88ac60 commit cb8405a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
13 changes: 6 additions & 7 deletions source/scraper/Clipzag.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package scraper

import (
"fmt"
"html"
"io"
"log"
Expand Down Expand Up @@ -68,13 +69,11 @@ func parseSearchResult(parsed []string, result *ClipzagResult, completes chan st
staticImage.SetMinSize(resource.GetThumbnailIconSize())

*result = ClipzagResult{
videoID: parsed[1][8:],
thumbnail: staticImage,
duration: parsed[3],
videoTitle: html.UnescapeString(parsed[4]),
channelTitle: parsed[5],
stats: parsed[6],
description: parsed[7],
videoID: parsed[1][8:],
thumbnail: staticImage,
videoTitle: html.UnescapeString(parsed[4]),
stats: fmt.Sprintf("[%v] %v | %v", parsed[3], parsed[5], parsed[6]),
description: parsed[7],
}
completes <- struct{}{}
}
20 changes: 5 additions & 15 deletions source/scraper/ClipzagResult.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import (
)

type ClipzagResult struct {
videoID string
thumbnail *canvas.Image
duration string
videoTitle string
channelTitle string
stats string
description string
videoID string
thumbnail *canvas.Image
videoTitle string
stats string
description string
}

func (clipzagResult *ClipzagResult) VideoID() string {
Expand All @@ -22,18 +20,10 @@ func (clipzagResult *ClipzagResult) Thumbnail() *canvas.Image {
return clipzagResult.thumbnail
}

func (clipzagResult *ClipzagResult) Duration() string {
return clipzagResult.duration
}

func (clipzagResult *ClipzagResult) VideoTitle() string {
return clipzagResult.videoTitle
}

func (clipzagResult *ClipzagResult) ChannelTitle() string {
return clipzagResult.channelTitle
}

func (clipzagResult *ClipzagResult) Stats() string {
return clipzagResult.stats
}
Expand Down
4 changes: 2 additions & 2 deletions source/ui/MusicTabUI.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ func createAddOnlineDialog() dialog.Dialog {

videoTitle.Text = result.VideoTitle()

videoInfo := gridItems[1].(*widget.Label)
videoInfo.Text = result.ChannelTitle() + " | " + result.Stats()
videoStats := gridItems[1].(*widget.Label)
videoStats.Text = result.Stats()

description := gridItems[2].(*widget.Label)
description.Text = result.Description()
Expand Down

0 comments on commit cb8405a

Please sign in to comment.