movielite

package module
v0.0.0-...-3e4b57a Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 32 Imported by: 0

README

movielite

movielite is a simple personal movie database, written in golang and VUE.js.

You can specify local directories watched for new movies. If new movies found metadata and images added form TMDB. TMDB.

Features

  • List your movies with metadata
  • Search movies by title, description and persons
  • Play movies with you local player
  • View detail movie info
  • Automatically add new movies and add the metadata
  • Uses sqlite no db server required
  • Wachtlist
  • Download movies
  • Move movies to desired directory

Getting Started (Demo)

  • Clone the Repository
  • Run in this directory: docker-compose up
  • Goto http://localhost:8000/movie2/
  • Login with admin/password You will see some example data without media files.

Installation

    # install npm packages
    make npminstall
    # build single binary
    make

You find the binary "movelite" in the directory root

The main configuration file is movielite.yaml, but it is not included by default. Simply make a copy of movielite.yaml.tmpl and rename it to movielite.yaml. See example_movielite.yaml for more information about configurations.

# devel, prod
Mode: prod
# Port to run
Port: 8000
# Enable sql debugging
SQLDebug: false
# Language to get Metadata
Language: "en-US"
# Location of the sqlite database
Database:
  Dbname: "./movielite.db"
# Secret to sign token
Secret: "dsdhsjhsdhr8q73z478274z3qhui4"
# Initial Admin password, can be changed later
InitialAdminPassword: "password"
# Player to play movies default is vlc (optional)
# Player: "QuickTime Player"


TMDB:
  # Your API key. Without API key you can't get metadata from tmdb
  ApiKey: #add your api key
  # Directory for the image cache.
  ImageDir: ./images

# Base directory of your movie lib.
TargetDirectory: ./movies

# URL of this server
MovieServerUrl: http://localhost:8000

# Use system trash instead of delete
TrashCan: true

#Watch here for new movies
WatchDir: "./movies/new"

# Additional regex's to find movie name in filename
# Key is only for debugging. Build in can be found in
# models/files.go
FilterRegEx:
  OTR: ^(.+?)_\d{2}\.\d{2}\.\d{2}_\d{2}-\d{2}_
  MT: ^.+?-(.+?)-\d+-\d+
  MT_Zdf: ^.+?-(.+?)_-
  MT_ZDF_SEASON: ^.+?-(.+?)_\((\d+)\)-\d+_\w+_\d+

# enable webdav (admin/test123)
WebDav: true
Start server
./movielite start

Now browse to the app at http://localhost:8000/movie2 . Login with admin/password

If you use the default config a watcher is set on the directory ./example/movies. To add a new movie copy the movie in the watched folder.

Add your library

The server must be running. To add you existing movies to movielite type

movielite scan -d [directory to scan]

Documentation

Index

Constants

View Source
const (
	DEFLANG   = "de-DE"
	WATCHLIST = "watchlist"
)

Variables

View Source
var (
	InvalidCredentials = fmt.Errorf("invalid login credentials. Please try again")
	NoSecretFound      = fmt.Errorf("no secret found")
)
View Source
var (
	// GetDoFunc fetches the mock client's `Do` func
	GetDoFunc func(req *http.Request) (*http.Response, error)
)

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware for gin

func URLEncoded

func URLEncoded(str string) (string, error)

Types

type Config

type Config struct {
	Port                 int
	Mode                 string
	TMDBImageDir         string
	TMDBImageURL         string
	TMDBApiKey           string
	TargetDir            string
	SQLDebug             bool
	DataBase             string
	WebDav               bool
	Watchdirectory       string
	ScanDirectories      []string
	ServerURL            string
	Player               string
	UseAuthentication    bool
	Secret               string
	InitialAdminPassword string
}

func GetConfig

func GetConfig(path string) *Config

type FileInput

type FileInput struct {
	FullPath string `json:"fullpath" binding:"required"`
	FileName string `json:"file" `
}

type Meta

type Meta struct {
	Total int64 `json:"total"`
}

type MockHttpClient

type MockHttpClient struct {
	DoFunc func(req *http.Request) (*http.Response, error)
}

func (*MockHttpClient) Do

func (m *MockHttpClient) Do(req *http.Request) (*http.Response, error)

type MockTMDBClient

type MockTMDBClient struct{}

func (*MockTMDBClient) GetMovieImages

func (m *MockTMDBClient) GetMovieImages(id int, opts map[string]string) (*tmdb.MovieImages, error)

func (*MockTMDBClient) GetMovieInfo

func (m *MockTMDBClient) GetMovieInfo(id int, opts map[string]string) (*tmdb.Movie, error)

func (*MockTMDBClient) SearchMovie

func (m *MockTMDBClient) SearchMovie(s string, opts map[string]string) (*tmdb.MovieSearchResults, error)

type Movielist

type Movielist struct {
	Data []models.Movie `json:"data"`
	Meta meta           `json:"meta"`
}

type Query

type Query struct {
	Orderby     string `form:"orderby"`
	Qtitel      string `form:"title"`
	Alpha       string `form:"alpha"`
	Genre       int64  `form:"genre"`
	Crew        int64  `form:"crew"`
	Person      int64  `form:"person"`
	Cast        int64  `form:"cast"`
	Country     string `form:"country"`
	LastScanned string `form:"last_scanned"`
	Limit       int64  `form:"limit,default=30"`
	Offset      int64  `form:"offset,default=0"`
	Show        string `form:"show"`
}

Query movie query parameter

type Service

type Service struct {
	Router     *gin.Engine
	DB         *gorm.DB
	Token      *models.Token
	Config     *Config
	WorkerPool *workerpool.WorkerPool
	TMDBClient models.TMDBClients
}

Service mal sehen

var S Service

func Setup

func Setup() Service

func (*Service) FindOne

func (s *Service) FindOne(username, password string) (token, error)

func (*Service) Initialize

func (a *Service) Initialize()

Initialize mal sehen

func (*Service) IsAdmin

func (s *Service) IsAdmin(c *gin.Context)

func (*Service) JwtVerify

func (s *Service) JwtVerify(c *gin.Context)

func (*Service) Run

func (a *Service) Run() error

Run mal sehen

func (*Service) WebDAV

func (s *Service) WebDAV(path string, router *gin.RouterGroup)

ANY /webdav/*

type Target

type Target struct {
	Name string `json:"name"`
}

type UpdateMovie

type UpdateMovie struct {
	ID      int64  `json:"id"`
	Title   string `json:"title" binding:"required"`
	OrgName string `json:"org_name"`

	//Multiplechoice MovieSearchResults `json:"multiplechoice"`
	//File           File
	IsTv        bool              `json:"is_tv"`
	Rating      int               `json:"rating"`
	Watchlist   bool              `json:"watchlist"`
	Meta        *models.TMDBMovie `json:"meta"`
	LastScanned time.Time
}

type UserInput

type UserInput struct {
	UserName string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type Walker

type Walker struct {
	Config *Config
	Token  string
}

func (*Walker) Run

func (w *Walker) Run(dir string) error

func (*Walker) RunWatcher

func (w *Walker) RunWatcher() error

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

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