• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang mlog.Info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/apertoire/mlog.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Start

func (self *Pruner) Start() {
	mlog.Info("starting Pruner service ...")

	go self.react()

	mlog.Info("Pruner service started")
}
开发者ID:sh4t,项目名称:mediabase,代码行数:7,代码来源:pruner.go


示例2: Start

func (self *Core) Start() {
	mlog.Info("starting core service ...")

	events := []fsm.EventDesc{
		{Name: "import", Src: []string{"idle", "scanning"}, Dst: "scanning"},
		{Name: "found", Src: []string{"scanning"}, Dst: "scanning"},
		{Name: "scraped", Src: []string{"scanning"}, Dst: "scanning"},
		{Name: "status", Src: []string{"idle", "scanning"}, Dst: "scanning"},
		{Name: "finish", Src: []string{"scanning"}, Dst: "idle"},
	}

	// some initialization
	self.fsm = fsm.NewFSM(
		"idle",
		events,
		fsm.Callbacks{
			"import":  self.importer,
			"found":   self.found,
			"scraped": self.scraped,
			"finish":  self.finish,
		},
	)

	self.context = message.Context{Message: "Idle", Backdrop: "/mAwd34SAC8KqBKRm2MwHPLhLDU5.jpg", Completed: false}

	go self.react()

	mlog.Info("core service started")
}
开发者ID:sh4t,项目名称:mediabase,代码行数:29,代码来源:core.go


示例3: Start

func (self *Scanner) Start() {
	mlog.Info("starting scanner service ...")

	mlog.Info("compiling regular expressions ...")

	// test:="I am leaving from home in a while"
	// prepositionsRegex := make([]*regexp.Regexp, len(preps))
	// for i := 0; i < len(preps); i++ {
	// prepositionsRegex[i]=regexp.MustCompile(`\b`+preps[i]+`\b`)
	// }

	// for i := 0; i < len(prepositionsRegex); i++ {
	// fmt.Println(prepositionsRegex[i].String())
	// if loc := prepositionsRegex[i].FindStringIndex(test); loc != nil{
	// fmt.Println(test[loc[0]:loc[1]], "found at: ", loc[0])
	// break

	self.re = make([]*helper.Rexp, 0)

	for _, regex := range self.Config.MediaRegexs {
		self.re = append(self.re, &helper.Rexp{Exp: regexp.MustCompile(regex)})
	}

	// self.re[0] = &helper.Rexp{Exp: regexp.MustCompile(`(?i)/volumes/.*?/(?P<Resolution>.*?)/(?P<Name>.*?)\s\((?P<Year>\d\d\d\d)\)/(?:.*/)*bdmv/index.(?P<FileType>bdmv)$`)}
	// self.re[1] = &helper.Rexp{Exp: regexp.MustCompile(`(?i)/volumes/.*?/(?P<Resolution>.*?)/(?P<Name>.*?)\s\((?P<Year>\d\d\d\d)\)/(?:.*/)*.*\.(?P<FileType>iso|img|nrg|mkv|avi|xvid|ts|mpg|dvr-ms|mdf|wmv)$`)}
	// self.re[2] = &helper.Rexp{Exp: regexp.MustCompile(`(?i)/volumes/.*?/(?P<Resolution>.*?)/(?P<Name>.*?)\s\((?P<Year>\d\d\d\d)\)/(?:.*/)*(?:video_ts|hv000i01)\.(?P<FileType>ifo)$`)}

	self.includedMask = ".bdmv|.iso|.img|.nrg|.mkv|.avi|.xvid|.ts|.mpg|.dvr-ms|.mdf|.wmv|.ifo"

	go self.react()

	mlog.Info("scanner service started")
}
开发者ID:sh4t,项目名称:mediabase,代码行数:33,代码来源:scanner.go


示例4: Start

func (self *Cache) Start() {
	mlog.Info("starting cache service ...")

	self.workpool = workpool.New(4, 2000)

	go self.react()

	mlog.Info("cache service started")
}
开发者ID:sh4t,项目名称:mediabase,代码行数:9,代码来源:cache.go


示例5: doMovieRescraped

func (self *Core) doMovieRescraped(media *message.Media) {
	go func() {
		mlog.Info("UPDATING MOVIE [%s]", media.Movie.Title)
		self.Bus.UpdateMovie <- media.Movie
	}()

	go func() {
		mlog.Info("CACHING MEDIA [%s]", media.Movie.Title)
		media.BasePath = self.Config.DataDir
		self.Bus.CacheMedia <- media
	}()
}
开发者ID:sh4t,项目名称:mediabase,代码行数:12,代码来源:core.go


示例6: walker

func (self *Scanner) walker(folder string) error {

	if folder[len(folder)-1] != '/' {
		folder = folder + "/"
	}

	err := filepath.Walk(folder, func(path string, f os.FileInfo, err error) error {
		if err != nil {
			mlog.Info("from-start err: %s", err)
		}

		// mlog.Info("maldito: %s", path)

		if !strings.Contains(self.includedMask, strings.ToLower(filepath.Ext(path))) {
			// mlog.Info("[%s] excluding %s", filepath.Ext(path), path)
			return nil
		}

		comparePath := strings.TrimPrefix(path, folder)
		// mlog.Info("folder: %s, comparePath: %s", folder, comparePath)
		// TODO: remove folder from path to match against rexp

		for i := 0; i < 3; i++ {
			// match := self.re[i].FindStringSubmatch(strings.ToLower(path))
			// if match == nil {
			// 	continue
			// }
			var rmap = self.re[i].Match(comparePath)
			if rmap == nil {
				continue
			}

			var resolution string
			var ok bool
			if resolution, ok = rmap["Resolution"]; !ok {
				resolution = ""
			}

			movie := &message.Movie{Title: rmap["Name"], File_Title: rmap["Name"], Year: rmap["Year"], Resolution: resolution, FileType: rmap["FileType"], Location: path}
			mlog.Info("FOUND [%s] (%s)", movie.Title, movie.Location)

			self.Bus.MovieFound <- movie

			return nil
		}

		return nil
	})

	return err
}
开发者ID:sh4t,项目名称:mediabase,代码行数:51,代码来源:scanner.go


示例7: doMovieScraped

func (self *Core) doMovieScraped(media *message.Media) {
	go func() {
		mlog.Info("STORING MOVIE [%s]", media.Movie.Title)
		self.Bus.StoreMovie <- media.Movie
	}()

	go func() {
		mlog.Info("CACHING MEDIA [%s]", media.Movie.Title)
		media.BasePath = self.Config.DataDir
		self.Bus.CacheMedia <- media

		self.fsm.Event("scrape", media.Movie)
	}()
}
开发者ID:sh4t,项目名称:mediabase,代码行数:14,代码来源:core.go


示例8: Save

func (self *Config) Save() {
	b, err := json.MarshalIndent(self, "", "   ")
	if err != nil {
		mlog.Info("couldn't marshal: %s", err)
		return
	}

	path := filepath.Join(self.DataDir, "config.json")
	err = ioutil.WriteFile(path, b, 0644)
	if err != nil {
		mlog.Info("WriteFileJson ERROR: %+v", err)
	}

	mlog.Info("saved as: %s", string(b))
}
开发者ID:sh4t,项目名称:mediabase,代码行数:15,代码来源:config.go


示例9: doScanMovies

func (self *Scanner) doScanMovies(reply chan string) {
	mlog.Info("inside ScanMovies")

	reply <- "Movie scannning process started ..."

	for _, folder := range self.Config.MediaFolders {
		err := self.walker(folder)
		if err != nil {
			mlog.Info("Unable to scan movies: %s", err)
		}

		mlog.Info("Completed scan of folder: %s", folder)
	}

	self.Bus.ImportMoviesFinished <- 1
}
开发者ID:sh4t,项目名称:mediabase,代码行数:16,代码来源:scanner.go


示例10: Init

func (self *Config) Init(version string) {
	self.Version = version

	runtime := runtime.GOOS

	switch runtime {
	case "darwin":
		self.DataDir = filepath.Join(os.Getenv("HOME"), ".mediabase/")
	case "linux":
		self.DataDir = filepath.Join(os.Getenv("HOME"), ".mediabase/")
	case "windows":
		self.DataDir = filepath.Join(os.Getenv("APPDATA"), "mediabase\\")
	}

	path := filepath.Join(self.DataDir, "log")
	if _, err := os.Stat(path); os.IsNotExist(err) {
		if err = os.Mkdir(path, 0755); err != nil {
			log.Printf("FATAL: Unable to create folder %s: %s", path, err)
			os.Exit(255)
		}
	}

	// os.Setenv("GIN_MODE", "release")
	mlog.Start(mlog.LevelInfo, filepath.Join(self.DataDir, "log", "mediabase.log"))
	mlog.Info("mediabase v%s starting up on %s ...", self.Version, runtime)

	self.setupOperatingEnv()

	self.LoadConfig()
	self.LoadRegex()
}
开发者ID:sh4t,项目名称:mediabase,代码行数:31,代码来源:config.go


示例11: Start

func (self *Server) Start() {
	mlog.Info("starting server service")

	self.r = gin.New()

	self.r.Use(gin.Recovery())
	// self.r.Use(helper.Logging())

	path := filepath.Join(".", "web")

	var abs string
	var err error
	if abs, err = filepath.Abs(path); err != nil {
		mlog.Info("unable to get absolute path: %s, ", err)
		return
	}

	mlog.Info("server root path is: %s", abs)

	// self.r.Use(static.Serve("./web/"))
	self.r.Use(static.Serve(path))
	self.r.NoRoute(self.redirect)

	api := self.r.Group(apiVersion)
	{
		api.GET("/movies/cover", self.getCover)
		api.POST("/movies", self.getMovies)
		api.POST("/movies/search", self.searchMovies)

		api.GET("/movies/duplicates", self.getDuplicates)

		api.PUT("/movies/watched", self.watchedMovie)
		api.POST("/movies/fix", self.fixMovie)
		api.POST("/movies/prune", self.pruneMovies)

		api.GET("/import", self.importMovies)
		api.GET("/import/status", self.importMoviesStatus)

		api.GET("/config", self.getConfig)
		api.PUT("/config", self.saveConfig)
	}

	mlog.Info("service started listening on %s:%s", self.Config.Host, self.Config.Port)

	go self.r.Run(fmt.Sprintf("%s:%s", self.Config.Host, self.Config.Port))
}
开发者ID:sh4t,项目名称:mediabase,代码行数:46,代码来源:server.go


示例12: Start

func (self *Scraper) Start() {
	mlog.Info("starting scraper service ...")

	var err error
	self.tmdb, err = tmdb.NewClient("e610ded10c3f47d05fe797961d90fea6", false)
	if err != nil {
		mlog.Fatalf("unable to create tmdb client: %s", err)
	}

	self.workpool = workpool.New(12, 4000)

	go self.react()

	// go self.workpool.Balance()

	mlog.Info("scraper service started")
}
开发者ID:sh4t,项目名称:mediabase,代码行数:17,代码来源:scraper.go


示例13: searchMovies

func (self *Server) searchMovies(c *gin.Context) {
	mlog.Info("searchMovies: are you a head honcho ?")

	var options message.Options

	c.Bind(&options)

	mlog.Info("anyway the wind blows: %+v", options)

	msg := message.Movies{Options: options, Reply: make(chan *message.MoviesDTO)}
	self.Bus.SearchMovies <- &msg
	reply := <-msg.Reply

	// mlog.Info("%s", reply)

	c.JSON(200, &reply)
}
开发者ID:sh4t,项目名称:mediabase,代码行数:17,代码来源:server.go


示例14: doGetMovies

func (self *Dal) doGetMovies(msg *message.Movies) {
	tx, err := self.db.Begin()
	if err != nil {
		mlog.Fatalf("unable to begin transaction: %s", err)
	}

	options := msg.Options
	mlog.Info("what is: %+v", options)

	stmt, err := tx.Prepare(fmt.Sprintf("select rowid, title, original_title, file_title, year, runtime, tmdb_id, imdb_id, overview, tagline, resolution, filetype, location, cover, backdrop, genres, vote_average, vote_count, countries, added, modified, last_watched, all_watched, count_watched, score, director, writer, actors, awards, imdb_rating, imdb_votes from movie order by %s %s limit ? offset ?", options.SortBy, options.SortOrder))
	if err != nil {
		mlog.Fatalf("unable to prepare transaction: %s", err)
	}
	defer stmt.Close()

	rows, err := stmt.Query(options.Limit, options.Current)
	if err != nil {
		mlog.Fatalf("unable to prepare transaction: %s", self.err)
	}

	items := make([]*message.Movie, 0)

	if self.count == 0 {
		err = self.countRows.QueryRow().Scan(&self.count)
		if err != nil {
			mlog.Fatalf("unable to count rows: %s", err)
		}
	}

	var count = 0
	for rows.Next() {
		movie := message.Movie{}
		rows.Scan(&movie.Id, &movie.Title, &movie.Original_Title, &movie.File_Title, &movie.Year, &movie.Runtime, &movie.Tmdb_Id, &movie.Imdb_Id, &movie.Overview, &movie.Tagline, &movie.Resolution, &movie.FileType, &movie.Location, &movie.Cover, &movie.Backdrop, &movie.Genres, &movie.Vote_Average, &movie.Vote_Count, &movie.Production_Countries, &movie.Added, &movie.Modified, &movie.Last_Watched, &movie.All_Watched, &movie.Count_Watched, &movie.Score, &movie.Director, &movie.Writer, &movie.Actors, &movie.Awards, &movie.Imdb_Rating, &movie.Imdb_Votes)
		items = append(items, &movie)
		count++
	}
	rows.Close()

	tx.Commit()

	mlog.Info("Listed %d movies", count)
	mlog.Info("Representing %d movies", self.count)

	msg.Reply <- &message.MoviesDTO{Count: self.count, Movies: items}
}
开发者ID:sh4t,项目名称:mediabase,代码行数:45,代码来源:dal.go


示例15: importMovies

func (self *Server) importMovies(c *gin.Context) {
	mlog.Info("importMovies: you know .. i got here")

	msg := message.Status{Reply: make(chan *message.Context)}
	self.Bus.ImportMovies <- &msg
	reply := <-msg.Reply

	c.JSON(200, &reply)
}
开发者ID:sh4t,项目名称:mediabase,代码行数:9,代码来源:server.go


示例16: Start

func (self *Dal) Start() {
	mlog.Info("starting dal service ...")

	self.dbase = filepath.Join(".", "db", "mediabase.db")
	self.db, self.err = sql.Open("sqlite3", self.dbase)
	if self.err != nil {
		mlog.Fatalf("open database: %s (%s)", self.err, self.dbase)
	}

	stmtExist := self.prepare(`select name from sqlite_master where type='table' and name='movie'`)
	defer stmtExist.Close()

	var name string
	err := stmtExist.QueryRow().Scan(&name)
	if err != nil {
		mlog.Fatalf("unable to check for existence of movie database: %s (%s)", self.err, self.dbase)
	}

	if name != "movie" {
		mlog.Info("Initializing database schema ...")
		self.initSchema()
	}

	self.count = 0
	self.searchCount = 0
	self.searchArgs = ""

	self.countRows = self.prepare("select count(*) from movie;")
	self.listMovies = self.prepare("select rowid, title, original_title, file_title, year, runtime, tmdb_id, imdb_id, overview, tagline, resolution, filetype, location, cover, backdrop, genres, vote_average, vote_count, countries, added, modified, last_watched, all_watched, count_watched, score, director, writer, actors, awards, imdb_rating, imdb_votes from movie order by ? desc limit ? offset ?")
	self.listByRuntime = self.prepare("select rowid, title, original_title, file_title, year, runtime, tmdb_id, imdb_id, overview, tagline, resolution, filetype, location, cover, backdrop, genres, vote_average, vote_count, countries, added, modified, last_watched, all_watched, count_watched, score, director, writer, actors, awards, imdb_rating, imdb_votes from movie order by runtime")
	self.listMoviesToFix = self.prepare("select rowid, title, original_title, file_title, year, runtime, tmdb_id, imdb_id, overview, tagline, resolution, filetype, location, cover, backdrop, genres, vote_average, vote_count, countries, added, modified, last_watched, all_watched, count_watched, score, director, writer, actors, awards, imdb_rating, imdb_votes from movie where original_title = 'FIXMOV23'")

	var abs string
	if abs, err = filepath.Abs(self.dbase); err != nil {
		mlog.Info("unable to get absolute path: %s, ", err)
		return
	}

	mlog.Info("connected to database (%s)", abs)

	// self.initSchema()

	go self.react()
}
开发者ID:sh4t,项目名称:mediabase,代码行数:44,代码来源:dal.go


示例17: Stop

func (self *Dal) Stop() {
	self.listMoviesToFix.Close()
	self.listByRuntime.Close()
	self.listMovies.Close()
	// self.searchMovies.Close()
	// self.storeMovie.Close()
	self.db.Close()

	mlog.Info("dal service stopped")
}
开发者ID:sh4t,项目名称:mediabase,代码行数:10,代码来源:dal.go


示例18: requestWork

func (self *Cache) requestWork(media *message.Media) {
	mlog.Info("CACHE MEDIA REQUESTED [%s]", media.Movie.Title)

	gig := &CacheGig{
		media,
		self.Config.DataDir,
	}

	self.workpool.PostWork("cachegig", gig)
}
开发者ID:sh4t,项目名称:mediabase,代码行数:10,代码来源:cache.go


示例19: doWatchedMovie

func (self *Dal) doWatchedMovie(msg *message.SingleMovie) {
	mlog.Info("STARTED UPDATING WATCHED MOVIE %s (%s)", msg.Movie.Title, msg.Movie.Last_Watched)

	tx, err := self.db.Begin()
	if err != nil {
		mlog.Fatalf("at begin: %s", err)
	}

	stmt, err := tx.Prepare("update movie set last_watched = ?, all_watched = ?, count_watched = ?, score = ?, modified = ? where rowid = ?")
	if err != nil {
		tx.Rollback()
		mlog.Fatalf("at prepare: %s", err)
	}
	defer stmt.Close()

	now := time.Now().UTC().Format(time.RFC3339)

	var all_watched string
	count_watched := msg.Movie.Count_Watched
	if !strings.Contains(msg.Movie.All_Watched, msg.Movie.Last_Watched) {
		count_watched++
		if msg.Movie.All_Watched == "" {
			all_watched = msg.Movie.Last_Watched
		} else {
			all_watched += "|" + msg.Movie.Last_Watched
		}
	}

	_, err = stmt.Exec(msg.Movie.Last_Watched, all_watched, count_watched, msg.Movie.Score, now, msg.Movie.Id)
	if err != nil {
		tx.Rollback()
		mlog.Fatalf("at exec: %s", err)
	}

	tx.Commit()
	mlog.Info("FINISHED UPDATING WATCHED MOVIE %s", msg.Movie.Title)

	msg.Movie.All_Watched = all_watched
	msg.Movie.Count_Watched = count_watched
	msg.Movie.Modified = now

	msg.Reply <- msg.Movie
}
开发者ID:sh4t,项目名称:mediabase,代码行数:43,代码来源:dal.go


示例20: doStoreMovie

func (self *Dal) doStoreMovie(movie *message.Movie) {
	self.count = 0

	mlog.Info("STARTED SAVING %s [%d]", movie.Title)

	tx, err := self.db.Begin()
	if err != nil {
		mlog.Fatalf("at begin: %s", err)
	}

	// stmt, err := tx.Prepare("insert into movie(title, original_title, file_title, year, runtime, tmdb_id, imdb_id, overview, tagline, resolution, filetype, location, cover, backdrop, genres, director, vote_average, vote_count, countries, added, modified, last_watched, all_watched, count_watched) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")

	stmt, err := tx.Prepare("insert into movie(title, original_title, file_title, year, runtime, tmdb_id, imdb_id, overview, tagline, resolution, filetype, location, cover, backdrop, genres, vote_average, vote_count, countries, added, modified, last_watched, all_watched, count_watched, score, director, writer, actors, awards, imdb_rating, imdb_votes) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
	if err != nil {
		tx.Rollback()
		mlog.Fatalf("at prepare: %s", err)
	}
	defer stmt.Close()

	_, err = stmt.Exec(movie.Title, movie.Original_Title, movie.File_Title, movie.Year, movie.Runtime, movie.Tmdb_Id, movie.Imdb_Id, movie.Overview, movie.Tagline, movie.Resolution, movie.FileType, movie.Location, movie.Cover, movie.Backdrop,
		movie.Genres, movie.Vote_Average, movie.Vote_Count, movie.Production_Countries, movie.Added, movie.Modified, movie.Last_Watched, movie.All_Watched, movie.Count_Watched, movie.Score, movie.Director, movie.Writer, movie.Actors, movie.Awards,
		movie.Imdb_Rating, movie.Imdb_Votes)
	if err != nil {
		tx.Rollback()
		mlog.Fatalf("at exec: %s", err)
	}

	// mlog.Info("Movie is %v", movie)

	// _, self.err = self.storeMovie.Exec(movie.Title, movie.Year, movie.Resolution, movie.FileType, movie.Location)
	// if self.err != nil {
	// 	mlog.Fatalf("at storemovie: %s", self.err)
	// }

	tx.Commit()
	mlog.Info("FINISHED SAVING %s", movie.Title)

	// _, self.err = self.storeMovie.Exec(movie.Name, movie.Year, movie.Resolution, movie.Type, movie.Path, movie.Picture)
	// if self.err != nil {
	// 	mlog.Fatalf(self.err)
	// }
}
开发者ID:sh4t,项目名称:mediabase,代码行数:42,代码来源:dal.go



注:本文中的github.com/apertoire/mlog.Info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang thrift.NewTProtocolExceptionReadField函数代码示例发布时间:2022-05-24
下一篇:
Golang testtool.TestExpectSuccess函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap