Difference between revisions of "Truxton update media primary photo by hash"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "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...")
 
 
Line 14: Line 14:
 
==<code>media_id</code>==
 
==<code>media_id</code>==
 
The string representation of the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the media to modify.
 
The string representation of the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the media to modify.
It should match the value in the <code>[ID]</code> column of a record in the <code>[Media]</code> table.
+
It should match the value in the <code>[ID]</code> column of a record in the <code><nowiki>[</nowiki>[[Media Table|Media]]<nowiki>]</nowiki></code> table.
  
 
==<code>hash</code>==
 
==<code>hash</code>==
 
The hash of an existing file in Truxton.
 
The hash of an existing file in Truxton.
This should be a value from the <code>[HashID]</code> column of the <code>[File]</code>.
+
This should be a value from the <code>[HashID]</code> column of the <code><nowiki>[</nowiki>[[File Table|File]]<nowiki>]</nowiki></code> table.
  
 
=Return value=
 
=Return value=

Latest revision as of 08:37, 3 February 2024

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 );
}