limit description length
rather than limiting lines count
This commit is contained in:
parent
87211e802d
commit
6dc2c39ee6
1 changed files with 4 additions and 4 deletions
|
@ -162,17 +162,17 @@ func (v *YoutubeVideo) getFullPath() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *YoutubeVideo) getAbbrevDescription() string {
|
func (v *YoutubeVideo) getAbbrevDescription() string {
|
||||||
maxLines := 10
|
maxLength := 2800
|
||||||
description := strings.TrimSpace(v.description)
|
description := strings.TrimSpace(v.description)
|
||||||
additionalDescription := "\nhttps://www.youtube.com/watch?v=" + v.id
|
additionalDescription := "\nhttps://www.youtube.com/watch?v=" + v.id
|
||||||
khanAcademyClaimID := "5fc52291980268b82413ca4c0ace1b8d749f3ffb"
|
khanAcademyClaimID := "5fc52291980268b82413ca4c0ace1b8d749f3ffb"
|
||||||
if v.lbryChannelID == khanAcademyClaimID {
|
if v.lbryChannelID == khanAcademyClaimID {
|
||||||
additionalDescription = additionalDescription + "\nNote: All Khan Academy content is available for free at (www.khanacademy.org)"
|
additionalDescription = additionalDescription + "\nNote: All Khan Academy content is available for free at (www.khanacademy.org)"
|
||||||
}
|
}
|
||||||
if strings.Count(description, "\n") < maxLines {
|
if len(description) > maxLength {
|
||||||
return description + "\n..." + additionalDescription
|
description = description[:maxLength]
|
||||||
}
|
}
|
||||||
return strings.Join(strings.Split(description, "\n")[:maxLines], "\n") + "\n..." + additionalDescription
|
return description + "\n..." + additionalDescription
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *YoutubeVideo) download(useIPv6 bool) error {
|
func (v *YoutubeVideo) download(useIPv6 bool) error {
|
||||||
|
|
Loading…
Add table
Reference in a new issue