---
name: "NJB_Send_Track"
section: "3"
platform: "linux"
package: "libnjb1-doc"
version: "1.1-2"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/NJB_Send_Track"
---

# NJB\_Send\_Track(3)

transfer a music track to the jukebox

## NAME

NJB\_Send\_Track - transfer a music track to the jukebox

## LIBRARY

libnjb

## SYNOPSIS

\#include \<sys/types.h\> #include \<libnjb.h\>

extern int njb\_error

int NJB\_Send\_Track (njb\_t  **\*njb**, const char **\*path**, const char **\*codec**, const char **\*title**, const char **\*album**, const char **\*genre**, const char **\*artist**, u\_int32\_t **length**, u\_int32\_t **tracknum**, const char **\*year**, int **protected**, XferCallback **\*callback**, void **\*data**, u\_int32\_t **\*trackid**)

## DESCRIPTION

This function downloads the music file at **path** to the NJB.  The  **codec** parameter is required, and cannot be NULL, since it tells the NJB what audio format the song track is stored in.  The  **title**,  **album**,  **genre**,  **artist**,  **length ,**  **tracknum ,**  **year**,  and **protected** parameters are optional, and can be NULL (pointers) or 0 (integers).   However, as the NJB organizes tracks by artist, album, title and genre, is is strongly recommended that these parameters be provided.  If **title** is NULL, then the title will be substituted with the file name when transferred.

After the track is sucessfully transferred, the  **trackid** variable is updated with the ID that was assigned by the NJB.  This  allows the calling program to update any local file caches.

The  **callback** parameter is a pointed to a callback function, as described in [**NJB\_Get\_Track**(3)](/NJB_Get_Track/3.md).

The  **data** parameter is a pointer to user data of any kind that the user of the library wants to associate with this transfer. This pointer is used for example when accessing several different jukeboxes from withing one program. The XferCallback will also be delivering this pointer to the target routine for dereferencing. If this parameter is not used (in for example single-device, single-threaded programs) it may be set to **NULL.**

(On the NJB1, this function increments the NJB's library counter,  provided it has not been incremented previously during the session.)

## RETURN VALUES

If the transfer is successful, NJB\_Send\_Track returns 0.  Otherwise, -1 is returned and  **njb\_error** is set.

- EO\_ABORTED

  The transfer was aborted by the user (the callback function returned -1).

- EO\_BADCOUNT

  The library counter on the NJB could not be updated.  The track transfer was successful.

- EO\_BADDATA

  **songtag** contains invalid data or is not properly formed.

- EO\_BADSTATUS

  A non-zero status was returned by the NJB during the file transfer.

- EO\_INVALID

  A required parameter was NULL.

- EO\_NOMEM

  There was not enough memory to allocate the file transfer buffer.

- EO\_NOMEM

  There was not enough memory to create the "tag" for the audio track.

- EO\_RDSHORT

  The NJB sent fewer bytes than expected on the bulk data pipe.

- EO\_TIMEOUT

  The NJB did not verify that the transfer was complete after several queries.  The track may have still have been transferred successfully.

- EO\_TOOBIG

  There is not enough free disk space on the NJB to hold the track.

- EO\_USBBLK

  An I/O error occurred on the bulk data pipe.

- EO\_USBCTL

  An I/O error occurred on the control pipe.

- EO\_WRSHORT

  Fewer bytes than requested were written to the USB pipe.

- EO\_XFERDENIED

  Could not determie the available disk space on the NJB.

- EO\_XFERERROR

  The NJB returned a non-zero status when the tag for the track was transferred.

## SEE ALSO

[NJB\_Get\_Track(3)](/NJB_Get_Track/3.md), [NJB\_Replace\_Track\_Tag(3)](/NJB_Replace_Track_Tag/3.md), [songid(3)](/songid/3.md), [XferCallback(3)](/XferCallback/3.md)
