Difference between revisions of "Truxton media create"
Jump to navigation
Jump to search
| (6 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
This creates a media object. | This creates a media object. | ||
| − | You can use this to add to the <code>Media</code> table in the database. | + | You can use this to add to the <code><nowiki>[</nowiki>[[Media Table|Media]]<nowiki>]</nowiki></code> table in the database. |
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="C"> |
| − | uint64_t truxton_media_create(uint64_t truxton_handle); | + | uint64_t truxton_media_create( uint64_t truxton_handle ); |
| − | </ | + | </source> |
=Parameters= | =Parameters= | ||
| Line 16: | Line 16: | ||
=Sample= | =Sample= | ||
| − | < | + | <source lang="C" highlight="5"> |
| − | void create_media(void) | + | void create_media( void ) |
{ | { | ||
uint64_t truxton = truxton_create(); | uint64_t truxton = truxton_create(); | ||
| − | uint64_t media = truxton_media_create(truxton); | + | uint64_t media = truxton_media_create( truxton ); |
truxton_media_set_name( media, "Ducky Momo Server" ); | truxton_media_set_name( media, "Ducky Momo Server" ); | ||
truxton_media_set_description( media, "Original plans for I Hate People plate" ); | truxton_media_set_description( media, "Original plans for I Hate People plate" ); | ||
truxton_media_set_case_number( media, "PNF-S02E30"); | truxton_media_set_case_number( media, "PNF-S02E30"); | ||
| − | truxton_media_set_originator( media, " | + | truxton_media_set_originator( media, "Povenmire and Marsh" ); |
truxton_media_set_evidence_bag( media, "EVINC-20100709" ); | truxton_media_set_evidence_bag( media, "EVINC-20100709" ); | ||
truxton_media_set_type( media, MEDIA_TYPE_HARD_DISK_IMAGE ); | truxton_media_set_type( media, MEDIA_TYPE_HARD_DISK_IMAGE ); | ||
| Line 41: | Line 41: | ||
printf( "Media ID is %s\n", id ); | printf( "Media ID is %s\n", id ); | ||
| − | truxton_media_destroy(media); | + | truxton_media_destroy( media ); |
| − | truxton_destroy(truxton); | + | truxton_destroy( truxton ); |
} | } | ||
| − | </ | + | </source> |
=Remarks= | =Remarks= | ||
The default behavior of this API is to: | The default behavior of this API is to: | ||
| − | * Generate an [[truxton_media_set_id|identifier]] for the media | + | * Generate an [[truxton_media_set_id|identifier]] for the media. The [[TGUID#Media_ID|media identifier]] is not random. |
* Set the [[truxton_media_set_created|created date]] to the current time | * Set the [[truxton_media_set_created|created date]] to the current time | ||
* Set the [[truxton_media_set_last_updated|last updated date]] to the current time | * Set the [[truxton_media_set_last_updated|last updated date]] to the current time | ||
Latest revision as of 07:40, 3 February 2024
This creates a media object.
You can use this to add to the [Media] table in the database.
Syntax
uint64_t truxton_media_create( uint64_t truxton_handle );
Parameters
truxton_handle
The Truxton instance this media will belong.
This handle comes from calling truxton_create().
Return value
A handle to a media object.
Sample
void create_media( void )
{
uint64_t truxton = truxton_create();
uint64_t media = truxton_media_create( truxton );
truxton_media_set_name( media, "Ducky Momo Server" );
truxton_media_set_description( media, "Original plans for I Hate People plate" );
truxton_media_set_case_number( media, "PNF-S02E30");
truxton_media_set_originator( media, "Povenmire and Marsh" );
truxton_media_set_evidence_bag( media, "EVINC-20100709" );
truxton_media_set_type( media, MEDIA_TYPE_HARD_DISK_IMAGE );
truxton_media_set_size( media, 100 * ONE_GIGABYTE );
truxton_media_set_latitude( media, -17.60978782 );
truxton_media_set_longitude( media, 177.0342855299 );
truxton_media_save( media );
truxton_media_tag( media, "Too Young", "Yes, yes I am", 1 );
char id[ 65 ];
truxton_media_get_id( media, id, sizeof( id ) );
printf( "Media ID is %s\n", id );
truxton_media_destroy( media );
truxton_destroy( truxton );
}
Remarks
The default behavior of this API is to:
- Generate an identifier for the media. The media identifier is not random.
- Set the created date to the current time
- Set the last updated date to the current time
- Set the expiration date set to 99 years from now
- Set the percent complete to 100
- Set the status set to loaded