Jump to content
Griga

Media Server 2.x API Changes

Recommended Posts

Griga    359
Griga

Beginning with DVBViewer Media Server 2.0 (former Recording Service), the API changes are no more published in the News & Announcement forum, but here (English only) . Additionally they are contained in the file changelog_en_dms.html (see docs sub-directory of the Media Server installation directory).

Changes in DVBViewer Media Server 2.0:

  • Added: API: /api/epg.html now supports an additional parameter utc=1 that lets the Media Server output all EPG times as UTC instead of local time. Please note that the start=... and end=... parameters must also be specified as UTC in this case!

  • Added: API: scheme=xxx parameter for /api/timeradd.html and /api/timeredit.html. It sets the file naming scheme for the recording. The character coding is specified by the encoding parameter (as for title, folder and series).

  • Added: API: Possibility to retrieve the EPG Event ID of a recorded program with /api/recodings.html&eventid=1. The value 0xFFFFFFFF = 4294967295 indicates that no Event ID is available.

  • Fix: API: If a single channel was requested with /api/getchannelsxml.html (followed by number=..., id=... or epgid=...) that didn't exist the Recording Service delivered the whole channel list. Now the output is an empty <channels> tag.

  • Added: API: /api/getchannelsxml.html now allows to limit the output to TV channels (tvonly=1), to radio channels (radioonly=1) or to channels for which EPG data is currently available (epgonly=1).

  • Added: API: Search for an EPG item with a certain Event ID or PDC by using /api/epg.html?channel=[EPGChannelID]&eventid=... or &pdc=. Both require specifying a channel. If an Event ID or PDC is specified other search criteria like time or search items are ignored. Please note that searching for an Event ID will only yield one result (if at all). A PDC search may deliver more than one result in case of split programs, e.g. sport events interrupted by news (see here).

  • Added: API: Possibility to selectively delete EPG data originating from a certain source with the epgclear API:

/api/epgclear.html?source=[Sources]

The numeric value [Sources] specifies the to be deleted EPG types as flags that can be or'ed  (1 = DVB EPG 2 = MHW EPG, 4 = External EPG). If [Sources] is not specified the default is all EPG data (currently 7).

  • Added: API: Possibility to directly download any file from the media file directories with

/api/sideload.html?[video/audio/photo]=1&dirid=[ID]&file=[filename]

where video=1 (default), audio=1 or photo=1 specify the media type, dirid=[ID] a directory ID retrieved with /api/mediafiles.html and file=[filename] the UTF-8 name of the file that shall be delivered. If [filename] is a mask containing a “*” character the API enumerates all matching files separated by CR/LF as plain UTF-8 text. Thus *.* enumerates all files in the directory. Using a slash or backslash as part of the filename for accessing parent- or sub-directories is not allowed.

  • Added: API: Possibility to get tables from the Media Server databases as XML output by using SQLite queries:

/api/sql.html?[video/audio/photo/rec]=1&query=[SQLite query]

where video=1 (default), audio=1, photo=1 or rec=1 specify the database. The access is restricted to “read only”. You may use the attached database diagrams (see below)  or the SQLiteBrowser to get insight into the database structures.

  • Added: API/Trancoded Streaming (HLS): Two new parameters adjustpts and recfile can be used to control how jumping to a different position on HLS file playback is handled. Details are described in the file transcoding_params_en.txt (see Docs sub-directory of the Media Server installation directory).

  • Added: API/Transcoded Streaming (TS): Possibility to set up permanent transcoded TS streams that are running independently from client connections and can be accessed by a (theoretically) unlimited number of clients at the same time, but only require a single FFmpeg instance.

The stream is started with 

/api/startts.html?streamid=[unique_name]&chid=....

[unique_name] is a user defined identifier (e.g. the channel name). Additionally an ID specifying the media object (channel, file etc) that shall be transcoded is required. Other parameters are optional. The media server uses defaults if they are missing. The stream is stopped by

/api/stopts.html?streamid=[unique_name]

or by stopping the Recording Service. Clients can access the stream by using the following type of URL

/flashstream/stream.ts?streamid=[unique_name]

No further parameters are required. Please note that transcoded TS streams set up by a client connection can also be accessed by other clients if the URL contains the same stream ID or if the query string (beginning with a question mark) is identical. Please also note that this does not work with WebM and Flash.

  • Added/Change: API/Channel List Download: As before downloading the file transcodedchannels.m3u requires specifying a TV preset and/or radio preset by using tvpreset=... and rpreset=... parameters, controlling whether TV and/or radio channels are contained in the list and which format is used. Additional parameters can be used to override the “Show Favorites Additionally / Show Favorites Only” user settings on the Web Interface configuration page that are applied by default. Each switch can be 0 (off) or 1 (on):

fav=0/1: Specifies if the favorites are added at the top of the channel list (if there are any).

favonly=0/1: Specifies if the channel list only contains favorites (if there are any).

Additionally, if the TV and Radio presets are specified by name, the Media Server now uses the iphoneprefs.ini if the name begins with “HLS”, otherwise the ffmpegprefs.ini (containing WebM/Flash/TS presets). If the presets are specified by zero based index, it depends on the user agent. If the Media Server detects Safari or Edge, it assumes that the index refers to HLS presets, otherwise to WebM/Flash/TS presets. However, this can also be controlled by parameter:

hls=0: The index refers to WebM/Flash/TS presets (ffmpegprefs.ini)

hls=1: The index refers to HLS presets (iphoneprefs.ini).

The following example downloads a channel list that only contains TV favorites. The format is HLS, using the second preset in the file iphoneprefs.ini:

http://127.0.0.1:8089/transcodedchannels.m3u?tvpreset=1&hls=1&favonly=1

  • Change/Added: API/Channel List Download: By default the Media Server filters the channels.m3u and rtspchannels.m3u download according to the “Show TV/Radio” and “Show Favorites Additionally / Show Favorites Only” user settings on the Web Interface configuration page. The following parameters can be used to override the settings and specify the content. Each switch can be 0 (off) or 1 (on):

fav=0/1: Specifies if the favorites are added at the top of the channel list .

favonly=0/1: Specifies if the channel list only contains favorites.

tv=0/1: Specifies if list contains TV channels.

radio=0/1: Specifies if list contains radio channels.

Everything not specified by parameters is up to the user settings. Please note that the favorite switches are ignored if there are no favorites. fav and favonly cannot both be 1 (setting one of them to 1 switches the other one off) and tv and radio cannot both be 0 (setting one of them to 0 switches the other one on) The following example downloads a channel list that only contains TV favorites:

http://127.0.0.1:8089/channels.m3u?radio=0&favonly=1

  • Added: API/RTSP Server: Possibility to configure permanent UDP/RTP unicast and multicast streams (running independently from client access). Please note that this feature requires an extended license that allows for at least 50 Media Server clients at the same time. The streaming is performed by the RTSP server, but the configuration is done by using Web Server URLs that require full (user) access rights so it can be password protected. The URLs may use a channel ID or Sat>IP syntax to specify the data that shall be sent. The following parameters in the URL query part are supported:

    • ip=... (required) specifies the IPv4 destination address. It may be a multicast IP like 239.0.0.1 or a local network address like 192.168.2.102 for unicast.

    • port=... (required) specifies the destination port.

    • nic=... (optional) specifies the IP of the network adapter through which the data shall be sent. By default it is selected by Windows.

    • ttl=... (optional) specifies the “time to live” as integer number. The default is defined by the “Sat>IP/UPnP Multicast TTL” tweak (usually = 1, see DMSTweaker.bat, which means, the RTP multicast output is only accessible in the same subnet).

    • rtcp=1 (optional) lets the Media Server set up a Sat>IP multicast session. An additional RTCP announcement stream carrying Sat>IP information like signal quality is sent to the subsequent destination port.

Here are two configuration examples, the first one using a channel id for starting multicast, the second one using Sat>IP syntax (incomplete) for unicast:

http ;//127.0.0.1:8089/rtp/?ip=239.0.0.1&port=5018&chid=2359890840093486438|ZDF

http ;//127.0.0.1:8089/rtp/?ip=192.168.2.112&port=5018&&freq=11494&msys=dvbs2...

PAT and PMT are adjusted to the actual output. The stream is stopped by an URL that specifies the same IP and port. Additional parameters are ignored in this case. So the same URL can be used for switching the stream on/off.

DMS_Database_Diagrams_II.zip

Share this post


Link to post
Griga    359
Griga

Changes in DVBViewer Media Server 2.0.3:

  • Fix: API/EPG: /api/epg.html delivered no results in case of TS Stream channels with a native DVB EPG.
  • Added: API/Tasks: If /api/tasks.html is requested without parameter the Media Server delivers the whole task list as XML, reflecting how it is displayed on the Task Page of the web interface, but with After Recording Tasks included:
<tasklist>
 <group name="EPG">
  <task type="0">
   <name>Start EPG Update</name>
   <action>EPGStart</action>
  </task>
  <task>
  ....
  </task>
 </group>
 <group>
 ....
 </group>
 ....
</tasklist>

The task type has the following meaning: 0 = predefined internal task, 1 = user defined process task, 2 = after recording task (user defined, should only be displayed in UIs allowing to create or edit recording timers).

Action is the command that must be sent to the Media Server for executing the task, e.g. /api/task.html?task=EPGStart. For consistency the API also allows to use /api/task.html?action=....

Share this post


Link to post
Guest
This topic is now closed to further replies.

×