Llink:macros

From Lundman Wiki
Jump to: navigation, search

Macros

General Macros

 Macro name                                     : Example replacement
<!--LLINK_SERVER_NAME-->                  : "llink"
<!--LLINK_FILE_NAME-->                    : "file.avi"
<!--LLINK_FILE_URL-->                     : "/movies/part1/file.avi&s=5&from=0".  This should be used most of the time
<!--LLINK_FILE_SHORT_URL-->               : "/movies/part1/file.avi"
<!--LLINK_FILE_SIZE-->                    : "4123414" or "4.1MB" or "". See SIZE_TYPE in llink.conf
<!--LLINK_FILE_DATE-->                    : "Thu Dec 27 15:46:56 JST 2007" (man ctime)
<!--LLINK_FILE_TVID-->                    : "12"
<!--LLINK_FILE_EXT-->                     : "avi"
<!--LLINK_FILE_MIME-->                    : "video/x-matroska"  "video/avi" "audio/mpeg" requires mime.types file.
<!--LLINK_FILE_UPNP_TYPE-->               : "object.item.videoItem" UPnP type for item. From TYPES in llink.conf
<!--LLINK_PARENT_DIRECTORY-->             : "/movies"
<!--LLINK_CURRENT_DIRECTORY-->            : "/movies/part1"  
<!--LLINK_DETAIL_SIZE-->                  : "4123414"
<!--LLINK_PAGE_PREV_URL-->                : "/movies/part1&from=1"
<!--LLINK_PAGE_NEXT_URL-->                : "/movies/part1&from=10"  See PAGE_SIZE in llink.conf
<!--LLINK_PARENT_DIRECTORY_URL-->         : "/movies"
<!--LLINK_CURRENT_DIRECTORY_URL-->        : "/movies/part1"
<!--LLINK_ONKEYUP_PREV-->                 : "onkeyupset=\"prev\"" if this is the first entry listed.
<!--LLINK_ONKEYDOWN_NEXT-->               : "onkeydownset=\"next\"" if this is the last entry listed.
<!--LLINK_PAGE_FOCUS-->                   : "1" or "10" See PAGE_SIZE in llink.conf.
<!--LLINK_ZODIAC-->                       : "taurus", "pisces". As based on the Zodiac calendar.
<!--LLINK_CURRENT_PLAYALL-->              : "/movies/&playall=1". Play all in this directory.
<!--LLINK_FILE_PLAYALL-->                 : "/movies/subdir/&playall=1" Play all in sub directory.
<!--LLINK_RAND-->                         : "rand5" Replace with random number, see RAND directive in conf.
<!--LLINK_FULL_URL-->                     : "http//192.168.1.1:8000/
<!--LLINK_CURRENT_VIEWALL-->              : "/movies&viewall=1"  (Usually used with JPGs)
<!--LLINK_VIEW_SONGLIST-->                : "http://192.168.1.1:8000/mp3s/&playall=1" (Usually used with viewall)
<!--LLINK_PAGE_HELPERS-->                 : HTML to add tvid for not-shown pages, should be used in tail.html.
<!--LLINK_TEXT_VISITED-->                 : Replace with "text" or "visited" if the media is considered new or old.
<!--LLINK_STATUS_MESSAGE-->               : "File deleted". Temporary messages generated by llink.
<!--LLINK_SORT_NEXT-->                    : "2". Used with s=2, to cycle sorting type up.
<!--LLINK_SORT_PREV-->                    : "0". Used with s=0, to cycle sorting type down.
<!--LLINK_DIRECTORY_TVID_START-->         : "1". Always 1, added for completeness.
<!--LLINK_DIRECTORY_TVID_END-->           : "265" Total number of media in current directory
<!--LLINK_DIRECTORY_PAGE_START-->         : "1". Always 1, added for completeness.
<!--LLINK_DIRECTORY_PAGE_END-->           : "6" Total number of pages.
<!--LLINK_DIRECTORY_TVID_CURRENT_START--> : "11" Current page tvid start
<!--LLINK_DIRECTORY_TVID_CURRENT_END-->   : "20" Current page tvid end 
<!--LLINK_DIRECTORY_TVID_CURRENT_COUNT--> : "9" Current page tvid count. (end - start) 
<!--LLINK_DIRECTORY_PAGE_CURRENT-->       : "2" Current page number.

Conditionals

<!--LLINK_IF_CLIENT_IS_SYABAS-->          : Only process BLOCK (until /LLINK_IF_CLIENT_IS_SYABAS end macro) if TRUE.
<!--/LLINK_IF_CLIENT_IS_SYABAS-->         : End Macro
<!--LLINK_IF_CLIENT_IS_NOT_SYABAS-->      : Only process BLOCK (until /LLINK_IF_CLIENT_IS_SYABAS end macro) if FALSE.
<!--/LLINK_IF_CLIENT_IS_NOT_SYABAS-->     : End Macro
<!--LLINK_IF_CLIENT_ELSE-->               : and/or clause to IF_CLIENT


Extended Information Macros

Extended directory entry listing. This works by looking for an XML file in the following order:

  1. "/movies/file.avi.xml"
  2. "/movies/directory/mymovies.xml"
  3. "/$redirect/file.avi.xml" (Redirect TYPES, see llink.conf)

So it can support both the style where each movie is in a sub-directory, and has a "mymovies.xml" compatible XML file, and the second style, where all movies live in a directory, with .xml files intermixed.

The following tags are currently parsed from the .XML file. These MACROs are only valid in the line_*.html files. Since they are only valid for one file entry.

<!--LLINK_EXTNFO_ICON-->            : "/movies/file.png"
<!--LLINK_EXTNFO_TITLE-->           : "The Ultimate Movie"
<!--LLINK_EXTNFO_LOCAL_TITLE-->     : "Ze Ultimate Film"
<!--LLINK_EXTNFO_COUNTRY-->         : "United States"
<!--LLINK_EXTNFO_LENGTH-->          : "93"
<!--LLINK_EXTNFO_TAGLINE-->         : "This is a recent movie!"
<!--LLINK_EXTNFO_DESCRIPTION-->     : "Once upon a time..."
<!--LLINK_EXTNFO_GENRES-->          : "Action Boredom Thriller"
<!--LLINK_EXTNFO_DATE-->            : "12 Jun 2007"
<!--LLINK_EXTNFO_DIRECTORS-->       : "Peter Jackson (Director)"
<!--LLINK_EXTNFO_CAST-->            : "Peter Jackson, James T. Barnham, Steward Griffin"
<!--LLINK_EXTNFO_RATING-->          : "9.5/10"
<!--LLINK_EXTNFO_IMDBURL-->         : "http://www.imdb.com/title/tt0116344/"


CGI commads

Currently, you can encode commands on the CGI url to perform various actions:

Command        : Example           : Explanation
&from=<int>    : "&from=40"        : Show page starting from item <int>. Should be multiples of page_size.
&to=<int>      : "&to=50"          : Page end. Usually set automatically to "page_size + from".
&d=<dir>       : "&d=/movies"      : Used with RAR support to specify a directory inside RAR file.
&f=<int>,<file>: "&f=123,file.avi" : Used with RAR support to specify a file inside RAR file. 
                                   : Full path will be "file.rar&d=/movies&f=1234,file.avi"
&dv=<dir>      : "&dv=/VIDEO_TS"   : Used with ISO support to specify a directory inside ISO file.
&fv=<int>,<fle>: "&fv=123,VTS1.VOB": Used with ISO support to specify a file inside ISO file. 
                                   : Full path will be "file.iso&d=/&f=1234,VTS_01_1.VOB"
&code=<int>    : "&code=1234"      : Enter PIN number to use to enable additional functionality.
&menu          : "&menu"           : Show menu for item.
&quit          : "&quit"           : Shutdown llink and exit. Alas, will appear ungraceful to NMT.
&proxy=<url>   : "&proxy=http://myvideo.com/streamfile.avi"
                                   : Proxy the data from external URL as own. Address should be URL encoded.
&focus=<int>   : "&focus=12"       : Set highlight focus on tvid=12. Default is top tvid of the page.
&playall       : "&playall"        : Build a playlist for all media in current path
&viewall       : "&viewall"        : Build a playlist to view all media in current path
&h=<int>,<int> : "&h=10,20,10,0"   : History, so going up will show correct page.
&unrar=<str>   : "&unrar=/d/f.rar" : Unrar f.rar into /d
&<str>=<str>   : "&exe=/d/f.avi"   : User SCRIPT "exe" with $1 as "/d/f.avi".
&< s>=<int>    : "&s=2"            : Use SORT style #2, in order as listed in conf file.
&<type>=<str>  : "&type=Music"     : Modify playall to only include media fitting TYPE|name=Music entry in conf.
&<pin>=<str>   : "&pin=1234"       : Attempt to register PIN for this IP. Show hidden media if matches PIN in conf
&upnp=<str>    : "&upnp            : Used with UPnP commands, as specified in llink.xml. You shouldn't mess with it

PASSES

Normally, we do the directory processing in one pass, and it would send the HTML files in the following order:

head.html
line_dir.html           -\
line_movie.html         ------ Based on the TYPE map in llink.conf, and if dir entry is a dir, or .avi etc
...
tail.html

If you define higher PASSES value, in this case 2, it will send (if the files exist):

-------------- Pass 1 --------------
head.html
line_dir.html
line_movie.html  -\
line_dir.html    ---- Each one sent based on filename (*.avi, *.mp3 etc) 
line_music.html  -/
separator.html   - Sent if you wish to have separate support, every nth media found. See conf.
tail.html
-------------- Pass 2 --------------
2head.html
2line_movie.html -\
2line_dir.html   ---- Each one sent based on filename (*.avi, *.mp3 etc) 
2line_music.html -/
2separator.html  - Sent if you wish to have separate support, every nth media found. See conf.
2tail.html

And so on for even higher PASSES values. The entries found are cached internally to llink, so it does only one actual directory listing.