h1. Protocol *NOTE: This documentation is obsolete and doesn't apply anymore to NNTPGrab 0.6.0 and higher. For documentation about remote controlling NNTPGrab 0.6.0 and higher, please see the [[JSON-RPC|JSON-RPC documentation]]* This document describes how any frontend can communicate to the backend over raw sockets. This makes it possible to control the NNTPGrab backend from another host. The NNTPGrab Core listens on port 5423/tcp. After making a connection to this port, the NNTPGrab Core replies with the following welcome message:
NNTPGrab Server - API version 20090505(where _20090505_ is the version number of the protocol. This should match the clients expectations) The documentation on this wiki is all based on API version 20090505 The NNTPGrab protocol is a line based protocol. Every command should end with the newline character (\n). When connecting, the client should send one of the following commands before further communication is possible:
MODE LISTENER_or_
MODE COMMANDThe server should return the following response:
OKAfter this command, the socket is either broadcasting all the signals coming from the NNTPGrab Core or awaiting commands. When an invalid command is entered, the server will send the response:
INVALID COMMANDh2. MODE COMMAND h3. CONFIG_GET_AVAIL_SERVERS Returns a list of all the available usenet servers. Notation:
CONFIG_GET_AVAIL_SERVERSResponse:
Example:NULL
> CONFIG_GET_AVAIL_SERVERS < NewsZilla < NULLh3. CONFIG_GET_SERVER_INFO Retrieve information about a specific usenet server. Returns NULL when the given servername isn't found Notation:
CONFIG_GET_SERVER_INFOResponse:
NULL_or_
Example:NULL
> CONFIG_GET_SERVER_INFO NewsZilla < NewsZilla < newszilla.xs4all.nl < 119 < < < 3 < 1 < FALSE < TRUE < NULLh3. CONFIG_ADD_SERVER Add a new usenet server Returns FALSE when the servername already exists Notation:
CONFIG_ADD_SERVERResponse:\t \t \t \t \t \t \t \t
TRUE_or_
FALSEExample:
> CONFIG_ADD_SERVER NewsZilla newszilla.xs4all.nl 119 3 1 FALSE TRUE < TRUEh3. CONFIG_DEL_SERVER Remove a usenet server Returns FALSE when the servername isn't known Notation:
CONFIG_DEL_SERVERResponse:
TRUE_or_
FALSEExample:
> CONFIG_DEL_SERVER NewsZilla < TRUEh3. CONFIG_EDIT_SERVER Changes the settings of a usenet server Returns FALSE when the servername isn't known Notation:
CONFIG_EDIT_SERVERResponse:\t \t \t \t \t \t \t \t \t
TRUE_or_
FALSEExample:
> CONFIG_EDIT_SERVER NewsZilla NewsZilla_IPV6 newszilla6.xs4all.nl 119 my_username my_pass 3 1 FALSE TRUE < TRUEh3. CONFIG_GET_OPTS Retrieves the global settings of the NNTPGrab Core Notation:
CONFIG_GET_OPTSResponse:
Example:NULL
> CONFIG_GET_OPTS < /home/test/NNTPGrab/Downloads < /home/test/NNTPGrab/Temp < FALSE < TRUE < TRUE < /home/test/NNTPGrab/NZB < TRUE < TRUE < NULLh3. CONFIG_SET_OPTS Changes the global settings of the NNTPGrab Core Returns FALSE when one of the new settings are invalid Notation:
CONFIG_SET_OPTSResponse:\t \t \t \t \t \t \t
TRUE_or_
FALSEExample:
> CONFIG_SET_OPTS /home/test/NNTPGrab/Downloads /home/test/NNTPGrab/Temp FALSE TRUE TRUE /home/test/NNTPGrab/NZB FALSE TRUE < TRUEh3. CONFIG_GET_FOLDER_LISTING Retrieves a list containing all the sub-folders which are in the given folder. Each result also contains a TRUE or FALSE mentioning if the sub-folders itself contains sub-folders Notation:
CONFIG_GET_FOLDER_LISTINGResponse:
FALSE_or_
NULL_or_
folder1\tTRUE folderX\tFALSE NULLExample:
> CONFIG_GET_FOLDER_LISTING / < bin FALSE < etc TRUE < proc TRUE < sbin FALSE < usr TRUE < var TRUE < NULLh3. SCHEDULAR_START Start the NNTPGrab schedular Returns FALSE when the schedular is already running Notation:
SCHEDULAR_STARTResponse:
TRUE_or_
FALSEExample:
> SCHEDULAR_START < TRUEh3. SCHEDULAR_STOP Stop the NNTPGrab schedular Returns FALSE when the schedular is already stopped Notation:
SCHEDULAR_STOPResponse:
TRUE_or_
FALSEExample:
> SCHEDULAR_STOP TRUE < TRUEh3. SCHEDULAR_GET_STATE Retrieves the current state of the schedular Notation:
SCHEDULAR_GET_STATEResponse:
RUNNING_or_
STOPPING_or_
STOPPEDExample:
> SCHEDULAR_GET_STATE < STOPPEDh3. SCHEDULAR_ADD_TASK_TO_QUEUE Add a new task (file) to the download queue When a file contains multiple groups or multiple parts, these need to be split using the | character. A part needs to be in the notation
SCHEDULAR_ADD_TASK_TO_QUEUEResponse:\t \t \t \t \t \t
TRUE_or_
FALSEExample:
> SCHEDULAR_ADD_TASK_TO_QUEUE my collection my subject some poster 1199389869 123456789 alt.binaries.boneless|alt.binaries.nlh3. SCHEDULAR_DEL_TASK_FROM_QUEUE Removes a task from the download queue Notation:,1,500| ,2,250 < FALSE The file already exists in the download queue
SCHEDULAR_DEL_TASK_FROM_QUEUEResponse:\t
TRUE_or_
FALSEExample:
> SCHEDULAR_DEL_TASK_FROM_QUEUE my collection my subject < TRUEh3. SCHEDULAR_RESTART_TASK Restarts a task already present in the download queue Notation:
SCHEDULAR_RESTART_TASKResponse:\t
TRUE_or_
FALSEExample:
> SCHEDULAR_RESTART my collection some other subject < FALSE File is not present in the given collectionh3. SCHEDULAR_SAVE_QUEUE Saves the download queue. This needs to be done after added new files to the download queue Notation:
SCHEDULAR_SAVE_QUEUEResponse:
TRUE_or_
FALSEExample:
> SCHEDULAR_SAVE_QUEUE < TRUEh3. SCHEDULAR_FOREACH_TASK Returns all the collections and tasks present in the download queue Notation:
SCHEDULAR_FOREACH_TASKResponse:
COLLECTIONPossible status'es:\t \t \t \tFILE \t \t \t \t \t \t \t \t \t \t (this list can be returned multiple times) NULL
WAITING_FOR_DOWNLOAD DOWNLOADING WAITING_FOR_DECODE DECODING FINISHED_COMPLETE FINISHED_INCOMPLETE FINISHED_NO_PARTS_AVAIL SKIPPEDExample:
> SCHEDULAR_FOREACH_TASK < COLLECTION my collection 12345678 100 3 < FILE my_subject some_poster 1199389869 0 1234567 1 100 10 0 WAITING_FOR_DOWNLOAD alt.binaries.boneless|alt.binaries.nl < FILE some_other_subject some poster 1199389900 100 565432 2 50 0 0 alt.binaries.x < COLLECTION some other collection 626832 200 < FILE another subject another poster 1199331624 1583632 200 1 10 0 0 alt.binaries.x < NULLh3. SCHEDULAR_MOVE_TASK Change the position and/or location of a task in the download queue. The _collection_name_src_ can be the same as _collection_name_dest_. If the _position_ is -1, the file will be added to the end of the queue. If subject is empty, then the _position_ will mean the position of all the collections in the download queue. Notation:
SCHEDULAR_MOVE_TASKResponse:\t \t \t
TRUE_or_
FALSEExample, change the position of a task within the same collection:
> SCHEDULAR_MOVE_TASK my collection my subject my collection 5 < TRUEExample, move the task to another collection
> SCHEDULAR_MOVE_TASK my collection my subject another collection -1 < FALSEh3. SCHEDULAR_MOVE_COLLECTION Change the position of a collection in the download queue. If the _new_position_ is -1, the collection will be moved to the end of the queue. Notation:
SCHEDULAR_MOVE_COLLECTIONResponse:\t
TRUE_or_
FALSEExample
> SCHEDULAR_MOVE_COLLECTION my collection -1 < TRUEh1. MODE LISTENER While in the listener mode, all signals coming from the NNTPGrab Core are automatically broadcasted on the socket. These are the possible messages which the NNTPGrab Core can send. h3. CONFIG_CHANGED Something in the configuration has changed
CONFIG_CHANGEDh3. PART_DOWNLOAD_START The download of a part has just started
PART_DOWNLOAD_STARTh3. PART_DONE The download of a part has completed successfully\t \t \t \t
PART_DONEh3. PART_FAILED The download of a part has failed (probably because the part isn't available on the server\t \t \t \t \t
PART_FAILEDh3. TRAFFIC_MONITOR_UPDATE Every second, traffic statistics about the last 10 seconds are given\t \t \t \t \t \t
TRAFFIC_MONITOR_UPDATEh3. PART_PROGRESS_UPDATE Every 10KB of a part download, this message will be sent\t \t \t \t \t \t \t \t \t \t \t
PART_PROGRESS_UPDATEh3. COLLECTION_ADDED A new collection was added\t \t \t \t \t
COLLECTION_ADDEDh3. COLLECTION_REMOVED A collection was removed\t
COLLECTION_REMOVEDh3. COLLECTION_MODIFIED The poster of a collection was modified
COLLECTION_MODIFIEDh3. FILE_ADDED A file was added to a already existing collection. The\t
FILE_ADDEDh3. FILE_REMOVED A file was removed from the download queue\t \t \t \t \t \t \t
FILE_REMOVEDh3. FILE_DOWNLOAD_STATE_UPDATE The state of a file in the download queue has changed\t \t \t
FILE_DOWNLOAD_STATE_UPDATEh3. FILE_STATE_CHANGED A file in the download queue was restarted\t \t \t \t \t \t t\t \t
FILE_STATE_CHANGEDh3. CONNECTION_CONNECTING A new connection is being made to a usenet server\t \t \t \t
CONNECTION_CONNECTINGh3. CONNECTION_CONNECTED A connection attempt has succeeded\t
CONNECTION_CONNECTEDh3. CONNECTION_DISCONNECT A connection to a usenet server was disconnected\t \t
CONNECTION_DISCONNECT_disconnect_type_ can be any of the following values:\t \t \t
NORMAL NO_SUCH_HOST CONNECTION_REFUSED TOO_MANY_CONNECTIONS CONNECT_TIMEOUT READ_ERROR READ_TIMEOUT WRITE_ERROR IDLE_TIMEOUT INVALID_MSG LOGIN_FAILURE ERROR_SSL_INITIALISE UNEXPECTEDh3. SCHEDULAR_STATE_CHANGED The state of the schedular has changed
SCHEDULAR_STATE_CHANGEDh3. FATAL_ERROR A fatal error has occured\t
FATAL_ERRORh3. WARNING_MESSAGE A warning has occured
WARNING_MESSAGEh3. DEBUG_MESSAGE A debug message has been emitted
DEBUG_MESSAGEh3. TASK_MOVED The position of a task in the download queue has changed
TASK_MOVEDh3. COLLECTION_MOVED The position of a collection in the download queue has changed\t \t \t \t
COLLECTION_MOVEDh3. PAR2_REPAIR_MESSAGE The PAR2 repair component has emit a message which can be shown to the user\t \t
PAR2_REPAIR_MESSAGEh3. ALL_DOWNLOADS_COMPLETED This message is emit when all the items in the download queue are completed
ALL_DOWNLOADS_COMPLETEDh3. UNPACK_PROGRESS_UPDATE The unpack component has made some progress
UNPACK_PROGRESS_UPDATEh3. UNPACK_MESSAGE_RECEIVED The unpack component has emit a message. This message mostly is the file which is currently extracted\t \t
UNPACK_MESSAGE_RECEIVEDh3. UNPACK_WORKING_ARCHIVE_CHANGED The unpack component is now unpacking from a new archive file\t \t
UNPACK_WORKING_ARCHIVE_CHANGEDh3. PAR2_BEGIN_VERIFY A PAR2 verification (and if necessary repair) has just started\t \t
PAR2_BEGIN_VERIFYh3. PAR2_LOAD_PROGRESS_UPDATE A file is now being verified\t
PAR2_LOAD_PROGRESS_UPDATEh3. PAR2_RECOVERY_FILE_LOADED A PAR2 recovery file has been loaded completely\t \t \t
PAR2_RECOVERY_FILE_LOADEDh3. PAR2_FILE_LOADED A regular file has been loaded completely\t \t \t \t
PAR2_FILE_LOADEDThe field _state_ can be one of the following values:\t \t \t \t \t
MISSING FOUND DAMAGED NO_NEW_BLOCKS_FOUNDh3. PAR2_REPAIR_PROGRESS_UPDATE A PAR2 repair is now going on
PAR2_REPAIR_PROGRESS_UPDATEh3. PAR2_REPAIR_FAILURE The PAR2 repair has failed because there aren't enough recovery blocks available\t \t
PAR2_REPAIR_FAILUREh3. PAR2_REPAIR_SUCCESS The PAR2 repair has completed successfully\t \t
PAR2_REPAIR_SUCCESSh3. PAR2_NO_REPAIR_REQUIRED All the files in the PAR2 set have been verified and no repair is necessary\t
PAR2_NO_REPAIR_REQUIRED\t