Jump to content

Search the Community

Showing results for tags 'docs'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type



Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 3 results

  1. Hooks are used to customize the Panel behaviour based on event type. Hook files are located in the /home/midnightstreamer/iptv_midnight_streamer/wwwdir/application/hooks directory and have to be prefixed by the custom_ keyword. The add_hook function is used to register the callback functions. Syntax add_hook(string $event_type, integer $priority, string $callback_function) Available Event Types are line/disable_line line/enable_line mag/disable_mag mag/enable_mag The callback functions execution order is defined by the priority parameter. The callback functions have two array type parameters available for processing, $segments which contains the URL segments from the 3rd segment on and $post array which contains POST data. For example if we want to call an API on another server while disabling/enabling a Line or MAG Device in our Panel, we can make a hook like this: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); function disable_line($segments, $post) { $CI =& get_instance(); $line = $CI->lines_model->get_line($segments[0]); call_api('https://server.com:8001/', 'API_KEY', 'api/line/update', array('username' => $line->username, 'disabled' => 1)); } function enable_line($segments, $post) { $CI =& get_instance(); $line = $CI->lines_model->get_line($segments[0]); call_api('https://server.com:8001/', 'API_KEY', 'api/line/update', array('username' => $line->username, 'disabled' => 0)); } function disable_mag($segments, $post) { $CI =& get_instance(); $mac_address = $CI->mags_model->get_mag_mac_by_id($segments[0]); call_api('https://server.com:8001/', 'API_KEY', 'api/mag/update', array('mac_address' => $mac_address, 'disabled' => 1)); } function enable_mag($segments, $post) { $CI =& get_instance(); $mac_address = $CI->mags_model->get_mag_mac_by_id($segments[0]); call_api('https://server.com:8001/', 'API_KEY', 'api/mag/update', array('mac_address' => $mac_address, 'disabled' => 0)); } add_hook('line/disable_line', 1, 'disable_line'); add_hook('line/enable_line', 1, 'enable_line'); add_hook('mag/disable_mag', 1, 'disable_mag'); add_hook('mag/enable_mag', 1, 'enable_mag'); ?>
  2. To successfully use the Server API, you have to insert your IP first into the whitelist. You can do that in General Settings -> API Settings. You can pass api_key by POST or by appending the key as 4th segment to the URL. Creating New Line To create a New line, we will call the following URL. http(s)://domain:port/api/line/new The above URL, accepts the POST action Example Code: <?php $panel_url = 'http://DOMAIN:PORT/'; $api_key = 'api_key'; $username = 'test_username'; $password = 'test_password'; $max_connections = 1; $restreamer = 1; $subscription_plan = 1; $expire_date = strtotime( "+1 month" ); ############################################################################### $post_data = array('api_key' => $api_key, 'data' => array('username' => $username, 'password' => $password, 'max_allowed_connections' => $max_connections, 'restreamer' => $restreamer, 'expire_date' => $expire_date, 'subscription_plan_id' => $subscription_plan) ); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api/line/new", false, $context ) ); ?> If you leave the username and/or password elements empty, the system will generate random characters for these 2 fields. In addition, leaving any field empty, api will use the default value for this field according to SQL Database. So theoretically, you can make a line with just Calling the Above URL, without any parameter, however the created user, wont have any bouquets inside. You can call any other element that is in the database like reseller_id disabled allowed_ips allowed_user_agents server_id isp_lock notes and so on... If you want to set the allowed_ips/allowed_user_agents or other multiple values you can use arrays. The API will return a simple json encoded string that upon decoding will contain the element result which returns true/false. Example(API Success) {"result":true,"created_id":14838,"username":"d4PSc7uCqF","password":"2ZiSRRZk4b"} The API returned as the username/password of the NEW line, as well as the ID so we can use it wherever we want. Example(API Failed) {"result":false,"error":"Username exists."} {"result":false,"error":"{Database error}"} Username exists. The Username you specified already exists in the database {Database error} Database error description. The DB error will be logged in LOGS -> Panel Error Log. Editing Line Editing a line is very similar to the above. The URL we will call this time is http(s)://domain:port/api/line/update REQUIRED PARAMETERS username OPTIONAL PARAMETERS all other fields of lines database table For example if we want to Edit the Expire Date, make the line restreamer and adjusting the max connections to 10 we will do it like this: <?php $panel_url = 'http://DOMAIN:PORT/'; $api_key = 'api_key'; $username = 'test_username'; $password = 'test_password'; $max_connections = 10; $restreamer = 1; $expire_date = strtotime( "+1 month" ); //from the time now, not from line's expire date. ############################################################################### $post_data = array( 'api_key' => $api_key, 'username' => $username, 'data' => array('password' => $password, 'max_allowed_connections' => $max_connections, 'restreamer' => $restreamer, 'expire_date' => $expire_date) ); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api/line/update", false, $context ) ); ?> In the above example, we will edit the max_allowed_connections, restreamer and expire_date for our line with username test_username, and password test_password that already exists in our database. Example(API Success) {"result":true, "modified_id":{id}, "username":{username}, "password":{password}} Example(API Failed) {"result":false,"error":"Wrong Username/Password."} {"result":false,"error":"{Database error}"} Wrong Username/Password. The Username / Password you specified don't exist in the database {Database error} Database error description. The DB error will be logged in LOGS -> Panel Error Log. Deleting Line With this API call you can delete the line from the database. The URL we will call is http(s)://domain:port/api/line/delete REQUIRED PARAMETERS username View Line Information With this API call, we will get all the information available about our line including the active connections. The URL we will call this time is http(s)://domain:port/api/line/info REQUIRED PARAMETERS username It will return a JSON Encoded string, with all information that you might want. Example Code: $panel_url = 'http://DOMAIN:PORT/'; $api_key = "api_key"; $username = "username"; $password = "password"; ############################################################################### $post_data = array( 'api_key' => $api_key, 'username' => $username ); $opts = array( 'http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query( $post_data ) ) ); $context = stream_context_create( $opts ); $api_result = json_decode( file_get_contents( $panel_url . "api/line/info", false, $context ), true ); if ( $api_result['result'] ) { echo "Line Connections: " . json_encode($api_result['line_conn_info']); echo "\nCurrent Expire Date: " . (( empty( $api_result['line_info']['expire_date'] ) ) ? 'Unlimited' : $api_result['line_info']['expire_date'] ); echo "\nMax Connections: " . $api_result['line_info']['max_allowed_connections']; echo "\nAvailable Channel IDs: " . implode( ',', $api_result['line_channel_ids'] ); } else echo 'FAILED';
  3. Player API Note: The API Does not provide Full links to the requested stream. You have to build the url to the stream in order to play it. For Live Streams the main format is http(s)://domain:port/live/username/password/streamID.ext ( In allowed_output_formats element you have the available ext ) For VOD Streams the format is: http(s)://domain:port/live/username/password/streamID.ext ( In target_container element you have the available ext ) On the First Authentication Call, you will get a list of some useful elements. If the server_protocol element is https you have to force all the API & Player Requests to be through https. The same Call, also provides the http(s) ports in case you need them as well as the domain name you should use. The current datetime & timestamps are offered to you and can help you for time corrections for EPG & TV Archive. If you want to limit the displayed output data, you can use offset / items per page / page number as the last three segments of the API call. E.g. http(s)://domain:port/api/player/{username}/{password}/live/streams/4/20/7 (fetch streams for user {username} from the 4th stream on, 20 streams per page, fetch the 7th page) It is highly recommended to fetch all data at once and cache them to your Application. Authentication api/player/{username}/{password} GET Live Stream Categories api/player/{username}/{password}/live/categories GET VOD Stream Categories api/player/{username}/{password}/vod/categories GET Series Categories api/player/{username}/{password}/series_cat (This will get All Series Categories) api/player/{username}/{password}/series_cat/{category_id} (This will get All Series in the selected category ONLY) GET LIVE Streams api/player/{username}/{password}/live/streams (This will get All LIVE Streams) api/player/{username}/{password}/live/streams/{category_id} (This will get All LIVE Streams in the selected category ONLY) GET VOD Streams api/player/{username}/{password}/vod/streams (This will get All VOD Streams) api/player/{username}/{password}/vod/streams/{category_id} (This will get All VOD Streams in the selected category ONLY) GET Series Seasons and Episodes api/player/{username}/{password}/series/seasons/{series_id} (This will get All Seasons of the selected series ONLY) api/player/{username}/{password}/series/episodes/{series_id}/{season_number} (This will get All Episodes in the selected season of the selected series ONLY) GET Catch-up api/player/{username}/{password}/catchup/{stream_id} (This will get all catchup info for the choosen stream such as event name, start date, end timestamp, catchup URL and event description) GET VOD Info api/player/{username}/{password}/vod/info/{vod_id} (This will get info such as video codecs, duration, description, directors for 1 VOD) GET Series Episode Info api/player/{username}/{password}/series/info/{vod_id} (This will get info such as video codecs, duration, description, directors for 1 VOD) GET short epg for LIVE Streams (same as stalker portal, prints the upcoming EPG events that will play next) api/player/{username}/{password}/epg/short/{stream_id} api/player/{username}/{password}/epg/short/{stream_id}/{offset}/{items_per_page}/{page_number} (You can specify a limit too appending offset/items_per_page/page_number to the URL) GET ALL EPG for LIVE Streams (same as stalker portal, but it will print all EPG listings regardless of the day) api/player/{username}/{password}/epg/full/{stream_id} Full EPG List for all Streams api/player/{username}/{password}/epg/full/all Get Archive URL api/player/{username}/{password}/archive/create_link/{stream_id}/{epg_event_end} Get EPG Date TXT File download/LastUpdate/{username}/{password} Get EPG Timestamp TXT File download/LastUpdateTimestamp/{username}/{password} Get Line Messages api/player/{username}/{password}/messages Send Claims api/player/{username}/{password}/send_claim/{stream_id}/{claim_type} (claim_type can be sound, video, no_epg, wrong_epg) Set Favorites for Live channels, VOD and Radio api/player/{username}/{password}/set_fav/{live/vod/radio}/{service_1_id}/{service_2_id}/{service_3_id}/... Set Favorites for Series api/player/{username}/{password}/set_fav/series/{series_1_id}/{series_2_id}/{series_3_id}/... Check Parent Password api/player/{username}/{password}/check_parent_password/{password} (returns True or False) Change Parent Password api/player/{username}/{password}/change_parent_password/{current_parent_password}/{new_parent_password} (returns False is current_parent_password is wrong) Get Speed Test URL api/player/{username}/{password}/speed_test Download arbitrary File located in folder /home/midnightstreamer/iptv_midnight_streamer/download download/file/{username}/{password}/{file_name}
×
×
  • Create New...