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 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
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
MODE COMMAND
OK
After 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 COMMAND
Returns a list of all the available usenet servers.
Notation:
CONFIG_GET_AVAIL_SERVERS
Response:
NULL
Example:
> CONFIG_GET_AVAIL_SERVERS < NewsZilla < NULL
Retrieve information about a specific usenet server. Returns NULL when the given servername isn't found
Notation:
CONFIG_GET_SERVER_INFO
Response:
NULL
NULL
Example:
> CONFIG_GET_SERVER_INFO NewsZilla < NewsZilla < newszilla.xs4all.nl < 119 < < < 3 < 1 < FALSE < TRUE < NULL
Add a new usenet server
Returns FALSE when the servername already exists
Notation:
CONFIG_ADD_SERVER\t \t \t \t \t \t \t \t
Response:
TRUE
FALSE
Example:
> CONFIG_ADD_SERVER NewsZilla newszilla.xs4all.nl 119 3 1 FALSE TRUE < TRUE
Remove a usenet server
Returns FALSE when the servername isn't known
Notation:
CONFIG_DEL_SERVER
Response:
TRUE
FALSE
Example:
> CONFIG_DEL_SERVER NewsZilla < TRUE
Changes the settings of a usenet server
Returns FALSE when the servername isn't known
Notation:
CONFIG_EDIT_SERVER\t \t \t \t \t \t \t \t \t
Response:
TRUE
FALSE
Example:
> CONFIG_EDIT_SERVER NewsZilla NewsZilla_IPV6 newszilla6.xs4all.nl 119 my_username my_pass 3 1 FALSE TRUE < TRUE
Retrieves the global settings of the NNTPGrab Core
Notation:
CONFIG_GET_OPTS
Response:
NULL
Example:
> CONFIG_GET_OPTS < /home/test/NNTPGrab/Downloads < /home/test/NNTPGrab/Temp < FALSE < TRUE < TRUE < /home/test/NNTPGrab/NZB < TRUE < TRUE < NULL
Changes the global settings of the NNTPGrab Core
Returns FALSE when one of the new settings are invalid
Notation:
CONFIG_SET_OPTS\t \t \t \t \t \t \t
Response:
TRUE
FALSE
Example:
> CONFIG_SET_OPTS /home/test/NNTPGrab/Downloads /home/test/NNTPGrab/Temp FALSE TRUE TRUE /home/test/NNTPGrab/NZB FALSE TRUE < TRUE
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_LISTING
Response:
FALSE
NULL
folder1\tTRUE folderX\tFALSE NULL
Example:
> CONFIG_GET_FOLDER_LISTING / < bin FALSE < etc TRUE < proc TRUE < sbin FALSE < usr TRUE < var TRUE < NULL
Start the NNTPGrab schedular
Returns FALSE when the schedular is already running
Notation:
SCHEDULAR_START
Response:
TRUE
FALSE
Example:
> SCHEDULAR_START < TRUE
Stop the NNTPGrab schedular
Returns FALSE when the schedular is already stopped
Notation:
SCHEDULAR_STOP
Response:
TRUE
FALSE
Example:
> SCHEDULAR_STOP TRUE < TRUE
Retrieves the current state of the schedular
Notation:
SCHEDULAR_GET_STATE
Response:
RUNNING
STOPPING
STOPPED
Example:
> SCHEDULAR_GET_STATE < STOPPED
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
Notation:
SCHEDULAR_ADD_TASK_TO_QUEUE\t \t \t \t \t \t
Response:
TRUE
FALSE
Example:
> SCHEDULAR_ADD_TASK_TO_QUEUE my collection my subject some poster 1199389869 123456789 alt.binaries.boneless|alt.binaries.nl,1,500| ,2,250 < FALSE The file already exists in the download queue
Removes a task from the download queue
Notation:
SCHEDULAR_DEL_TASK_FROM_QUEUE\t
Response:
TRUE
FALSE
Example:
> SCHEDULAR_DEL_TASK_FROM_QUEUE my collection my subject < TRUE
Restarts a task already present in the download queue
Notation:
SCHEDULAR_RESTART_TASK\t
Response:
TRUE
FALSE
Example:
> SCHEDULAR_RESTART my collection some other subject < FALSE File is not present in the given collection
Saves the download queue. This needs to be done after added new files to the download queue
Notation:
SCHEDULAR_SAVE_QUEUE
Response:
TRUE
FALSE
Example:
> SCHEDULAR_SAVE_QUEUE < TRUE
Returns all the collections and tasks present in the download queue
Notation:
SCHEDULAR_FOREACH_TASK
Response:
COLLECTION\t \t \t \tFILE \t \t \t \t \t \t \t \t \t \t (this list can be returned multiple times) NULL
Possible status'es:
WAITING_FOR_DOWNLOAD DOWNLOADING WAITING_FOR_DECODE DECODING FINISHED_COMPLETE FINISHED_INCOMPLETE FINISHED_NO_PARTS_AVAIL SKIPPED
Example:
> 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 < NULL
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_TASK\t \t \t
Response:
TRUE
FALSE
Example, change the position of a task within the same collection:
> SCHEDULAR_MOVE_TASK my collection my subject my collection 5 < TRUE
Example, move the task to another collection
> SCHEDULAR_MOVE_TASK my collection my subject another collection -1 < FALSE
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_COLLECTION\t
Response:
TRUE
FALSE
Example
> SCHEDULAR_MOVE_COLLECTION my collection -1 < TRUE
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.
Something in the configuration has changed
CONFIG_CHANGED
The download of a part has just started
PART_DOWNLOAD_START\t \t \t \t
The download of a part has completed successfully
PART_DONE\t \t \t \t \t
The download of a part has failed (probably because the part isn't available on the server
PART_FAILED\t \t \t \t \t \t
Every second, traffic statistics about the last 10 seconds are given
TRAFFIC_MONITOR_UPDATE\t \t \t \t \t \t \t \t \t \t \t
Every 10KB of a part download, this message will be sent
PART_PROGRESS_UPDATE\t \t \t \t \t
A new collection was added
COLLECTION_ADDED\t
A collection was removed
COLLECTION_REMOVED
The poster of a collection was modified
COLLECTION_MODIFIED\t
A file was added to a already existing collection. The
FILE_ADDED\t \t \t \t \t \t \t
A file was removed from the download queue
FILE_REMOVED\t \t \t
The state of a file in the download queue has changed
FILE_DOWNLOAD_STATE_UPDATE\t \t \t \t \t \t t\t \t
A file in the download queue was restarted
FILE_STATE_CHANGED\t \t \t \t
A new connection is being made to a usenet server
CONNECTION_CONNECTING\t
A connection attempt has succeeded
CONNECTION_CONNECTED\t \t
A connection to a usenet server was disconnected
CONNECTION_DISCONNECT\t \t \t
disconnect_type can be any of the following values:
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 UNEXPECTED
The state of the schedular has changed
SCHEDULAR_STATE_CHANGED\t
A fatal error has occured
FATAL_ERROR
A warning has occured
WARNING_MESSAGE
A debug message has been emitted
DEBUG_MESSAGE
The position of a task in the download queue has changed
TASK_MOVED\t \t \t \t
The position of a collection in the download queue has changed
COLLECTION_MOVED\t \t
The PAR2 repair component has emit a message which can be shown to the user
PAR2_REPAIR_MESSAGE
This message is emit when all the items in the download queue are completed
ALL_DOWNLOADS_COMPLETED
The unpack component has made some progress
UNPACK_PROGRESS_UPDATE\t \t
The unpack component has emit a message. This message mostly is the file which is currently extracted
UNPACK_MESSAGE_RECEIVED\t \t
The unpack component is now unpacking from a new archive file
UNPACK_WORKING_ARCHIVE_CHANGED\t \t
A PAR2 verification (and if necessary repair) has just started
PAR2_BEGIN_VERIFY\t
A file is now being verified
PAR2_LOAD_PROGRESS_UPDATE\t \t \t
A PAR2 recovery file has been loaded completely
PAR2_RECOVERY_FILE_LOADED\t \t \t \t
A regular file has been loaded completely
PAR2_FILE_LOADED\t \t \t \t \t
The field state can be one of the following values:
MISSING FOUND DAMAGED NO_NEW_BLOCKS_FOUND
A PAR2 repair is now going on
PAR2_REPAIR_PROGRESS_UPDATE\t \t
The PAR2 repair has failed because there aren't enough recovery blocks available
PAR2_REPAIR_FAILURE\t \t
The PAR2 repair has completed successfully
PAR2_REPAIR_SUCCESS\t
All the files in the PAR2 set have been verified and no repair is necessary
PAR2_NO_REPAIR_REQUIRED\t