本文整理汇总了Golang中github.com/apertoire/mlog.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Start
func (self *Pruner) Start() {
mlog.Info("starting Pruner service ...")
go self.react()
mlog.Info("Pruner service started")
}
示例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")
}
示例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")
}
示例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")
}
示例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
}()
}
示例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
}
示例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)
}()
}
示例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))
}
示例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
}
示例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()
}
示例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))
}
示例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")
}
示例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)
}
示例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}
}
示例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)
}