本文整理匯總了Golang中github.com/darkhelmet/tinderizer/job.Job.Root方法的典型用法代碼示例。如果您正苦於以下問題:Golang Job.Root方法的具體用法?Golang Job.Root怎麽用?Golang Job.Root使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/darkhelmet/tinderizer/job.Job
的用法示例。
在下文中一共展示了Job.Root方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Process
func (e *Extractor) Process(job J.Job) {
job.Progress("Extracting...")
defer e.wg.Done()
resp, err := e.extractRetry(job.Url, job.Content)
if err != nil {
e.error(job, "%s", err)
return
}
doc, err := rewriteAndDownloadImages(job.Root(), resp.Content)
if err != nil {
e.error(job, "HTML parsing failed: %s", err)
return
}
job.Doc = doc
if resp.Title != "" {
job.Title = resp.Title
}
job.Domain = resp.Domain
if resp.Author != nil {
job.Author = *resp.Author
}
job.Progress("Extraction complete...")
e.Output <- job
}
示例2: Process
func (c *Cleaner) Process(job J.Job) {
defer c.wg.Done()
if job.Friendly != "" {
job.Progress(job.Friendly)
}
os.RemoveAll(job.Root())
}
示例3: Process
func (k *Kindlegen) Process(job J.Job) {
job.Progress("Optimizing for Kindle...")
defer k.wg.Done()
if err := writeHTML(job); err != nil {
k.error(job, err.Error())
return
}
cmd := exec.Command(k.binary, []string{job.HTMLFilename()}...)
cmd.Dir = job.Root()
out, err := cmd.CombinedOutput()
if !fileExists(job.MobiFilePath()) {
k.error(job, "failed running kindlegen: %s {output=%s}", err, out)
return
}
job.Progress("Optimization complete...")
k.Output <- job
}