metadata

package module
v0.0.0-...-574f5dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2014 License: LGPL-3.0 Imports: 9 Imported by: 1

README

Movie and TV Metadata Library Build Status

We have created a metadata library that helps us retrieve metadata information and artwork about media files. Metadata Flow

Here is a high level picture of how the library works: Metadata Library Architecture

And here is the godoc go-metadata documentation.

Install

go get github.com/amahi/go-metadata

Details

  • In our implementation of this library L, the origin server acts as a client to the library
  • The main entry point to L is method/function call with a media name(string) and Hint(string) such as "tv" or "movie" whose metadata we return in a structured way
  • Format of the metadata returned will be a json structure with details such as cast, director, and url of cover art images that are related to it.
  • The library keeps a transparent cache as part of the implementation
  • Whenever L gets a request from the client, it queries a local database (the cache) to find if the requested information is present in cache already
  • If it is present, L reads the data from cache and returns it
  • Otherwise S will request metadata from an online API, return the results as soon as possible and cache it
  • The cache should uses a LRU caching policy

Metadata Output

Lib,err := metadata.Init(1000000,"metadata.db")
if err == nil {
        data, err := Lib.GetMetadata("Breaking Bad","tv")
        if err == nil {
                fmt.Println(data)
        }
}

The above code will return a json string in the following format:-

{
   "title":"Breaking Bad",
   "artwork":"http://thetvdb.com/banners/posters/81189-22.jpg",
   "year":"2008"
}

Documentation

Overview

Golang library for requesting and caching Movies and TV metadata

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Library

type Library struct {
	// contains filtered or unexported fields
}

func Init

func Init(sz int, dbpath, tmdb_api, tvrage_api, tvdb_api string) (*Library, error)

Initiate the Libray with a valid database path and size. Size must not change on subsequent calls

func (*Library) GetMetadata

func (l *Library) GetMetadata(media_name string, Hint string) (json string, err error)

Get metadata for TV shows and movies from a given medianame (a filename, typically) and hint as to whether the media is "tv" or "movie". The hint can also be a space separated list of tags that contain keywords like "tv" and "movie". First match for tv or movies (for now) wins.

func (*Library) Prefill

func (l *Library) Prefill(root string, Hint string, sleeptime time.Duration, includeDir bool) error

prefill database cache using directory root, Hint, sleeptime after each read and a boolean denoting whether to prefill directory names

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL