Truxton update media primary photo by hash

From truxwiki.com
Jump to navigation Jump to search

Sets the photograph of an existing media. This method will search out a file in Truxton with a matching hash and establish a photograph relation between the media and the file.

Syntax

int truxton_update_media_primary_photo_by_hash( uint64_t truxton_handle, char const * media_id, char const * hash );

Parameters

truxton_handle

The Truxton instance that contains this media. This handle comes from calling truxton_create().

media_id

The string representation of the GUID of the media to modify. It should match the value in the [ID] column of a record in the [Media] table.

hash

The hash of an existing file in Truxton. This should be a value from the [HashID] column of the [File] table.

Return value

A non-zero value on success, zero on failure.

Sample

void set_photo( char const * media_id, char const * hash )
{
   uint64_t truxton = truxton_create();

   if ( truxton_update_media_primary_photo_by_hash( truxton, media_id, hash ) == 0 )
   {
      printf( "Cannot update the media photo.\n" );
   }

   truxton_destroy( truxton );
}