0
edits
Changes
→Examples
Used as a part of "handshake" procedure between client and TS Engine.
This commend command must be sent by client right after establishing tcp-connection with TS Engine.
'''Parameters:'''
<tt>'''request_id'''</tt> - случайное целое число random integer - идентификатор запроса identifier of LOADASYNCrequest; этот же идентификатор будет отослан клиенту в команде this identifier will be sent to client in LOADRESP после того,как будет получен список файловcommand after a list of files will be received; данный идентификатор служит для того, чтобы клиент в случае отправки нескольких запросов this id serves to ensure that client in case of sending multiple LOAD точно знал, на какой из этих запросов получен ответrequests knew exactly which of these requests is answered
<tt>'''torrent_url'''</tt> - ссылка на торрент файл link to torrent file (напримерfor example, http://sometracker.com/torrent/12345)
<tt>'''torrent_infohash'''</tt> - torrent's infohash торрента
<tt>'''player_id'''</tt> - код плеераplayer's code
<tt>'''torrent_data'''</tt> - содержимое торрентtorrent-файла в кодировке file's content, encoded in base64
<tt>'''developer_id'''</tt> - код разработчика developer's code (если неизвестноif unknown, необходимо передавать 0must be sent)
<tt>'''affiliate_id'''</tt> - код партнера partner's code (если неизвестноif unknown, необходимо передавать 0must be sent)
<tt>'''zone_id'''</tt> - код зоны партнера code of partner's zone (если неизвестноif unknown, необходимо передавать 0must be sent)
'''START URL''' <direct_url> <file_indexes> <developer_id> <affiliate_id> <zone_id>)</tt>
'''Parameters:'''
100 - 100% of video has been played
== Исходящие команды Outgoing commands ==
<tt>'''HELLOTS'''</tt>
<tt>'''AUTH''' <auth_level></tt>
<tt>auth_level</tt> - целое число integer - уровень доступаaccess level
0 - пользователю не доступны расширенные функции advanced features are not available for user (перемотка и проигрывание файлов из торрента с несколькими видео-файламиrewind and playback of torrent files with several video files)
1 - пользователю доступны расширенные функцииadvanced features are available for user
<tt>'''STATE''' <state_id></tt>
<tt>'''SHUTDOWN'''</tt>
TS Engine завершил работуfinished its work
<tt>'''PLAYADI''' <video_url></tt>
<tt>'''PLAY'''</tt> - проигрывание основного видеоplayback of the main video
<tt>'''PLAYAD'''</tt> - проигрывание непрерываемого рекламного ролика playback of uninterrupted advertising video (пользователь не может перемотать либо пропустить данный рекламный роликuser can't rewind or skip this advertising video)
<tt>'''PLAYADI'''</tt> - проигрывание прерываемого рекламного ролика playback of interrupted advertising video (пользователь может перемотать либо пропустить данный рекламный роликuser can rewind or skip this advertising video)
<tt>'''PAUSE'''</tt>
TS Engine начал буферизациюbegan buffering, так как недостаточно данных для проигрывания видео без остановкиbecause there's not enough data for video playback without interruptions
<tt>'''RESUME'''</tt>
TS Engine завершил буферизациюfinished buffering
<tt>'''LOADRESP''' <request_id> <response></tt>
<tt>'''request_id'''</tt> - идентификатор запросаrequest identifier
<tt>'''response'''</tt> - список файлов в формате a list of files in json в такого видаformat in this form:
{
"status": 1,
}
<tt>'''status'''</tt> - 0: в торренте нет видео файловthere are no video files in torrent, 1 - в торренте один видео файлthere is one video file in torrent, 2 - в торренте более одного видео файлаthere are more than one video files in torrent
<tt>'''infohash'''</tt> - torrent infohash торрента
<tt>'''files'''</tt> - список файловa list of files; это массивthis is an array, каждый элемент в котором состоит из массива из двух элементовeach element of which consists of an array with two elements: первый the first - название файлаfile's name, второй the second - позиция файла в торренте file's position in torrent (эта позиция должна отправляться в команде this position must be sent inside START для указанияcommand to specify which file to download, какой именно файл необходимо загружать, если их несколькоif there are several of them).
<tt>'''INFO''' <message_id>;<message_text></tt>
<tt>'''message_id'''</tt> - код сообщенияmessage code
<tt>'''message_text'''</tt> - текст сообщенияmessage text
<tt>'''STATUS''' <status_string></tt>
<tt>'''status_string'''</tt> - строка описанного ниже форматаstring in format described below
<tt>STATUS main:status_string</tt>
<tt>STATUS main:status_string|ad:status_string</tt>
<tt>'''status_string:'''</tt>
TS Engine ничего не делает does nothing - <tt>'''idle'''</tt>
<tt>total_progress;immediate_progress;speed_down;http_speed_down;speed_up;peers;http_peers;downloaded;http_downloaded;uploaded</tt>
<tt>'''total_progress'''</tt> - сколько всего закачано по данному файлуhow much of this file is downloaded
<tt>'''immediate_progress'''</tt> - сколько непрерывных данных закачано начиная с текущей позиции how much uninterruptible data is downloaded starting from the current position (для отображения кол-ва закачанного в бегункеto show amount of downloaded data)
'''ПримерыExamples:'''
<tt>STATUS main:prebuf;45;30|ad:buf;69
STATUS main:dl|ad:dl</tt>
'''Пример трансформация статусов в текстовые сообщения, понятные пользователюExample of tranformation statuses into text messages that user can understand:'''
<tt>check - Checking xx%
buf - Buffering xx%
wait - Waiting sufficient download speed
err - выводим сообщение об ошибкеshowing an error message dl, idle - ничего не выводимdoing nothing</tt>
== События Events ==
<tt>'''EVENT event_name param1_name=param1_value param2_name=param2_value ...'''</tt>
Parameter values - <tt>'''urlencoded utf-8'''</tt>
==Examples==
<<STATUS main:dl;0;0;141;0;0;8;0;4898816;0;0</tt>
client lost has played 25% of content
<tt>>>PLAYBACK http://127.0.0.1:6878/content/4c78e1cf0df23b4f5a16a106829ebed710cb52e0/0.673752283974 25
<<STATUS main:dl;0;0;146;0;0;7;0;8388608;0;0</tt>
client lost has played 50% of content
<tt>>>PLAYBACK http://127.0.0.1:6878/content/4c78e1cf0df23b4f5a16a106829ebed710cb52e0/0.673752283974 50
<<STATUS main:dl;0;0;145;0;0;7;0;9404416;0;0</tt>
client lost has played 75% of content
<tt>>>PLAYBACK http://127.0.0.1:6878/content/4c78e1cf0df23b4f5a16a106829ebed710cb52e0/0.673752283974 75