Difference between revisions of "WDLXTV MediaLibrary"

From WikiDLXTV
Jump to: navigation, search
Line 83: Line 83:
  
 
== Options ==
 
== Options ==
* -h or --help<br>Display commandline help.<br>
+
* '''-h''' or '''--help'''<br>Display commandline help.<br>
  
* -v or --verbose<br>Enable verbose mode.<br>
+
* '''-v''' or '''--verbose'''<br>Enable verbose mode.<br>
  
* -d or --debug<br>Enable debug mode. (lot's of output!)<br>
+
* '''-d''' or '''--debug'''<br>Enable debug mode. (lot's of output!)<br>
  
* -n or --no-vidinfo<br>Disable getting video info with ffmpeg.<br>
+
* '''-n''' or '''--no-vidinfo'''<br>Disable getting video info with ffmpeg.<br>
  
* -a or --auto [<num> | s]<br>Enable auto mode. If multiple results are found on TMDB search the script will not ask to select a title but will always auto answer with the given number or skip. Default: s (skip)
+
* '''-a''' or '''--auto [<num> | s]'''<br>Enable auto mode. If multiple results are found on TMDB search the script will not ask to select a title but will always auto answer with the given number or skip. Default: s (skip)
  
* -g or --use-tgmd<br>Searches for a .tgmd file and uses the info provided to feed the database.<br>
+
* '''-g''' or '''--use-tgmd'''<br>Searches for a .tgmd file and uses the info provided to feed the database.<br>
  
* -t or --use-tmdb<br>Searches for movie information using TMDB (themoviedb.org).
+
* '''-t''' or '''--use-tmdb'''<br>Searches for movie information using TMDB (themoviedb.org).
  
* -c or --use-cache<br>Enable TMDB file cache.<br>'''Caution! Right now the path is hardcoded in the script to ''/boot/.tmdb'' which will only work on ext3 versions! This will be changed in the next version.'''
+
* '''-c''' or '''--use-cache'''<br>Enable TMDB file cache.<br>'''Caution! Right now the path is hardcoded in the script to ''/boot/.tmdb'' which will only work on ext3 versions! This will be changed in the next version.'''
  
* -e or --use-dirname<br>Use the parent dirname instead of the filename to build the search name.<br>
+
* '''-e''' or '''--use-dirname'''<br>Use the parent dirname instead of the filename to build the search name.<br>
  
  

Revision as of 08:10, 5 October 2011

Preamble

This is still a work in progress and heavily beta!
If you intend to play around with this you should bring basic linux skills and be able to work on the shell.


Introduction

History

This project is something I was carrying around with me for quite some time now and never got to finish it.
It all started when I started playing around with sqlite and the media library that comes with the WD firmware. It always bothered me that it was only working with locally attached media and not with xmounted network shares. (yeah, there is the .addMounts hack, but that's not what I had in mind.) So I tried inserting my own entries into the database just to discover that DMAOSD periodically deletes them again. Also there are quite some problems when you try to use sqlite with a database file on a network share (locking issue) which drove me to implement WDLXTV-DB (which is in the firmware for quite some time now and can already be used by MediaMark for example).


wdlxtv-ml.app.bin

Here's the second step now and I've been working on it for quite some time.
This app.bin provides a script ('moviescan') which will import mediafiles into the database and offers the possibility to search TMDB (http://www.themoviedb.org/) for movie info (rating, cast, etc, ...) and put this info into the database as well. Optionally you can import this information from .tgmd files if available.


What is this good for?

You can use this database for many cool things, I included two small examples:

  • a very simple media browser
    This will only show the files in your library and allows you to toggle the MediaMark for the file and edit some file properties like title, year, imdb id, tmdb id.
  • a UMSP plugin
    This will enable you to browse your files sorted by different criteria: year, rating, latest additions, genre.

These are meant as examples and I hope you come up with some even more sophisticated additions.You will find some develpoment informations further down in this article.


Installation

  • get WDLXTV_DB up and running
  • download wdlxtv-ml.app.tgz, extract wdlxtv.app.bin and put it on a USB drive connected to WDTV
    wdlxtv.app.tgz
  • reboot


Usage

This app.bin provides a shell script moviescan which imports data into the sqlite database.


Help

Run the script without any arguments or -h to get a little help:

# moviescan 
  moviescan version 1.3.8 by recliq

  usage: moviescan [options] update <PATH> [<PATH> [<PATH>]] [<DEPTH>]
         moviescan [options] init
         moviescan [options] clean

  options:
	-d|--debug		enable debug output
	-s|--simul		do a dry-run without changing any data
	-g|--use-tgmd		use .tgmd files as info source
	-t|--use-tmdb		use TMDB as info source
	-n|--no-vidinfo		disable video info
	-c|--use-cache		enable tmdb file cache
	-a|--auto [<num>|s]	enable auto chooser, default: s (skip)
	-e|--use-dirname	use dirname instead of filename for search

I will explain the important options later on.


Init database

The first thing you have to do is to create the needed database structures and initialize the database:

moviescan init

This will drop any existing databases and data without asking you again!


Import files

Then you are ready to import some files, in this case i'll import from my xmounted TestShare

moviescan update /tmp/media/usb/TestShare

Options

  • -h or --help
    Display commandline help.
  • -v or --verbose
    Enable verbose mode.
  • -d or --debug
    Enable debug mode. (lot's of output!)
  • -n or --no-vidinfo
    Disable getting video info with ffmpeg.
  • -a or --auto [<num> | s]
    Enable auto mode. If multiple results are found on TMDB search the script will not ask to select a title but will always auto answer with the given number or skip. Default: s (skip)
  • -g or --use-tgmd
    Searches for a .tgmd file and uses the info provided to feed the database.
  • -t or --use-tmdb
    Searches for movie information using TMDB (themoviedb.org).
  • -c or --use-cache
    Enable TMDB file cache.
    Caution! Right now the path is hardcoded in the script to /boot/.tmdb which will only work on ext3 versions! This will be changed in the next version.
  • -e or --use-dirname
    Use the parent dirname instead of the filename to build the search name.


Development

SQLite table schemas

  • Table video
CREATE TABLE video(
    hash VARCHAR(16) primary key,
    title VARCHAR,
    file VARCHAR,
    path VARCHAR,
    size UNSIGNED INTEGER,
    mtime INTEGER,
    mtime_date VARCHAR(15),
    duration UNSIGNED INTEGER,
    bitrate VARCHAR(16),
    vcodec VARCHAR(32),
    height SMALLINT,
    width SMALLINT,
    fps FLOAT,
    type VARCHAR(20),
    year VARCHAR(4),
    imdb VARCHAR(32),
    acodec VARCHAR(32),
    channels VARCHAR(16),
    abitrate VARCHAR(16),
    tvdb VARCHAR(32),
    epid VARCHAR(32),
    tmdb UNSIGNED INTEGER
);
  • Table movies
CREATE TABLE movies (
    id INTEGER PRIMARY KEY,
    imdb VARCHAR(32),
    tmdb UNSIGNED INTEGER,
    title VARCHAR,
    originaltitle VARCHAR,
    tagline VARCHAR,
    plot VARCHAR,
    year UNSIGNED SMALLINT,
    runtime UNSIGNED SMALLINT,
    rating float,
    genre VARCHAR,
    actor VARCHAR,
    studio VARCHAR,
    coutry VARCHAR,
    releasedate VARCHAR(12),
    director VARCHAR,
    writers VARCHAR,
    certification VARCHAR(4),
    mpaa VARCHAR
);


Changelog

v1.3.8
- initial beta release


ToDo

  • add support for TV series (TVDB)
  • get MediaMark working
  • get Moviesheets working


Bugs and Diskussion

WDLXTV Forum

--Recliq 14:11, 5 October 2011 (UTC)