view cmd_donwload.go @ 6:fca852bfd500

...
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 31 Mar 2020 15:12:16 +0900
parents a0d23f38344d
children 8a7a15dc3b9d
line wrap: on
line source

package lectable

import (
	"context"
	"fmt"
	"io"

	"ie.u-ryukyu.ac.jp/hg/y19/index.cgi/home/hg/y19/k198584/Tools/lectable/syllabus"
)

type cmdDownload struct{}

func (cd *cmdDownload) name() string {
	return "download"
}

func (cd *cmdDownload) description() string {
	return "donwload html from lecture ids"
}

func (cd *cmdDownload) run(ctx context.Context, argv []string, outStream, errStream io.Writer) error {
	fmt.Println("download now!!")
	dh := syllabus.CreateGetSyllabus()
	_, err := dh.CheckAndMkdirBuilddir()
	if err != nil {
		return err
	}
	arr3 := []string{"601495001", "600625001"}

	lwps, err := dh.LecIDStoDonwlodSyllabus(ctx, arr3)
	fmt.Println(lwps)
	for _, lwp := range *lwps {
		lec, err := dh.LecIDwFilePath2LectureStruct(&lwp)
		if err != nil {
			return err
		}
		fmt.Println(lec)
	}
	return err
}