#include #include #include #include #include #include "nntpgrab_utils.h"#include "nntpgrab_types.h"
Functions |
|
| ngboolean | nntpgrab_utils_strip_subject (const char *subject, char **subject_without_partnum, int *file_num, int *total_files, char **filename, char **extension, NNTPFileType *file_type, int *par2_startnum, int *num_par2_blocks, int *part_num, int *total_parts) |
| Strip a subject into useable pieces of data. |
|
| NNTPFileType | nntpgrab_utils_get_file_type_of_filename (const char *filename) |
| Find out the file type of a given filename. |
|
| char * | nntpgrab_utils_calculate_file_size (nguint64 file_size) |
| Transform a file size into a human readable notation. |
|
| int | nntpgrab_utils_calculate_estimated_time_remaining (int bytes_received1, int bytes_received2, int bytes_received3, int bytes_received4, int bytes_received5, int bytes_received6, int bytes_received7, int bytes_received8, int bytes_received9, int bytes_received10, nguint64 file_size) |
| Calculate the estimated time remaining to complete the given file size. |
|
| char * | nntpgrab_utils_get_readable_time_remaining (int estimated_time_remaining) |
| Transform a estimated time remaining into a human readable value for the time remaining. |
|
| char * | nntpgrab_utils_get_readable_finished_time (int estimated_time_remaining) |
| Transform a estimated time remaining into a human readable value for the expected time to finish. |
|
| ngboolean | nntpgrab_utils_get_folder_listing (const char *parent, NGList **folders) |
| Retrieve all the folders which belong to path. |
|
| void | nntpgrab_utils_free_folder_listing (NGList *folders) |
| Free a list of sub-folders. |
|
| void | nntpgrab_utils_sanitize_text (char *text, int length) |
| Check whether the given text contains invalid UTF-8 characters and if they're found, replace them with something more sane. |
|
| void | nntpgrab_utils_sanitize_collection_name (char *collection_name) |
| Remove forbidden characters from the collection name. |
|
| void | nntpgrab_utils_strip_nzb_extension (char *filename) |
| Remove the extension from a filename. |
|
| int nntpgrab_utils_calculate_estimated_time_remaining | ( | int | bytes_received1, | |
| int | bytes_received2, | |||
| int | bytes_received3, | |||
| int | bytes_received4, | |||
| int | bytes_received5, | |||
| int | bytes_received6, | |||
| int | bytes_received7, | |||
| int | bytes_received8, | |||
| int | bytes_received9, | |||
| int | bytes_received10, | |||
| nguint64 | file_size | |||
| ) |
Calculate the estimated time remaining to complete the given file size.
| bytes_received1 | The number of bytes received in now() - 10 | |
| bytes_received2 | The number of bytes received in now() - 9 | |
| bytes_received3 | The number of bytes received in now() - 8 | |
| bytes_received4 | The number of bytes received in now() - 7 | |
| bytes_received5 | The number of bytes received in now() - 6 | |
| bytes_received6 | The number of bytes received in now() - 5 | |
| bytes_received7 | The number of bytes received in now() - 4 | |
| bytes_received8 | The number of bytes received in now() - 3 | |
| bytes_received9 | The number of bytes received in now() - 2 | |
| bytes_received10 | The number of bytes received in now() - 1 | |
| file_size | The file size |
| char* nntpgrab_utils_calculate_file_size | ( | nguint64 | file_size | ) |
Transform a file size into a human readable notation.
| file_size | The file size which needs to be transformed |
| void nntpgrab_utils_free_folder_listing | ( | NGList * | folders | ) |
Free a list of sub-folders.
| folders | A list containing subfolders as returned by the function nntpgrab_config_get_folder_listing() |
| NNTPFileType nntpgrab_utils_get_file_type_of_filename | ( | const char * | filename | ) |
Find out the file type of a given filename.
| filename | The filename whose file type needs to be found out |
| ngboolean nntpgrab_utils_get_folder_listing | ( | const char * | parent, | |
| NGList ** | folders | |||
| ) |
Retrieve all the folders which belong to path.
Retrieves a list containing all the sub-folders which are in the given folder.
| parent | The path whose belonging folders should be looked up. If NULL, all the drive letters will be returned (on Win32) or "/" is returned (*nix/osx) | |
| folders | Return address for a list containing g_slice_new'ed ConfigFolder structures containing the requested info |
| char* nntpgrab_utils_get_readable_finished_time | ( | int | estimated_time_remaining | ) |
Transform a estimated time remaining into a human readable value for the expected time to finish.
| estimated_time_remaining | The estimated time remaining (in seconds) |
| char* nntpgrab_utils_get_readable_time_remaining | ( | int | estimated_time_remaining | ) |
Transform a estimated time remaining into a human readable value for the time remaining.
| estimated_time_remaining | The estimated time remaining (in seconds) |
| void nntpgrab_utils_sanitize_collection_name | ( | char * | collection_name | ) |
Remove forbidden characters from the collection name.
| collection_name | The collection name which need to be sanitized |
| void nntpgrab_utils_sanitize_text | ( | char * | text, | |
| int | length | |||
| ) |
Check whether the given text contains invalid UTF-8 characters and if they're found, replace them with something more sane.
| text | The text which need to be sanitized | |
| length | The length of the text |
| void nntpgrab_utils_strip_nzb_extension | ( | char * | filename | ) |
Remove the extension from a filename.
| filename | The filename whose extension need to be stripped |
| ngboolean nntpgrab_utils_strip_subject | ( | const char * | subject, | |
| char ** | subject_without_partnum, | |||
| int * | file_num, | |||
| int * | total_files, | |||
| char ** | filename, | |||
| char ** | extension, | |||
| NNTPFileType * | file_type, | |||
| int * | par2_startnum, | |||
| int * | num_par2_blocks, | |||
| int * | part_num, | |||
| int * | total_parts | |||
| ) |
Strip a subject into useable pieces of data.
| subject | The subject which need to be stripped | |
| subject_without_partnum | Location for the subject without any part numbers | |
| file_num | Location for the number of the file in the set | |
| total_files | Location for the total number of files in the set | |
| filename | Location for the filename | |
| extension | Location for the extension of the filename (as an string) | |
| file_type | Location for the extension of the filename (as an enumeration) | |
| par2_startnum | Location for the start number of the PAR2 recovery file | |
| num_par2_blocks | Location for the number blocks in the PAR2 recovery file | |
| part_num | Location for the part number for this subject | |
| total_parts | Location for the number of parts for this subject |
All the char* parameters need to be free'd using ng_free()