view cmd_donwload.go @ 10:b6a2d89b06e7

add cmd_pdf
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 31 Mar 2020 16:32:53 +0900
parents 2348344480da
children e7d9f63d969c
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, outStream)
	lectures, err := dh.LectureWPathS2LectureStruct(ctx, lwps, outStream)
	if err != nil {
		return err
	}
	return dh.DumpLecureToJson(lectures)
}