RB.TransferTarget

g GObject.GInterface GObject.GInterface RB.TransferTarget RB.TransferTarget GObject.GInterface->RB.TransferTarget

Implementations:

None

Methods

build_dest_uri (entry, media_type, extension)

check_category (entry)

check_duplicate (entry)

get_format_descriptions ()

should_transfer (entry)

track_add_error (entry, uri, error)

track_added (entry, uri, filesize, media_type)

track_prepare (entry, uri)

track_upload (entry, uri, dest_size, media_type)

transfer (settings, entries, defer)

Virtual Methods

do_build_dest_uri (entry, media_type, extension)

do_should_transfer (entry)

do_track_add_error (entry, uri, error)

do_track_added (entry, uri, dest_size, media_type)

do_track_prepare (entry, uri)

do_track_upload (entry, uri, dest_size, media_type)

Properties

Name

Type

Flags

Short Description

encoding-target

GstPbutils.EncodingTarget

r/w

GstPbutils.EncodingTarget

Signals

None

Fields

None

Class Details

class RB.TransferTarget
Bases:

GObject.GInterface

Structure:

RB.TransferTargetInterface

build_dest_uri(entry, media_type, extension)
Parameters:
Returns:

constructed URI

Return type:

str

Constructs a URI to use as the destination for a transfer or transcoding operation. The URI may be on the device itself, if the device is mounted into the normal filesystem or through gvfs, or it may be a temporary location used to store the file before uploading it to the device.

The destination URI should conform to the device’s normal URI format, and should use the provided extension instead of the extension from the source entry.

check_category(entry)
Parameters:

entry (RB.RhythmDBEntry) – a RB.RhythmDBEntry to check

Returns:

True if the entry is in a suitable category

Return type:

bool

This checks that the entry type of entry is in a suitable category for transfer. This can be used to implement should_transfer.

check_duplicate(entry)
Parameters:

entry (RB.RhythmDBEntry) – a RB.RhythmDBEntry to check

Returns:

True if the entry already exists on the target.

Return type:

bool

This checks for an existing entry in the target that matches the title, album, artist, and track number of the entry being considered. This can be used to implement should_transfer.

get_format_descriptions()
Returns:

list of descriptions.

Return type:

[str]

Returns a GLib.List of allocated media format descriptions for the formats supported by the target. The list and the strings it holds must be freed by the caller.

should_transfer(entry)
Parameters:

entry (RB.RhythmDBEntry) – a RB.RhythmDBEntry to consider transferring

Returns:

True if the entry should be transferred to the target

Return type:

bool

Checks whether entry should be transferred to the target. The target can check whether a matching entry already exists on the device, for instance. rb_transfer_target_check_duplicate may form part of an implementation. If this method returns False, the entry will be skipped.

track_add_error(entry, uri, error)
Parameters:

This is called when a transfer fails. If the source’s impl_track_add_error implementation returns True, an error dialog will be displayed to the user containing the error message, unless the error indicates that the destination file already exists.

track_added(entry, uri, filesize, media_type)
Parameters:
  • entry (RB.RhythmDBEntry) – the source RB.RhythmDBEntry for the transfer

  • uri (str) – the destination URI

  • filesize (int) – size of the destination file

  • media_type (str) – media type of the destination file

This is called when a transfer to the target has completed. If the source’s track_added method returns True, the destination URI will be added to the database using the entry type for the device.

If the target uses a temporary area as the destination for transfers, it can instead upload the destination file to the device and create an entry for it, then return False.

track_prepare(entry, uri)
Parameters:
Raises:

GLib.Error

Performs any preparation necessary before starting the transfer. This is called on a task thread, so no UI interaction is possible.

track_upload(entry, uri, dest_size, media_type)
Parameters:
  • entry (RB.RhythmDBEntry) – the source RB.RhythmDBEntry for the transfer

  • uri (str) – the destination URI

  • dest_size (int) – the size of the destination file

  • media_type (str) – the media type of the destination file

Raises:

GLib.Error

This is called after a transfer to a temporary file has finished, allowing the transfer target to upload the file to a device or a remote service.

transfer(settings, entries, defer)
Parameters:
Returns:

an RB.TrackTransferBatch, or None

Return type:

RB.TrackTransferBatch

Starts tranferring entries to the target. This returns the RB.TrackTransferBatch that it starts, so the caller can track the progress of the transfer, or None if the target doesn’t want any of the entries.

do_build_dest_uri(entry, media_type, extension) virtual
Parameters:
Returns:

constructed URI

Return type:

str

Constructs a URI to use as the destination for a transfer or transcoding operation. The URI may be on the device itself, if the device is mounted into the normal filesystem or through gvfs, or it may be a temporary location used to store the file before uploading it to the device.

The destination URI should conform to the device’s normal URI format, and should use the provided extension instead of the extension from the source entry.

do_should_transfer(entry) virtual
Parameters:

entry (RB.RhythmDBEntry) – a RB.RhythmDBEntry to consider transferring

Returns:

True if the entry should be transferred to the target

Return type:

bool

Checks whether entry should be transferred to the target. The target can check whether a matching entry already exists on the device, for instance. rb_transfer_target_check_duplicate may form part of an implementation. If this method returns False, the entry will be skipped.

do_track_add_error(entry, uri, error) virtual
Parameters:
Return type:

bool

do_track_added(entry, uri, dest_size, media_type) virtual
Parameters:
Return type:

bool

do_track_prepare(entry, uri) virtual
Parameters:

Performs any preparation necessary before starting the transfer. This is called on a task thread, so no UI interaction is possible.

do_track_upload(entry, uri, dest_size, media_type) virtual
Parameters:
  • entry (RB.RhythmDBEntry) – the source RB.RhythmDBEntry for the transfer

  • uri (str) – the destination URI

  • dest_size (int) – the size of the destination file

  • media_type (str) – the media type of the destination file

This is called after a transfer to a temporary file has finished, allowing the transfer target to upload the file to a device or a remote service.

Property Details

RB.TransferTarget.props.encoding_target
Name:

encoding-target

Type:

GstPbutils.EncodingTarget

Default Value:

None

Flags:

READABLE, WRITABLE

GstPbutils.EncodingTarget