Tempest WIKI
Tempest WIKI
Tempest WIKI
1) Introduction
2) Siteconfig Maker & Elements
3) Tempest Variables & Operators
4) Tempest Commands & Syntax
5) Siteconfig Debugger
6) EPG Generator
7) Channel Generator
8) Siteconfig Editor
9) Tempest Configurator & Settings
10) Siteconfig Updater
11) Hints & Tips
1) Introduction
Tempest is a fully programmable XMLTV formatted EPG(Electronic
Program Guide) generator bundled in a single php file with several
advanced features such as;
a) Config Info
b) Site Options
Timezone: Timezone of source to set time offset and make
necessary date/time calculations etc. It can be in ±XX:XX format
such as “+03:00” or with referenced patterns such as
“Europe/Istanbul”. To enable DST(Daylight Saving Time) option,
referenced name pattern shall be set. It will be considered as
“+00:00” if no value is given. It supports;
##usertime## (**Special Variable**)
If timezone parameter is set as “##usertime##” , time offset of
user will be applied. This means same siteconfig file will give
different time offsets for a user in Europe and a user in America as
an example. This is very useful for some websites which converts
their data based on geolocation of visitor’s IP address.
Culture Info: 2 letters culture code of source language. This is
necessary for correct text formatting such as converting upper
cases to lower cases etc. It will be considered as “xx” if no value is
given.
Charset Info: Encoding type of source such as UTF-8 or
WINDOWS-1252 etc. This is necessary for correct text scrapping. It
will be considered as “UTF-8” if no value is given.
Maximum Days: Maximum number of days that source contains.
It can be in 2 different types as “X” or “X.1” which “X” means each
day in separate page/request and “X.1” means all days in single
page/request such as “7” (for 7 days) and “7.1” (for 7 days in same
page).
Rating System: Name of rating system that source uses. As
example “TVPG” or “PEGI” etc.
Star Rating System: Name of star rating system that source uses.
As example “IMDB” or “TMDB” etc.
Episode System: Name of episode system that source uses. 2
possible options are available as “on-screen” and “xmltv_ns”.
Custom Episode System 1: Name of first custom episode system.
It can be anything or a user-defined special system.
Custom Episode System 2: Name of second custom episode
system. It can be anything or a user-defined special system.
First Show No: Number of first show which belongs today in
source. This is necessary to skip shows at the beginning of source
from previous day if no show date is available.
First Day No: Number of show blocks which associated with week
days in source . This is mandatory for “Maximum days 7.1” sites
to capture correct day block from source. “0” always represents
“Monday” and “6” always represents “Sunday”. If first show block
belongs to Monday and continues up to Sunday, day order shall be
“0123456”. If first show block belongs to Sunday and continues as
Monday, Tuesday etc till Saturday; day order shall be “6012345”. It
supports also shuffled block orders such as “0421635”.
Enable Keep Index Page: Indicator for Tempest to store source
data to use for other channels. This is necessary to avoid repeated
source request when source also contains data for other channels.
Enable Past Day Remover: Indicator for Tempest to auto-delete
shows belongs to previous day(s) in source. This is necessary to
delete useless data from fixed source such as monthly updating
websites which always starts with first day of month.
Compression System: Name of compression system that source
uses. 2 possible options are available as “gzip” and “deflate”. Do
not mix it with “Accept-Encoding” header which auto
decompression is already done by your browser/server. Setting it
on a decompressed content, will result malformed byte sequences
due to twice decompression. Basically do not use it if your source is
in a human-readable format.
User-Agent: String of user-agent that will be used during your
web requests to emulate a web browser. Tempest will try to use
your server’s user-agent string if no value is given. If it is not set in
your server, Tempest will use its own predefined user-agent string.
Enable Proxy: Indicator/Check Point for Tempest to connect a
proxy address for web requests of applied siteconfig.
Proxy Adress: IP address/port of proxy that will be used by
Tempest for tunnelling web requests of applied siteconfig. It
supports http, https, socks4 and socks5 proxy types. String shall be
as below examples formats;
Example:
Proxy => “https://ipadress:port”
or (with username & password)
Proxy => “socks5://username:password@ipadress:port”
Channel Delay Time: Number of delay as second between
different channel requests of applied siteconfig.
Index Page Delay Time: Number of delay as second between a
channel’s index page requests.
Detail Page Delay Time: Number of delay as second between a
channel’s detail page requests.
c) Page Options
Note: “All (A)” defines that information is valid for all “Index (I)”, “Detail (D)”
and “Channel Creation (C)” sections.
d) Show Options
Note: All regex patterns have been pre-delimited with “/”(slash) and shall be
escaped by “\”(backslash) together with other regex tokens.
Tempest has several predefined xmltv element in accordance with
XMLTV Standard and all may be set from “Show Options” tab as
below;
Show Pattern (I): This is the regex pattern which tells Tempest
how epg information containing part will be separated from
unnecessary data and parsed as individual small blocks that each
contains single show. Since regex is not the best tool for parsing
irregular sources such as html, Tempest has a special pattern
format which will be automatically recognized and will apply 2
layers of parsing to make it significantly easy, as below;
MBS.*?(?:SBS)(.*?)(?:SBE).*?MBE (**Special Pattern**)
MBS => Main-Block Start
MBE => Main-Block End
SBS => Sub-Block Start
SBE => Sub-Block End
It shall be considered as each sub-block shall contain 1 single show
and main blocks may be single or multiple based on page structure.
Special pattern is mandatory to use with “First Day No” required
sites for “Maximum days 7.1” to parse data based on correct day
block. Otherwise, most probably results will not match with correct
dates. For these kind of sites, 7 main blocks (1 for each day) need
to captured and Tempest will parse them based on given “First
Day No” order. Special pattern is not mandatory for other type
websites but it is highly recommended to use whenever possible
since it is safer for new users and it will make Tempest to parse
faster with lower memory consumption.
Example:
<div role="tab-\d.*?>.*?(?:<p>)(.*?)(?:<\/p>).*?<\/div>
Tempest will auto convert unicode characters, clean show blocks,
fix malformed bytes and perform json decoding after parsing.
Note: Tempest will auto clean trailing spaces, line breaks, html tags etc. for all
captured data of xmltv elements.
Sort Pattern (I): This is the regex pattern which tells Tempest to
search for a sorting value inside of sub-blocks. This is necessary if
your data blocks are provided without date order or mixed order.
Sort Flag (I): This is the indicator for Tempest which tells how
sorting operation will be done. Available options are “regular”,
“numeric”, “string”, “natural”, “locale”, “case-string” and
“case-natural”.
Sort Order (I): This is the indicator for Tempest which tells order
of sorting. Available options are “ascending” and “descending”.
Start Pattern (I/D): This is the regex pattern for capturing start
time value of each show.
Start Format Pattern (I/D): This is the string which tells
Tempest format of captured start time. It shall be like in referenced
date formats on “Urldate Formats”.
Example:
Captured Start Time => ”2022-01-29 02:30:00”
Required Start Format => “Y-m-d H:i:s”
Stop Pattern (I/D): This is the regex pattern for capturing stop
time value of each show. If not set, next show’s start time will be
set as stop time of current show.
Stop Format Pattern (I/D): This is the string which tells Tempest
format of captured stop time. It shall be like in referenced date
formats on “Urldate Formats”.
Duration Pattern (I/D): This is the regex pattern for capturing
duration value of each show. If “Stop Pattern” is not set or could
not capture any data, Tempest may use duration value by adding
up to start time. When used, format of data shall be defined with
“||#format#X” Tempest command.
||#format#X (**Tempest Command**)
Note: Highlighted “X” shall be one of the below values;
“ms” => “microsecond”
“s” => “second”
“m” => “minute” (by default)
“h” => “hour”
“t” => “time pattern such as 01:30 as hour:minute”
Title Pattern (I/D): This is the regex pattern for capturing title
value of each show.
Original Title Pattern (I/D): This is the regex pattern for
capturing original title value of each show. When used, language
code shall be defined with “||#culture#xx” special command.
||#culture#xx (**Special Command**)
Note: Highlighted “xx” shall be 2 letters culture code of data
If not set, “xx” value will be used as culture code of original title
element.
Sub-title Pattern (I/D): This is the regex pattern for capturing
sub-title value of each show.
Description Pattern (I/D): This is the regex pattern for capturing
description value of each show.
Category Pattern (I/D): This is the regex pattern for capturing
category value of each show.
Language Pattern (I/D): This is the regex pattern for capturing
language value of each show.
Original Language Pattern (I/D): This is the regex pattern for
capturing original language value of each show.
Showicon Pattern (I/D): This is the regex pattern for capturing
showicon value of each show.
Season Pattern (I/D): This is the regex pattern for capturing
season value of each show.
Episode Pattern (I/D): This is the regex pattern for capturing
episode value of each show.
When “Episode System” is set for “on-screen”, season and
episode prefix which is “S” and “E” by default, may be set by user
with “||#name#X” Tempest command.
||#name#X (**Tempest Command**)
Note: Highlighted “X” shall be user defined string as
season/episode prefix
Example:
Default Season No => ”S3”
With “||#name#Temporada “ => “Temporada 3”
Default Episode No => ”E14”
With “||#name#Episodio “ => “Episodio 14”
Default Season/Episode => ”S3 E14”
With “||#name#X” => “Temporada 3 Episodio 14”
Total Episode Pattern (I/D): This is the regex pattern for
capturing total episode value of each show.
Custom Episode 1 Pattern (I/D): This is the regex pattern for
capturing first custom(user-defined) season/episode value of each
show. Corresponding “Custom Episode System” shall be defined.
Custom Episode 2 Pattern (I/D): This is the regex pattern for
capturing second custom(user-defined) season/episode value of
each show. Corresponding “Custom Episode System” shall be
defined.
Channel Logo (I/D): This is the regex pattern for capturing
channel logo value of each channel. Different from other elements,
“channel logo” element is in global mode which will search in
unparsed source data instead of main or show blocks.
Production Date Pattern (I/D): This is the regex pattern for
capturing production date value of each show.
Actor Pattern (I/D): This is the regex pattern for capturing actor
value(s) of each show.
Role Pattern (I/D): This is the regex pattern for capturing role
value of each actor. This will not work if no actor value is captured
or unequal number of actor-role values captured. Values will be set
to attribute of actor tag as per XMLTV standard
Director Pattern (I/D): This is the regex pattern for capturing
director value(s) of each show.
Presenter Pattern (I/D): This is the regex pattern for capturing
presenter value(s) of each show.
Producer Pattern (I/D): This is the regex pattern for capturing
producer value(s) of each show.
Composer Pattern (I/D): This is the regex pattern for capturing
composer value(s) of each show.
Editor Pattern (I/D): This is the regex pattern for capturing
editor value(s) of each show.
Commentator Pattern (I/D): This is the regex pattern for
capturing commantator value(s) of each show.
Writer Pattern (I/D): This is the regex pattern for capturing
writer value(s) of each show.
Adapter Pattern (I/D): This is the regex pattern for capturing
adapter value(s) of each show.
Guest Pattern (I/D): This is the regex pattern for capturing guest
value(s) of each show.
Country Pattern (I/D): This is the regex pattern for capturing
country value(s) of each show.
Image Pattern (I/D): This is the regex pattern for capturing
image value(s) of each show.
Video Colour Pattern (I/D): This is the regex pattern for
capturing video colour value of each show.
Video Aspect Pattern (I/D): This is the regex pattern for
capturing video aspect value of each show.
Video Quality Pattern (I/D): This is the regex pattern for
capturing video quality value of each show.
Premiere Pattern (I/D): This is the regex pattern for capturing
premiere value of each show. It may be as text description or self-
closing tag format. If final value is “true” or “yes”, Tempest will
convert it to self-closing tag.
Audio Pattern (I/D): This is the regex pattern for capturing audio
value of each show.
Length Pattern (I/D): This is the regex pattern for capturing
length value of each show. When used, unit of data shall be defined
with “||#unit#X” Tempest command.
||#unit#X (**Tempest Command**)
Note: Highlighted “X” shall be “s” (second), “m” (minute by
default) or “h” (hour)
Previously-Shown Pattern (I/D): This is the regex pattern for
capturing previously shown value of each show. Value may be
shown as attribute of tag if it is in date format without separators
or Tempest will convert it to self-closing tag.
Keyword Pattern (I/D): This is the regex pattern for capturing
keyword value of each show.
Subtitles Pattern (I/D): This is the regex pattern for capturing
subtitle value of each show. When used, type of data shall be
defined with “||#type#X” Tempest command.
||#type#X (**Tempest Command**)
Note: Highlighted “X” shall be “t” (teletext by default), “o”
(onscreen) or “d” (deaf-signed)
Rating Pattern (I/D): This is the regex pattern for capturing
rating value of each show.
Rating Icon Pattern (I/D): This is the regex pattern for
capturing rating icon value(s) of each show.
Star Rating Pattern (I/D): This is the regex pattern for capturing
star rating value of each show. When used, max rating limit shall
be defined to the end of value as “/X” such as “6.2/10” etc.
Star Rating Icon Pattern (I/D): This is the regex pattern for
capturing star rating icon value(s) of each show.
New Pattern (I/D): This is the regex pattern for capturing new
value of each show. It is self closing tag without any attribute.
Tempest will generate new tag if anything captured with given
pattern.
Last Chance Pattern (I/D): This is the regex pattern for
capturing last chance value of each show. It may be as text
description or self-closing tag format. If final value is “true” or
“yes”, Tempest will convert it to self-closing tag.
Review Pattern (I/D): This is the regex pattern for capturing
review value of each show.
g) Channel Options
Note: All regex patterns have been pre-delimited with “/”(slash) and shall be
escaped by “\”(backslash) together with other regex tokens.
Channel Block Pattern (C): This is the regex pattern which tells
Tempest how channel information containing part will be separated
from unnecessary data and parsed as individual small blocks that
each contains single channel data(id, name, logo etc.). “Channel
Block” is an optional solution to make channel data parsing easier
with higher accuracy. “Channel Block” pattern may be ordinary
regex or special pattern which will be automatically recognized and
will apply 2 layers of parsing to make it significantly easy, as
below;
MBS.*?(?:SBS)(.*?)(?:SBE).*?MBE (**Special Pattern**)
MBS => Main-Block Start
MBE => Main-Block End
SBS => Sub-Block Start
SBE => Sub-Block End
When used, “Channel Id”, “Channel Name” & “Channel Logo”
patterns will search inside captured sub-blocks instead of source
data. “Channel Block” will search in loose capture mode when
ordinary regex string is set. This means no need to completely
parse small channel blocks with very accurate capture string but
you can just mention Tempest that how channel blocks should be
look like and it will parse it accordingly.
Channel Id Pattern (C): This is the regex pattern for capturing id
value of each channel. If “Channel Block” is not set, “Channel Id”
result will be used as reference by Tempest for alignment of other
channel datas. Its value will be transferred in to “##channel##“
special variable;
##channel## (**Special Variable**)
Beside regex pattern, numerical values may be calculated with
“#counter#X#Y#Z” operator as below;
#counter#X(#Y)#Z (**Special Operator** / (#Y) Optional)
Example:
Channel Id => ”#counter#1#2#5”
X => Start Indice
Y => Step Interval (Optional)
Z => Destination
Results => Channel Id1 => 1
Channel Id2 => 3
Channel Id3 => 5
if “Channel Block” set and not empty, both Y(Step Invertal) and
Z(Destination) may be optional and Tempest increase with 1 or with
given interval till it reaches total number of channel blocks as below;
Count of Channel Blocks Captured => 4
Channel Id => ”#counter#1”
Results => Channel Id1 => 1
Channel Id2 => 2
Channel Id3 => 3
Channel Id4 => 4
Channel Id => ”#counter#1#2”
Results => Channel Id1 => 1
Channel Id2 => 3
Channel Id3 => 5
Channel Id4 => 7
Also “Channel Id” value(s) may be directly set as user-input with
“||#set#” Tempest command as below;
||#set#X (**Tempest Command**)
Note: Highlighted “X” will be string for Channel Id(s). If
multiple values will be set, they shall be separated with “|”
in string.
Example:
Channel Id => “||#set#ab|cd|ef”
Results => Channel Id1 => ab
Channel Id2 => cd
Channel Id3 => ef
Channel Name Pattern (C): This is the regex pattern for
capturing name value of each channel. Command and operators
explained in “Channel Id” section, may be used as same. Its value
will be transferred in to “##xmltv_id##“ special variable;
##xmltv_id## (**Special Variable**)
Channel Logo Pattern (C): This is the regex pattern for capturing
logo value of each channel. Command and operators explained in
“Channel Id” section, may be used as same. Its value will be
transferred in to “##cclogo##“ special variable;
##cclogo## (**Special Variable**)
Enable Duplicate Channel Id Remover (C): Indicator for
Tempest to compare and delete duplicated “Channel Id” values
and their corresponding “Channel Name” / “Channel Logo”
values.
Enable Duplicate Channel Name Remover (C): Indicator for
Tempest to compare and delete duplicated “Channel Name”
values and their corresponding “Channel Id” / “Channel Logo”
values.
Channel Sort Type (C): This is the indicator for Tempest to sort
and reindex captured values based on selected source. Available
options are “Channel Id” and “Channel Name”.
Channel Sort Flag (C): This is the indicator for Tempest to sort
and reindex captured values based on selected style. Available
options are “regular”, “numeric”, “string”, “natural”, “locale”,
“case-string” and “case-natural”.
Channel Sort Order (C): This is the indicator for Tempest which
tells order of channel sorting. Available options are “ascending”
and “descending”.
a) Tempest Variables
##channel## : Stores channel id value
##xmltv_id## : Stores channel name value
##cclogo## : Stores channel logo value
##urldateX## : Stores calculated urldate value. X may change
from 1 to 4 based on enabled url no and may be used in channel
creation with same string.
##urldateX_Y## : Stores calculated splitted(“||#split#”)
urldate value based on user input. X may change from 1 to 4 based
on enabled url no while Y may change from 1 to 5 and may be used
in channel creation with same string.
##stopdateX## : Stores calculated stopdate value. X may
change from 1 to 4 based on enabled url no and may be used in
channel creation with same string.
##stopdateX_Y## : Stores calculated splitted(“||#split#”)
stopdate value based on user input. X may change from 1 to 4
based on enabled url no while Y may change from 1 to 5 and may
be used in channel creation with same string.
##subpageX## : Stores calculated/given subpage value(s). X
may change from 1 to 4 based on enabled url no and may be used
in channel creation with same string.
##grabber_X## : Stores captured value as per given regex
pattern. X may change from 1 to 8 based on enabled url no and
may be used in channel creation with same string.
##dgrabber_X## : Stores captured value from detail pages as
per given regex pattern. X may change from 1 to 4 based on
enabled detail page url no.
##pagekey1## : Stores captured value as per given regex
pattern for detail page request.
##pagekey2## : Stores captured value as per given regex
pattern on detail or index(“||#index#“) page for detail page
request.
##cctag## : Stores captured or set channel tag value from
channel creation.
##ccsubpage## : Stores captured or set channel subpage value
from channel creation.
##cckey## : Stores given “User Key” value for channel creation.
##usertime## : Stores timezone settings of user for Timezone
element
##detail## : Stores captured the highest available detail page
result of a XMLTV element to transfer its desired lower counter
partner. Single elements results will be transferred as it is while
multiple element results will be converted to string with “ , “
seperation among them. This separation is for making it easier to
reconvert final result into array if needed.
b) Tempest Operators
In addition to special date/time operators which are already
explained in “Url(1-4) Urldate Format” section, below special
operators may be used for Tempest;
##now#format# : Calculates and replace itself with recent
date/time value in requested format on time of call.
Example:
##now#Y-m-d# => 2022-01-31 (as today’s date)
##now#H:i:s# => 10:57:46 (as current time)
##showtime#format# : Calculates and replace itself with
date/time value of show’s start time in requested format on time of
call. It is useful for detail page requests.
Example:
Show’s start time => 20220131091500 +0300
##showtime#Y-m-d# => 2022-01-31
##showtime#H&Y# => 09&2022
#counter#X(#Y)#Z : Calculates and replace itself with resulting
array based on given start, stop and interval. It may be used for
subpages and channel creation elements as explained in previous
chapter.
Note: From this point, combo operators of Tempest will be explained. Combo
operators allow you to perform multiple search in a single line regex pattern
and even keep/modify/combine these results as final. I named them as
“Shikai” and “Bankai” with different levels (Yes, I am an old fan of Bleach..)
Above “Inverter Path” applied a channel for some XMLTV elements and
results for comparison for the same show as below;
Result of Generated Xml =>
Result of Inverted Xml =>
b) Channel Configuration
You can multiply add, delete and/or change locations of selected
channels from “Channel Configuration” tab as below;
Channel Selector : Selection box which as drop-down list of
available siteconfig files, to list their available channels in
“Available Channels” box.
Available Channels : List of available channels belongs to chosen
siteconfig file on “Channel Selector” and its content will be
automatically updated in each change.
Config Channels : List of added/selected channels belongs to
chosen Tempest configuration file.
Register will send selected channels to “Channel Indexer”
tab. Without clicking it, changes will not take effect
Send all to “Config Channels”
Send selected channel(s) to “Config Channels”
Send selected channel(s) to “Available Channels”
Delete selected channel(s)
Move selected channel(s) to up
Move selected channel(s) to down
Send all to “Available Channels”
c) Channel Indexer
You can manually edit “site_id”, “xmltv_id” and “display_name”
values of selected channels from “Channel Indexer” tab as below;
“Cyclone Mode” which allows users to assign alternative channel
in case failure, may be set for each channel.
Multiple “display_name”s
with “||” command and lcn
tag, have been set and result
is as below;
d) Save & Exit
You can save your created/updated Tempest configuration file and
download from “Save & Exit” tab as below;