RB.TransferTarget¶
- Implementations:
None
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Signals¶
None
Fields¶
None
Class Details¶
- class RB.TransferTarget¶
- Bases:
- Structure:
- build_dest_uri(entry, media_type, extension)¶
- Parameters:
entry (
RB.RhythmDBEntry
) – aRB.RhythmDBEntry
being transferredmedia_type (
str
) – destination media typeextension (
str
) – extension associated with destination media type
- Returns:
constructed URI
- Return type:
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
) – aRB.RhythmDBEntry
to check- Returns:
True
if the entry is in a suitable category- Return type:
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
) – aRB.RhythmDBEntry
to check- Returns:
True
if the entry already exists on the target.- Return type:
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
) – aRB.RhythmDBEntry
to consider transferring- Returns:
True
if the entry should be transferred to the target- Return type:
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:
entry (
RB.RhythmDBEntry
) – the sourceRB.RhythmDBEntry
for the transferuri (
str
) – the destination URIerror (
GLib.Error
) – the transfer error information
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 sourceRB.RhythmDBEntry
for the transferuri (
str
) – the destination URIfilesize (
int
) – size of the destination filemedia_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:
entry (
RB.RhythmDBEntry
) – the sourceRB.RhythmDBEntry
for the transferuri (
str
) – the destination URI
- Raises:
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 sourceRB.RhythmDBEntry
for the transferuri (
str
) – the destination URIdest_size (
int
) – the size of the destination filemedia_type (
str
) – the media type of the destination file
- Raises:
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:
settings (
Gio.Settings
) –Gio.Settings
instance holding encoding settingsentries ([
RB.RhythmDBEntry
]) – aGLib.List
of entries to transfer
- Returns:
an
RB.TrackTransferBatch
, orNone
- Return type:
Starts tranferring entries to the target. This returns the
RB.TrackTransferBatch
that it starts, so the caller can track the progress of the transfer, orNone
if the target doesn’t want any of the entries.
- do_build_dest_uri(entry, media_type, extension) virtual¶
- Parameters:
entry (
RB.RhythmDBEntry
) – aRB.RhythmDBEntry
being transferredmedia_type (
str
) – destination media typeextension (
str
) – extension associated with destination media type
- Returns:
constructed URI
- Return type:
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
) – aRB.RhythmDBEntry
to consider transferring- Returns:
True
if the entry should be transferred to the target- Return type:
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:
entry (
RB.RhythmDBEntry
) –uri (
str
) –error (
GLib.Error
) –
- Return type:
- do_track_added(entry, uri, dest_size, media_type) virtual¶
- Parameters:
entry (
RB.RhythmDBEntry
) –uri (
str
) –dest_size (
int
) –media_type (
str
) –
- Return type:
- do_track_prepare(entry, uri) virtual¶
- Parameters:
entry (
RB.RhythmDBEntry
) – the sourceRB.RhythmDBEntry
for the transferuri (
str
) – the destination URI
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 sourceRB.RhythmDBEntry
for the transferuri (
str
) – the destination URIdest_size (
int
) – the size of the destination filemedia_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:
- Default Value:
- Flags: