mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
commit
4296bd191d
3 changed files with 5 additions and 5 deletions
|
|
@ -280,7 +280,7 @@ func (c *Crunchyroll) Search(query string, limit uint) (s []*Series, m []*Movie,
|
||||||
return s, m, nil
|
return s, m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindVideo fins a Video (Season or Movie) by a crunchyroll link
|
// FindVideo finds a Video (Season or Movie) by a crunchyroll link
|
||||||
// e.g. https://www.crunchyroll.com/darling-in-the-franxx
|
// e.g. https://www.crunchyroll.com/darling-in-the-franxx
|
||||||
func (c *Crunchyroll) FindVideo(seriesUrl string) (Video, error) {
|
func (c *Crunchyroll) FindVideo(seriesUrl string) (Video, error) {
|
||||||
if series, ok := MatchVideo(seriesUrl); ok {
|
if series, ok := MatchVideo(seriesUrl); ok {
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ func (f *Format) getCrypt(segment *m3u8.MediaSegment) (block cipher.Block, iv []
|
||||||
return block, iv, nil
|
return block, iv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// downloadSegment downloads a segments, decrypts it and names it after the given index
|
// downloadSegment downloads a segment, decrypts it and names it after the given index
|
||||||
func (f *Format) downloadSegment(segment *m3u8.MediaSegment, filename string, block cipher.Block, iv []byte) (*os.File, error) {
|
func (f *Format) downloadSegment(segment *m3u8.MediaSegment, filename string, block cipher.Block, iv []byte) (*os.File, error) {
|
||||||
// every segment is aes-128 encrypted and has to be decrypted when downloaded
|
// every segment is aes-128 encrypted and has to be decrypted when downloaded
|
||||||
content, err := decryptSegment(f.crunchy.Client, segment, block, iv)
|
content, err := decryptSegment(f.crunchy.Client, segment, block, iv)
|
||||||
|
|
@ -200,7 +200,7 @@ func (f *Format) downloadSegment(segment *m3u8.MediaSegment, filename string, bl
|
||||||
return file, nil
|
return file, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// mergeSegments reads every file in tempPath and write their content to output
|
// mergeSegments reads every file in tempPath and writes their content to output
|
||||||
func (f *Format) mergeSegments(tempPath string, output *os.File) error {
|
func (f *Format) mergeSegments(tempPath string, output *os.File) error {
|
||||||
dir, err := os.ReadDir(tempPath)
|
dir, err := os.ReadDir(tempPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func (mlbd MovieListingsByDuration) Less(i, j int) bool {
|
||||||
return mlbd[i].DurationMS < mlbd[j].DurationMS
|
return mlbd[i].DurationMS < mlbd[j].DurationMS
|
||||||
}
|
}
|
||||||
|
|
||||||
// EpisodesByDuration episodes by their duration
|
// EpisodesByDuration sorts episodes by their duration
|
||||||
type EpisodesByDuration []*crunchyroll.Episode
|
type EpisodesByDuration []*crunchyroll.Episode
|
||||||
|
|
||||||
func (ebd EpisodesByDuration) Len() int {
|
func (ebd EpisodesByDuration) Len() int {
|
||||||
|
|
@ -32,7 +32,7 @@ func (ebd EpisodesByDuration) Less(i, j int) bool {
|
||||||
return ebd[i].DurationMS < ebd[j].DurationMS
|
return ebd[i].DurationMS < ebd[j].DurationMS
|
||||||
}
|
}
|
||||||
|
|
||||||
// FormatsByResolution sort formats after their resolution
|
// FormatsByResolution sorts formats after their resolution
|
||||||
type FormatsByResolution []*crunchyroll.Format
|
type FormatsByResolution []*crunchyroll.Format
|
||||||
|
|
||||||
func (fbr FormatsByResolution) Len() int {
|
func (fbr FormatsByResolution) Len() int {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue