Frontend Interface API
Aus Ultimate Media Collector (UMC) - Wiki
Introduction
This is the default UMC frontend interface. It contains all necessary methods to access for example all tables needed to retreive requested values/information by an RobG/PHP frontend. But there are some more function to explore. Just have a look at the Action Overview.
This interface can be called from the RobG or PHP context by using an http call
like this:
- http:localhost/UMC/db.php?action=GET_MOVIES_FOR_INDEX
- http:localhost/UMC/db.php?action=GET_MOVIE_DETAILS
- ...
How can I use this interface
To use this interface it is necessary to be able to send http requests and to retreive and parse a XML response. Obviously this is not possible with pure HTML or JavaScript(regarding the JavaScript implementation on the NMT!). So the only way to use it is to use either PHP or RobG based skins. The following capitels will show you some basic examples how the interface can be used.
In RobG based skins
ToDo
In PHP skins
Let's assume you are going to call the Action GET_ALL_RSS.
The XML result which you will get from the interface will be something like:
<result> <msg></msg> <sql></sql> <rss> <feed> <name>RSS1</name> <url>http://www.rss1.de</url> <active>1</active> </feed> <feed> <name>RSS2</name> <url>http://www.rss2.de</url> <active>0</active> </feed> ... </rss> </result>
- Now let's say you need to acces the name of the second RSS (RSS2) you will do
- To get the value from the message tag
//send a request to the UMC interface $contents = file_get_contents("http://[HOSTNAME or IP]/UMC/cgi/interface.cgi?ACTION=GET_ALL_RSS"); $rssName = ""; //read and store the XML respone $xml = simplexml_load_string($contents); if ($xml->status->rcode == 0) { //read the value from the name tag $rssName= (string) $xml->result->rss->feed[1]->name; } //print the name echo $rssName;
$contents = file_get_contents("http://[HOSTNAME or IP]/UMC/cgi/interface.cgi?ACTION=GET_ALL_RSS"); $msg = ""; $xml = simplexml_load_string($contents); if ($xml->status->rcode == 0) { $msg= (string) $xml->result->msg; } if(!empty($msg)) echo "Unexcpected error: ".$msg;
Error handling
every xml result will contain a tag <msg>. Verify that you alway check in the first step the content
of this tag. If an error occured this tag will contain the error message.
So check first if the function call returned an error message or not.
In case of an empty <msg> tag you can proceed to parse the xml result.
Version: 0.1
Author: DonGyros
Action Overview (for details have a look into each code section)
MOVIES
- GET_MOVIES_FOR_INDEX: will return all available movies from the database with the basic data assigned which is needed by an index view
- GET_UG_CHILDS: will return all childs for a given moviegroup (UG)
- GET_MOVIE_DETAILS: will return all detail information for a given movie
- GET_MOVIE_RUNTIME: will return the runtime for a given movie
- GET_QUICKFILTER_GENRE: will return all genre for the quickfilter
- GET_PERSON_DETAILS: will return details for a given person (actor)
MUSIC
- GET_MUSICALBUMS_FOR_INDEX: will return all available music albums from the database with the basic data assigned which is needed by an index view
- ...
PHOTOS
- GET_PHOTOS_FOR_INDEX: will return all available photos from the database with the basic data assigned which is needed by an index view
- ...
GENERAL
- GET_PARAM: will return a frontend param value
- SET_PARAM: will set a frontend param value
- GET_MAIN_LANGUAGE: will return the main language to be used for media information
- SET_MAIN_LANGUAGE: will set the main language to be used for media information
- GET_LANGUAGES: will return the available languages for media information(configured by the user in the plugin section of the GUI)
- GET_RANDOM_BACKGROUND: will return a random background image from one of the images in the folder pics/Backgrounds
- GET_ALL_RSS: will return all defined rss feeds
- GET_ACTIVE_RSS_FEED: will return the current active rss feed url
- ADD_RSS: adds a new rss feed to the database
- SET_ACTIVE_RSS: sets the rss feed with the given name active
Method overview
ACTION::GET_PARAMS
will return all param values from the frontend settings table
mandatory param 'action' -> GET_PARAMS
return the all parameters from the database
<result> <msg></msg> <sql></sql> <params> <param key='' value=''/> <param key='' value=''/> ..... </params> </result>
Author: DonGyros
ACTION::GET_PARAM
will return a param</i> value from the frontend settings table
mandatory param 'action' -> GET_PARAM
mandatory param 'key' -> the param key
return the requested param value
<result> <msg></msg> <sql></sql> <param key='' value=''/> </result>
Author: DonGyros
ACTION::SET_PARAM
will set a param value in the frontend settings table
mandatory param 'action' -> SET_PARAM
mandatory param 'key' -> the param key
mandatory param 'value' -> the param value
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::GET_MAIN_LANGUAGE
will return the main language to be used for the media information.
mandatory param 'action' -> GET_MAIN_LANGUAGE
return the main language to be used for media information
<result> <msg></msg> <sql></sql> <language id='75' value=''/> -> value: 71,72,73 or 74 </result>
Author: DonGyros
ACTION::SET_MAIN_LANGUAGE
will set the main language to be used for media information.
mandatory param 'action' -> SET_MAIN_LANGUAGE
mandatory param 'language' -> 71,72,73 or 74
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::GET_LANGUAGES
will return the languages which can be used for media information in the frontend.
This values will be defined by the user in the Java gui.
mandatory param 'action' -> GET_LANGUAGES
return languages to be used in the frontend
<result> <msg></msg> <sql></sql> <language id='71' value=''/> -> value: DE, EN, FR, ES, usw. <language id='72' value=''/> -> value: DE, EN, FR, ES, usw. <language id='73' value=''/> -> value: DE, EN, FR, ES, usw. <language id='74' value=''/> -> value: DE, EN, FR, ES, usw. </result>
Author: DonGyros
ACTION::GET_MOVIES_FOR_INDEX
will return all available movies from the database with the basic data assigned which is needed by an index view
mandatory param 'action' -> GET_MOVIES_FOR_INDEX
optional param 'language' -> a language id (for example DE, EN, ...)
optional param 'searchterm' -> movies matching the given value in the title or the plot will be returned
optional param 'sort' -> allowed values title, rating, ratingIMDB, year, addDate or originalTitle (default is title)
return all movies (FM,UG and MG) from the database
<result> <msg></msg> <sql></sql> <movie> <uuidMovieGroup></uuidMovieGroup> <uuidMovie></uuidMovie> <movieType></movieType> <pchPath></pchPath> <movieAddDate></movieAddDate> <playType></playType> <groupSequence></groupSequence> <movieOriginalTitle></movieOriginalTitle> <ratingIMDB></ratingIMDB> <locked></locked> <idLanguage></idLanguage> <movieName> <movieGenres> <moviePlot></moviePlot> <movieCountries></movieCountries> <movieTags></movieTags> <movieRating></movieRating> <groupSequence></groupSequence> </movie> <movie> ... </movie> ..... </result>
Author: DonGyros
ACTION::GET_MOVIES_FOR_INDEX
will return all available movies from the database with the basic data assigned which is needed by an index view
mandatory param 'action' -> GET_MOVIES_FOR_INDEX
optional param 'language' -> a language id (71,72,73 or 74 see action GET_LANGUAGES) -> if not given the currently selected language will be acquired from the database
optional param 'searchterm' -> movies matching the given value in the title or the plot will be returned
optional param 'date_start' -> movies where the add date is greater then this given date (for example 2010-01-28)
optional param 'date_end' -> movies where the add date is lower then this given date (for example 2010-01-28)
optional param 'watched' -> movies where the watched flag has the given status (true or false)
optional param 'locked' -> movies where the locked flag has the given status (true or false)
optional param 'sort' -> allowed values title, rating, ratingIMDB, year, addDate or originalTitle (default is title)
optional param 'round' -> rounds the rating to the given positions after decimal point (if not given 1 position after decimal point will be used)
return</li> all movies (FM,UG and MG) from the database
<result> <msg></msg> <sql></sql> <movie uuidgroup='' uuid='' title='[encoded]' plot='[encoded]' genres='[encoded]' rating='' type='' nmtpath='[encoded]' year='' playtype='' duration='' filmstudio='' mediaicons=''/>"; ..... </result>
Author: <i>DonGyros
ACTION::GET_UG_CHILDS
will return all childs for a given moviegroup (UG) sorted by the sequence position
mandatory param 'action' -> GET_UG_CHILDS
mandatory param 'groupid' -> for the given group UUID the children/mebers will be returned
optional param 'language' -> a language id (71,72,73 or 74 see action GET_LANGUAGES) -> if not given the currently selected language will be acquired from the database
optional param 'searchterm' -> children/members matching the given value in the title or the plot will be returned
optional param 'sort' -> allowed values title or sequence (default is sequence)
<result> <msg></msg> <sql></sql> <movie uuidgroup='' uuid='' title='[encoded]' genres='[encoded]' type='' nmtpath='[encoded]' year='' playtype='' />"; ... </result>
Author: DonGyros
ACTION::GET_MOVIE_DETAILS
will return all detail information for a given movie
mandatory param 'action' -> GET_MOVIE_DETAILS
mandatory param 'movieid' the uuid of a movie
optional param 'language' -> a language id (71,72,73 or 74 see action GET_LANGUAGES) -> if not given the currently selected language will be acquired from the database
optional param 'round' -> rounds the rating to the given positions after decimal point (if not given 1 position after decimal point will be used)
return<i>
<result> <msg></msg> <sql></sql> <add_date></add_date> <locked></locked> <name></name> <original_title></original_title> <plot></plot> <year></year> <genres></genres> -> komma-separiert <genres></genres> <tags></tags> <countries></countries> <duration></duration> <duration_formatted></duration_formatted> <rating_imdb></rating_imdb> <rating></rating> <filesize_real></filesize_real> <filesize_formatted></filesize_formatted> <video_codec></video_codec> <width></width> <height></height> <video_bitrate></video_bitrate> <framerate></framerate> <group_sequence></group_sequence> <directors> <all></all> -> alle komma separiert <name></name> <name></name> </directors> <actors> <all></all> <actor> <name></name> <role><role> </actor> ..... </actors> <filmtudio></filmtudio> </result>
Author: <i>DonGyros
ACTION::GET_QUICKFILTER_GENRE
will return all used genre for the quickfilter.
mandatory param<i> 'action' -> GET_QUICKFILTER_GENRE
<i>optional param<i> 'language' -> a language id (for example DE, EN, ...)
<i>return<i>
<result> <msg></msg> <sql></sql> <genre> <name></name> <id></id> </genre> .... </result>
Author: <i>DonGyros
ACTION::GET_QUICKFILTER_YEAR
will return all used years for the quickfilter.
mandatory param 'action' -> GET_QUICKFILTER_YEAR
return
<result> <msg></msg> <sql></sql> <year value='1980'/> <year value='1982'/> .... </result>
Author: DonGyros
ACTION::GET_QUICKFILTER_RATING
will return all used ratings for the quickfilter.
mandatory param 'action' -> GET_QUICKFILTER_RATING
optional param 'round' -> rounds the rating to the given positions after decimal point (if not given 1 position after decimal point will be used)
return<i>
<result> <msg></msg> <sql></sql> <rating value='5'> <rating value='7'> .... </result>
Author: <i>DonGyros
ACTION::GET_QUICKFILTER_ADDDATE
will return all dates where movies were inserted into the db (for the quickfilter).
mandatory param 'action' -> GET_QUICKFILTER_ADDDATE
return
<result> <msg></msg> <sql></sql> <date value='5'> <date value='7'> .... </result>
Author: DonGyros
ACTION::GET_MUSICALBUMS_FOR_INDEX
will return all available music albums from the database with the basic data assigned which is needed by an index view
mandatory param 'action' -> GET_MUSICALBUMS_FOR_INDEX
optional param 'searchterm' -> albums matching the given value in the title will be returned
return all music albums (MA) from the database
<result> <msg></msg> <sql></sql> <musicalbum> <uuid></uuid> <pchPath></pchPath> <title></title> <genres></genres> <cover></cover> <backdrop></backdrop> </musicalbum> <musicalbum> ... </musicalbum> ..... </result>
Author: DonGyros
ACTION::GET_MUSICTRACKS_FOR_ALBUM
will return all available music tracks (sorted by title) for the given album
mandatory param 'action' -> GET_MUSICTRACKS_FOR_ALBUM
mandatory param 'albumid/albumname' -> for the given album UUID/name the children/mebers will be returned
return all music tracks for given album (MT) from the database
<result> <msg></msg> <sql></sql> <uuidAlbum></uuidAlbum>; <album></album> <artist></artist> <year></year> <cover></cover> <backdrop></backdrop> <musictrack> <uuid></uuid> <title></title> <artist></artist> <codec></codec> <pchPath></pchPath> </musictrack> <musictrack> ... </musictrack> ..... </result>
Author: DonGyros
ACTION::GET_PHOTOS_FOR_INDEX
will return all available photos from the database with the basic data assigned which is needed by an index view
mandatory param 'action' -> GET_PHOTOS_FOR_INDEX
optional param 'searchterm' -> photos matching the given value in the title will be returned
optional param 'sort' -> allowed values title, rating or year (default is title)
return all photos from the database
<result> <msg></msg> <sql></sql> <photo> <uuid></uuid> <pchPath></pchPath> <title></title> </photo> <photo> ... </photo> ..... </result>
Author: DonGyros
ACTION::GET_PHOTOS_FOR_INDEX
TODO
ACTION::GET_RANDOM_BACKGROUND
will return a random background image from one of the images in the folder pics/Backgrounds
mandatory param 'action' -> GET_RANDOM_BACKGROUND
optional param 'dir' -> if given the random pic will be determined from this directory else from 'mainindexbackdrops'
return random background image (full path, for example 'pics/Backgrounds/image.jpg')
<result> <msg></msg> <sql></sql> <image></image> </result>
Author: DonGyros
ACTION::GET_ACTIVE_RSS_FEED
will return the current active rss feed.
Remember to call this function every time you need to update the rss feed.
mandatory param 'action' -> GET_ACTIVE_RSS_FEED
@return current active rss feed
<result> <msg></msg> <sql></sql> <rss></rss> </result>
Author: DonGyros
ACTION::GET_ALL_RSS
will return all defined rss feeds from the database
mandatory param 'action' -> GET_ALL_RSS
return all rss url's from the database
<result> <msg></msg> <sql></sql> <rss> <feed> <name></name> <url></url> <active></active> => 1 if active else 0 </feed> ... </rss> </result>
Author: DonGyros
</result>
ACTION::ADD_RSS
will add a new rss link to the database
mandatory param 'action' -> ADD_RSS
mandatory param 'name' -> The name of the rss feed
mandatory param 'url' -> The url of the rss feed
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::DELETE_RSS
will delete a given rss entry in the database
mandatory param 'action' -> DELETE_RSS
mandatory param 'name' -> The name of the rss feed
mandatory param 'url' -> The url of the rss feed
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::SET_ACTIVE_RSS
will activate a rss feed
mandatory param 'action' -> SET_ACTIVE_RSS
mandatory param 'name' -> The name of a rss feed from the database
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::IS_OBJECT_LOCKED
will get the lock status for a given object
<i>@mandatory param 'action' -> IS_OBJECT_LOCKED
@mandatory param 'uuid' -> The uuid of the object
<result> <msg></msg> <sql></sql> <locked></locked> -> true or false (will also be false if object has not been found) </result>
Author: DonGyros
ACTION::LOCK_OBJECT
will lock a selected object
mandatory param 'action' -> LOCK_OBJECT
mandatory param 'uuid' -> The uuid of the object to be locked
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::UNLOCK_OBJECT
will unlock a selected object
@mandatory param 'action' -> UNLOCK_OBJECT
@mandatory param 'uuid' -> The uuid of the object to be unlocked
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::IS_MOVIE_WATCHED
will get the watched status for a given movie
@mandatory param 'action' -> IS_MOVIE_WATCHED
@mandatory param 'uuid' -> The uuid of the movie
<result> <msg></msg> <sql></sql> <watched></watched> -> true or false (will also be false if movie has not been found) </result>
Author: DonGyros
ACTION::TAG_MOVIE_WATCHED
will tag a movie as watched
@mandatory param 'action' -> TAG_MOVIE_WATCHED
@mandatory param 'uuid' -> The uuid of the movie
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::TAG_MOVIE_UNWATCHED
will tag a movie as unwatched
@mandatory param 'action' -> TAG_MOVIE_UNWATCHED
@mandatory param 'uuid' -> The uuid of the movie
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::DELETE_MOVIE
will delete a movie from the database and the filesystem (currently only in the database) as well as existing nfo's, images,... on the filesystem
mandatory param 'action' -> DELETE_MOVIE
mandatory param 'uuid' -> The uuid of the movie to be deleted
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::IS_EPISODE_WATCHED
will get the watched status for a given episode
mandatory param 'action' -> IS_EPISODE_WATCHED
mandatory param 'uuid' -> The uuid of the movie
<result> <msg></msg> <sql></sql> <watched></watched> -> true or false (will also be false if episode has not been found) </result>
Author: DonGyros
ACTION::TAG_EPISODE_WATCHED
will tag a episode as watched
mandatory param 'action' -> TAG_EPISODE_WATCHED
mandatory param 'uuid' -> The uuid of the episode
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::TAG_EPISODE_UNWATCHED
will tag a episode as unwatched
mandatory param 'action' -> TAG_EPISODE_UNWATCHED
mandatory param 'uuid' -> The uuid of the episode
<result> <msg></msg> <sql></sql> </result>
Author: DonGyros
ACTION::GET_PERSON_DETAILS
gets the details for a given person
mandatory param 'action' -> GET_PERSON_DETAILS
mandatory param 'name' -> The name of the person
<result> <msg></msg> <sql></sql> <person> <name></name> <birthday></birthday> <place_of_birth></place_of_birth> <deathday></deathday> <place_of_death></place_of_death> <biography></biography> <image></image> </person> </result>
Author: DonGyros
ACTION::GET_LAST_MOVIES_SCANNED
will return the last scanned movies
mandatory param 'action' -> GET_LAST_MOVIES_SCANNED
mandatory param 'quantity' -> The amount of desired movies
optional param 'language' -> a language id (for example DE, EN, ...)
<result> <msg></msg> <sql></sql> <movies> <movie> <uuid></uuid> <cover></cover> <name></name> <nmt_path></nmt_path> </movie> .... </movies> </result>
Author: DonGyros
ACTION::GET_DIR_CONTENT
will return the last scanned movies
mandatory param 'action' -> GET_DIR_CONTENT
optional param 'dir' -> a starting directory (if not given the defined libs will act as starting directories)
<result> <msg></msg> <sql></sql> <file dir=[true/false] display=[display value] value=[if is dir use this value as dir param for this function] /> </result>
Author: DonGyros
ACTION::GET_DIRECTORY_LISTING
TODO
ACTION::GET_SERIES_FOR_INDEX
will return all available series from the database with the basic data assigned which is needed by an index view
mandatory param 'action' -> GET_SERIES_FOR_INDEX
optional param 'language' -> a language id (71,72,73 or 74 see action GET_LANGUAGES) -> if not given the currently selected language will be acquired from the database
optional param 'searchterm' -> movies matching the given value in the title or the plot will be returned
optional param 'sort' -> allowed values title, rating, ratingIMDB, year, addDate or originalTitle (default is title)
return all movies (FM,UG and MG) from the database
<result> <msg></msg> <sql></sql> <series uuidgroup='' uuid='' title='[encoded]' plot='[encoded]' genres='[encoded]' type='' nmtpath='[encoded]' year='' playtype=''/>"; ..... </result>
Author: DonGyros
ACTION::GET_SERIES_SEASONS
will return all available season numbers for a given series
mandatory param 'action' -> GET_SERIES_SEASONS
mandatory param 'seriesid' the uuid of a series
optional param 'language' -> a language id (71,72,73 or 74 see action GET_LANGUAGES) -> if not given the currently selected language will be acquired from the database
return
<result> <msg></msg> <sql></sql> <seasons> <season>1</season> <season>2</season> ..... <season>n</season> </seasons> </result>
Author: DonGyros
ACTION:: GET_SEASON_DETAILS
will return all detail information for a given season
mandatory param 'action' -> GET_SEASON_DETAILS
mandatory param 'seriesid' the uuid of a series
mandatory param 'seasonnr' the number of the season
optional param 'language' -> a language id (71,72,73 or 74 see action GET_LANGUAGES) -> if not given the currently selected language will be acquired from the database
optional param 'round' -> rounds the rating to the given positions after decimal point (if not given 1 position after decimal point will be used)
return
<result> <msg></msg> <sql></sql> <season></season> <episode> <nr></nr> <uuid></uuid> <add_date></add_date> <locked></locked> <watched></watched> <name></name> <original_title></original_title> <plot></plot> <year></year> <genres></genres> <nmtpath></nmtpath> <tags></tags> <countries></countries> <duration></duration> <duration_formatted></duration_formatted> <rating_imdb></rating_imdb> <rating></rating> <filesize_real></filesize_real> <filesize_formatted></filesize_formatted> <video_codec></video_codec> <width></width> <height></height> <video_bitrate></video_bitrate> <framerate></framerate> <group_sequence></group_sequence> <directors> <all></all> <name></name> <name></name> ..... </directors> <actors> <all></all> <actor> <name></name> <role></role> </actor> ....... </actors> </episode> ..... ... </result>
Author: DonGyros
ACTION::CHECK_NMT_PATHS
will check if all needed NMT paths are available
mandatory param 'action' -> CHECK_NMT_PATHS
return
<result> <msg></msg> <sql></sql> <auto_detect></auto_detect> -> true or false </result>
Author: DonGyros
ACTION::NMT_PATHFINDER_LOCATIONS
will return all locations for the nmt pathfinder
mandatory param 'action' -> NMT_PATHFINDER_LOCATIONS
return
<result> <msg></msg> <sql></sql> <location cmd='' value=''/> -> cmd='/opt/sybhttpd/localhost.drives/...', value='-searchvalue' <location cmd='' value=''/> <location cmd='' value=''/> ... .. </result>
Author: DonGyros
ACTION::NMT_PATHFINDER
will run the NMT path auto-detection
@mandatory param 'action' -> NMT_PATHFINDER
@return
<result> <msg></msg> <sql></sql> <lib found='true/false' nmt_path='' pc_path=''/> </result>
Author: HeHo/DonGyros
ACTION::NMT_PATHFINDER_CMD
will run the NMT path auto-detection
mandatory param 'action' -> NMT_PATHFINDER-CMD
mandatory param 'cmd' -> a unix find command
mandatory param 'value' -> a search value
return
<result> <msg></msg> <sql></sql> <lib found=/> -> value true or false </result>
Author: DonGyros
ACTION::SEARCH_WEATHER_ID
will search for a yahoo weather id with a given city name
mandatory param 'action' -> SEARCH_WEATHER_ID
mandatory param 'city' -> a name of a city to search for (please use english names!!!)
return
<result> <msg></msg> <weather_id></weatcher_id> </result>
Author: DonGyros
ACTION::MOUNT_SHARE
will mount a given share on the NMT
mandatory param 'action' -> MOUNT_SHARE
mandatory param 'share' -> the name of a networkshare
return
<result> <msg></msg> </result>
Author: DonGyros
ACTION::GET_NMT_IP
will return the IP of the NMT
mandatory param 'action' -> GET_NMT_IP
return the IP address of the NMT
<result> <msg></msg> <ip></ip> </result>
Author: DonGyros
