Skip to content

Commit 4f82f0b

Browse files
committed
Fix formatting
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
1 parent aeec6cc commit 4f82f0b

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

pkg/builder/youtube.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ import (
1818
"github.com/mxpv/podsync/pkg/model"
1919
"github.com/mxpv/podsync/pkg/ytdl"
2020
)
21+
2122
type Downloader interface {
22-
PlaylistMetadata(ctx context.Context, url string) (metadata ytdl.PlaylistMetadata, err error)
23+
PlaylistMetadata(ctx context.Context, url string) (metadata ytdl.PlaylistMetadata, err error)
2324
}
2425

2526
const (
@@ -37,8 +38,8 @@ func (key apiKey) Get() (string, string) {
3738
}
3839

3940
type YouTubeBuilder struct {
40-
client *youtube.Service
41-
key apiKey
41+
client *youtube.Service
42+
key apiKey
4243
downloader Downloader
4344
}
4445

@@ -235,7 +236,7 @@ func (yt *YouTubeBuilder) queryFeed(ctx context.Context, feed *model.Feed, info
235236
return errors.Wrapf(err, "failed to get playlist metadata for %s", feed.ItemURL)
236237
}
237238
log.Infof("Playlist metadata: %v", metadata)
238-
if(len(metadata.Thumbnails) > 0) {
239+
if len(metadata.Thumbnails) > 0 {
239240
// best qualtiy thumbnail is the last one
240241
feed.CoverArt = metadata.Thumbnails[len(metadata.Thumbnails)-1].Url
241242
} else {
@@ -323,7 +324,7 @@ func (yt *YouTubeBuilder) queryVideoDescriptions(ctx context.Context, playlist m
323324
// Parse date added to playlist / publication date
324325
dateStr := ""
325326
playlistItem, ok := playlist[video.Id]
326-
if ok && playlistItem.PublishedAt > snippet.PublishedAt{
327+
if ok && playlistItem.PublishedAt > snippet.PublishedAt {
327328
// Use playlist item publish date if it's more recent
328329
dateStr = playlistItem.PublishedAt
329330
} else {
@@ -334,7 +335,7 @@ func (yt *YouTubeBuilder) queryVideoDescriptions(ctx context.Context, playlist m
334335
if err != nil {
335336
return errors.Wrapf(err, "failed to parse video publish date: %s", dateStr)
336337
}
337-
338+
338339
// Sometimes YouTube retrun empty content defailt, use arbitrary one
339340
var seconds int64 = 1
340341
if video.ContentDetails != nil {
@@ -481,5 +482,5 @@ func NewYouTubeBuilder(key string, ytdlp Downloader) (*YouTubeBuilder, error) {
481482
return nil, errors.Wrap(err, "failed to create youtube client")
482483
}
483484

484-
return &YouTubeBuilder{client: yt, key: apiKey(key), downloader:ytdlp}, nil
485+
return &YouTubeBuilder{client: yt, key: apiKey(key), downloader: ytdlp}, nil
485486
}

pkg/feed/xml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func Build(_ctx context.Context, feed *model.Feed, cfg *Config, hostname string)
4444
feedLink = feed.ItemURL
4545
)
4646

47-
if author == "<notfound>" {
47+
if author == "<notfound>" {
4848
author = feed.Title
4949
}
5050

pkg/ytdl/ytdl.go

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package ytdl
22

33
import (
4-
"encoding/json"
54
"context"
5+
"encoding/json"
66
"fmt"
77
"io"
88
"net/http"
@@ -26,23 +26,22 @@ const (
2626
)
2727

2828
type PlaylistMetadataThumbnail struct {
29-
Id string `json:"id"`
30-
Url string `json:"url"`
29+
Id string `json:"id"`
30+
Url string `json:"url"`
3131
Resolution string `json:"resolution"`
32-
Width int `json:"width"`
33-
Height int `json:"height"`
32+
Width int `json:"width"`
33+
Height int `json:"height"`
3434
}
3535

3636
type PlaylistMetadata struct {
37-
Id string `json:"id"`
38-
Title string `json:"title"`
39-
Description string `json:"description"`
40-
Thumbnails []PlaylistMetadataThumbnail `json:"thumbnails"`
41-
Channel string `json:"channel"`
42-
ChannelId string `json:"channel_id"`
43-
ChannelUrl string `json:"channel_url"`
44-
WebpageUrl string `json:"webpage_url"`
45-
37+
Id string `json:"id"`
38+
Title string `json:"title"`
39+
Description string `json:"description"`
40+
Thumbnails []PlaylistMetadataThumbnail `json:"thumbnails"`
41+
Channel string `json:"channel"`
42+
ChannelId string `json:"channel_id"`
43+
ChannelUrl string `json:"channel_url"`
44+
WebpageUrl string `json:"webpage_url"`
4645
}
4746

4847
var (
@@ -177,13 +176,12 @@ func (dl *YoutubeDl) Update(ctx context.Context) error {
177176
return nil
178177
}
179178

180-
181179
func (dl *YoutubeDl) PlaylistMetadata(ctx context.Context, url string) (metadata PlaylistMetadata, err error) {
182180
log.Info("getting playlist metadata for: ", url)
183181
args := []string{
184182
"--playlist-items", "0",
185-
"-J", // JSON output
186-
"-q", // quiet mode
183+
"-J", // JSON output
184+
"-q", // quiet mode
187185
"--no-warnings", // suppress warnings
188186
url,
189187
}

services/update/updater.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323

2424
type Downloader interface {
2525
Download(ctx context.Context, feedConfig *feed.Config, episode *model.Episode) (io.ReadCloser, error)
26-
PlaylistMetadata(ctx context.Context, url string) (metadata ytdl.PlaylistMetadata, err error)
26+
PlaylistMetadata(ctx context.Context, url string) (metadata ytdl.PlaylistMetadata, err error)
2727
}
2828

2929
type TokenList []string

0 commit comments

Comments
 (0)