Functions

builder_boldify_label (builder, name)

builder_load (file, user_data)

builder_load_plugin_file (plugin, file, user_data)

canonicalise_uri (uri)

check_dir_has_space (dir, bytes_needed)

check_dir_has_space_uri (uri, bytes_needed)

combo_box_hyphen_separator_func (model, iter, data)

compare_gtimeval (a, b)

debug_get_args ()

debug_init (debug)

debug_init_match (match)

debug_matches (func, file)

debug_real (func, file, line, newline, message)

debug_stop_in_debugger ()

device_source_uri_is_source (source, uri)

device_source_want_uri (source, uri)

encoder_error_quark ()

encoder_new ()

ext_db_key_create_lookup (field, value)

ext_db_key_create_storage (field, value)

file (filename)

file_chooser_new (title, parent, action, local_only)

file_find_extant_parent (file)

file_helpers_init ()

file_helpers_shutdown ()

file_resolve_symlink (file)

find_plugin_data_file (plugin, name)

find_plugin_resource (plugin, name)

find_user_cache_file (name)

find_user_data_file (name)

gst_add_filter (player, filterbin, element, use_pad_block)

gst_add_tee (player, tee, element, use_pad_block)

gst_caps_to_media_type (caps)

gst_create_filter_bin ()

gst_encoder_set_encoding_style (element, style)

gst_encoding_profile_get_encoder (profile)

gst_encoding_profile_get_encoder_caps (profile)

gst_encoding_profile_get_media_type (profile)

gst_encoding_profile_get_presets (profile)

gst_encoding_profile_get_settings (profile, style)

gst_encoding_profile_set_preset (profile, preset)

gst_error_get_error_code (error)

gst_get_default_encoding_target ()

gst_get_encoding_profile (media_type)

gst_get_missing_plugin_type (structure)

gst_media_type_is_lossless (media_type)

gst_media_type_matches_profile (profile, media_type)

gst_media_type_to_caps (media_type)

gst_media_type_to_extension (media_type)

gst_media_type_to_mime_type (media_type)

gst_mime_type_to_media_type (mime_type)

gst_process_embedded_image (taglist, tag)

gst_process_tag_string (taglist, tag, field, value)

gst_remove_filter (player, filterbin, element, use_pad_block)

gst_remove_tee (player, tee, element, use_pad_block)

is_main_thread ()

locale_dir ()

make_duration_string (duration)

make_elapsed_time_string (elapsed, duration, show_remaining)

make_time_string (seconds)

menu_update_link (menu, link_attr, target)

metadata_error_quark ()

music_dir ()

player_error_quark ()

player_gst_find_element_with_property (element, property)

player_gst_try_audio_sink (plugin_name, name)

player_new (want_crossfade)

podcast_parse_channel_copy (data)

podcast_parse_channel_new ()

podcast_parse_channel_ref (data)

podcast_parse_channel_unref (data)

podcast_parse_error_quark ()

podcast_parse_item_copy (data)

podcast_parse_item_free (data)

refstring_equal (ap, bp)

refstring_find (init)

refstring_hash (p)

refstring_system_init ()

refstring_system_shutdown ()

rhythmbox_get_resource ()

rhythmdb_query_get_type ()

safe_strcmp (a, b)

sanitize_path_for_msdos_filesystem (path)

sanitize_uri_for_filesystem (uri, filesystem)

scale_pixbuf_to_size (pixbuf, size)

search_fold (original)

set_tree_view_column_fixed_width (treeview, column, renderer, strings, padding)

settings_delayed_sync (settings, sync_func, *data)

shell_error_quark ()

shell_player_error_quark ()

stock_icons_init ()

stock_icons_shutdown ()

string_split_words (string)

uri_append_path (uri, path)

uri_append_uri (uri, fragment)

uri_could_be_podcast (uri, is_opml)

uri_create_parent_dirs (uri)

uri_exists (uri)

uri_get_dir_name (uri)

uri_get_filesystem_type (uri, mount_point)

uri_get_mount_point (uri)

uri_get_short_path_name (uri)

uri_handle_recursively (uri, cancel, func, *user_data)

uri_handle_recursively_async (uri, cancel, func, *user_data)

uri_is_descendant (uri, ancestor)

uri_is_directory (uri)

uri_is_hidden (uri)

uri_is_local (uri)

uri_is_readable (uri)

uri_is_writable (uri)

uri_list_parse (uri_list)

uri_make_hidden (uri)

uri_mkstemp (prefix, uri_ret, stream)

uri_resolve_symlink (uri)

user_cache_dir ()

user_data_dir ()

Details

RB.builder_boldify_label(builder, name)
Parameters:

Makes a label built from a Gtk.Builder file bold.

RB.builder_load(file, user_data)
Parameters:
  • file (str) – filename, either absolute or relative to the data directory

  • user_data (object or None) – user data to pass to autoconnected signal handlers

Returns:

Gtk.Builder object built from the file

Return type:

Gtk.Builder

Locates and reads a Gtk.Builder file, automatically connecting signal handlers where possible.

The caller can specify an absolute path to the file, a resource path starting with /org/gnome/Rhythmbox/ or just a filename. The file will be loaded from GResources.

RB.builder_load_plugin_file(plugin, file, user_data)
Parameters:
  • plugin (GObject.Object) – #RBPlugin instance

  • file (str) – name of file to load

  • user_data (object or None) – user data to pass to autoconnected signal handlers

Returns:

Gtk.Builder object built from the file

Return type:

Gtk.Builder

Like RB.builder_load, except it finds files associated with plugins as well as those in the core data directories.

RB.canonicalise_uri(uri)
Parameters:

uri (str) – URI to canonicalise

Returns:

canonical URI, must be freed by caller

Return type:

str

Converts uri to canonical URI form, ensuring it doesn’t contain any redundant directory fragments or unnecessarily escaped characters. All URIs passed to RB.RhythmDB functions should be canonicalised.

RB.check_dir_has_space(dir, bytes_needed)
Parameters:
Returns:

True if enough space is available.

Return type:

bool

Checks that the filesystem holding file has at least bytes_needed bytes available.

RB.check_dir_has_space_uri(uri, bytes_needed)
Parameters:
  • uri (str) – a URI to check

  • bytes_needed (int) – number of bytes to check for

Returns:

True if enough space is available.

Return type:

bool

Checks that the filesystem holding uri has at least bytes_needed bytes available.

RB.combo_box_hyphen_separator_func(model, iter, data)
Parameters:
Returns:

True if the row pointed to by iter is a separator

Return type:

bool

A row separator function to use for Gtk.ComboBox widgets. It expects the model to contain a string in its first column, and interprets a string containing a single hyphen character as a separator.

RB.compare_gtimeval(a, b)
Parameters:
Returns:

-1 if a < b, 0 if a == b, 1 if a > b

Return type:

int

Compares two GLib.TimeVal structures for sorting.

RB.debug_get_args()
Returns:

debug output arguments, must be freed with GLib.strfreev()

Return type:

[str]

Constructs arguments to pass to another process using this debug output code that will produce the same debug output settings.

RB.debug_init(debug)
Parameters:

debug (bool) – if True, enable all debug output

Sets up debug output, with either all debug enabled or none.

RB.debug_init_match(match)
Parameters:

match (str) – string to match functions and filenames against

Sets up debug output, enabling debug output from file and function names that contain the specified match string.

Also sets up a GLib log handler that will trigger a debugger break for critical or warning level output if any debug output at all is enabled.

RB.debug_matches(func, file)
Parameters:
  • func (str) – function to check

  • file (str) – filename to check

Returns:

True if matched

Return type:

bool

Checks if file or func matches the current debug output settings.

RB.debug_real(func, file, line, newline, message)
Parameters:
  • func (str) – function name

  • file (str) – file name

  • line (int) – line number

  • newline (bool) – if True, add a newline to the output

  • message (str) – the debug message

If the debug output settings match the function or file names, the debug message will be formatted and written to standard error.

RB.debug_stop_in_debugger()

Raises a SIGINT signal to get the attention of the debugger. When not running under the debugger, we don’t want to stop, so we ignore the signal for just the moment that we raise it.

RB.device_source_uri_is_source(source, uri)
Parameters:
Returns:

True if uri matches source

Return type:

bool

Returns True if uri matches source. This should be used to implement the uri_is_source RB.Source method.

RB.device_source_want_uri(source, uri)
Parameters:
Returns:

URI match strength

Return type:

int

Checks whether uri identifies a path underneath the device’s mount point. Should be used to implement the RB.Source want_uri method.

RB.encoder_error_quark()
Return type:

int

RB.encoder_new()
Returns:

the new RB.Encoder

Return type:

RB.Encoder

Creates a new RB.Encoder instance.

RB.ext_db_key_create_lookup(field, value)
Parameters:
  • field (str) – required field name

  • value (str) – value for field

Returns:

the new key

Return type:

RB.ExtDBKey

Creates a new metadata lookup key with a single field. Use rb_ext_db_key_add_field to add more.

RB.ext_db_key_create_storage(field, value)
Parameters:
  • field (str) – required field name

  • value (str) – value for field

Returns:

the new key

Return type:

RB.ExtDBKey

Creates a new metadata storage key with a single field. Use rb_ext_db_key_add_field to add more.

RB.file(filename)
Parameters:

filename (str) – name of file to search for

Returns:

Full file name, if found. Must not be freed.

Return type:

str

Searches for an installed file, returning the full path name if found, None otherwise.

RB.file_chooser_new(title, parent, action, local_only)
Parameters:
Returns:

the file chooser Gtk.Widget

Return type:

Gtk.Widget

Creates and shows a regular gtk+ file chooser dialog with a given title. The user’s music directory (typically ~/Music) is added as a shortcut.

For consistency, this should be used anywhere a file chooser is required.

After creating the dialog, the caller should connect a handler to its ‘response’ signal to process the user’s selected files or folders.

RB.file_find_extant_parent(file)
Parameters:

file (Gio.File) – a Gio.File to find an extant ancestor of

Returns:

Gio.File for the nearest extant ancestor

Return type:

Gio.File

Walks up the filesystem hierarchy to find a Gio.File representing the nearest extant ancestor of the specified file, which may be the file itself if it exists.

RB.file_helpers_init()

Sets up file search paths for rb_file. Must be called on startup.

RB.file_helpers_shutdown()

Frees various data allocated by file helper functions. Should be called on shutdown.

Parameters:

file (Gio.File) – the file to process

Raises:

GLib.Error

Returns:

a Gio.File representing the canonical location, or None on error

Return type:

Gio.File

Attempts to resolve symlinks leading to file and return a canonical location.

RB.find_plugin_data_file(plugin, name)
Parameters:
  • plugin (GObject.Object) – the plugin object

  • name (str) – name of the file to find

Returns:

allocated string containing the location of the file

Return type:

str

Locates a file under the plugin’s data directory.

RB.find_plugin_resource(plugin, name)
Parameters:
  • plugin (GObject.Object) – the plugin object

  • name (str) – name of the file to find

Returns:

allocated string containing the resource path

Return type:

str

Constructs a resource path for a plugin data file.

RB.find_user_cache_file(name)
Parameters:

name (str) – name of file to find

Returns:

allocated string containing the location of the file to use, even if an error occurred.

Return type:

str

Determines the full path to use for user-specific cached files within the user cache directory.

RB.find_user_data_file(name)
Parameters:

name (str) – name of file to find

Returns:

allocated string containing the location of the file to use, even if an error occurred.

Return type:

str

Determines the full path to use for user-specific files, such as rhythmdb.xml, within the user data directory (see rb_user_data_dir).

RB.gst_add_filter(player, filterbin, element, use_pad_block)
Parameters:
  • player (RB.Player) – player object (must implement RBPlayerGstFilter interface)

  • filterbin (Gst.Element) – the filter bin

  • element (Gst.Element) – the filter to add

  • use_pad_block (bool) – if True, block the src pad connected to the filter bin

Return type:

bool

Inserts a filter into the filter bin, using pad blocking (if requested) to avoid breaking the data flow. Pad blocking should be used when the pipeline is in PLAYING state, or when in PAUSED state where a streaming thread will be holding the stream lock for the filter bin.

RB.gst_add_tee(player, tee, element, use_pad_block)
Parameters:
  • player (RB.Player) – player object (must implement RBPlayerGstTee interface)

  • tee (Gst.Element) – a tee element

  • element (Gst.Element) – the tee branch to add

  • use_pad_block (bool) – if True, block the src pad connected to the filter bin

Return type:

bool

Attaches a branch to the tee, using pad blocking (if requested) to avoid breaking the data flow. Pad blocking should be used when the pipeline is in PLAYING state, or when in PAUSED state where a streaming thread will be holding the stream lock for the filter bin.

RB.gst_caps_to_media_type(caps)
Parameters:

caps (Gst.Caps) –

Return type:

str

RB.gst_create_filter_bin()
Returns:

filter bin

Return type:

Gst.Element

Creates an initial bin to use for dynamically plugging filter elements into the pipeline.

RB.gst_encoder_set_encoding_style(element, style)
Parameters:
Return type:

bool

RB.gst_encoding_profile_get_encoder(profile)
Parameters:

profile (GstPbutils.EncodingProfile) – a GstPbutils.EncodingProfile

Returns:

an encoder element instance

Return type:

Gst.Element

RB.gst_encoding_profile_get_encoder_caps(profile)
Parameters:

profile (GstPbutils.EncodingProfile) – a GstPbutils.EncodingProfile

Returns:

output caps for the encoder

Return type:

Gst.Caps

RB.gst_encoding_profile_get_media_type(profile)
Parameters:

profile (GstPbutils.EncodingProfile) –

Return type:

str

RB.gst_encoding_profile_get_presets(profile)
Parameters:

profile (GstPbutils.EncodingProfile) – profile to return presets for

Returns:

preset names

Return type:

[int]

RB.gst_encoding_profile_get_settings(profile, style)
Parameters:
Returns:

list of settings

Return type:

[str]

Returns a list of settings for the profile profile that can usefully be exposed to a user. This usually means just bitrate/quality settings. This works by finding the name of the encoder element for the profile and retrieving a list specific to that encoder.

RB.gst_encoding_profile_set_preset(profile, preset)
Parameters:

Applies the preset preset to the audio encoding profile within profile.

RB.gst_error_get_error_code(error)
Parameters:

error (GLib.Error) – error received from GStreamer

Returns:

the RB.PlayerError value to use

Return type:

int

Maps a GStreamer error to an RB.PlayerError error code.

RB.gst_get_default_encoding_target()
Returns:

default encoding target

Return type:

GstPbutils.EncodingTarget

RB.gst_get_encoding_profile(media_type)
Parameters:

media_type (str) – media type to get a profile for

Returns:

encoding profile

Return type:

GstPbutils.EncodingProfile

RB.gst_get_missing_plugin_type(structure)
Parameters:

structure (Gst.Structure) –

Return type:

RB.GstMediaType

RB.gst_media_type_is_lossless(media_type)
Parameters:

media_type (str) –

Return type:

bool

RB.gst_media_type_matches_profile(profile, media_type)
Parameters:
Return type:

bool

RB.gst_media_type_to_caps(media_type)
Parameters:

media_type (str) –

Return type:

Gst.Caps

RB.gst_media_type_to_extension(media_type)
Parameters:

media_type (str) –

Return type:

str

RB.gst_media_type_to_mime_type(media_type)
Parameters:

media_type (str) –

Return type:

str

RB.gst_mime_type_to_media_type(mime_type)
Parameters:

mime_type (str) –

Return type:

str

RB.gst_process_embedded_image(taglist, tag)
Parameters:
Returns:

a GdkPixbuf.Pixbuf, or None.

Return type:

GdkPixbuf.Pixbuf

Converts embedded image data extracted from a tag list into a GdkPixbuf.Pixbuf. The returned GdkPixbuf.Pixbuf is owned by the caller.

RB.gst_process_tag_string(taglist, tag, field, value)
Parameters:
Returns:

True if the tag was successfully converted.

Return type:

bool

Processes a tag string, determining the metadata field identifier corresponding to the tag name, and converting the tag data into the appropriate value type.

RB.gst_remove_filter(player, filterbin, element, use_pad_block)
Parameters:
  • player (RB.Player) – player object (must implement RBPlayerGstFilter interface)

  • filterbin (Gst.Element) – the filter bin

  • element (Gst.Element) – the filter to remove

  • use_pad_block (bool) – if True, block the src pad connected to the filter bin

Return type:

bool

Removes a filter from the filter bin, using pad blocking (if requested) to avoid breaking the data flow. Pad blocking should be used when the pipeline is in PLAYING state, or when in PAUSED state where a streaming thread will be holding the stream lock for the filter bin.

RB.gst_remove_tee(player, tee, element, use_pad_block)
Parameters:
  • player (RB.Player) – player object (must implement RBPlayerGstTee interface)

  • tee (Gst.Element) – a tee element

  • element (Gst.Element) – the tee branch to remove

  • use_pad_block (bool) – if True, block the src pad connected to the filter bin

Return type:

bool

Removes a branch from the tee, using pad blocking (if requested) to avoid breaking the data flow. Pad blocking should be used when the pipeline is in PLAYING state, or when in PAUSED state where a streaming thread will be holding the stream lock for the filter bin.

RB.is_main_thread()
Returns:

True if on the main thread

Return type:

bool

Checks if currently executing on the main thread.

RB.locale_dir()
Returns:

locale dir

Return type:

str

Returns the locale directory identified at build configuration time.

RB.make_duration_string(duration)
Parameters:

duration (int) – duration in seconds

Returns:

duration string

Return type:

str

Constructs a string describing the specified duration. The string describes hours, minutes, and seconds, and its format is localised.

RB.make_elapsed_time_string(elapsed, duration, show_remaining)
Parameters:
  • elapsed (int) – elapsed time (in seconds)

  • duration (int) – duration (in seconds)

  • show_remaining (bool) – if True, show the remaining time, otherwise show elapsed time

Returns:

elapsed/remaining time string

Return type:

str

Constructs a string describing a playback position. The string describes hours, minutes, and seconds, and its format is localised. The string can describe either the elapsed time or the time remaining.

RB.make_time_string(seconds)
Parameters:

seconds (int) – time in seconds

Returns:

time string

Return type:

str

Constructs a string describing the specified time.

Parameters:
  • menu (Gio.Menu) – menu to update

  • link_attr (str) – attribute indicating the menu link to update

  • target (Gio.MenuModel) – new menu link target

Updates a submenu link to point to the specified target menu.

RB.metadata_error_quark()
Return type:

int

RB.music_dir()
Returns:

user’s music directory. must not be freed.

Return type:

str

Returns the default directory for the user’s music library. This will usually be the ‘Music’ directory under the home directory.

RB.player_error_quark()
Return type:

int

RB.player_gst_find_element_with_property(element, property)
Parameters:
  • element (Gst.Element) – element to search

  • property (str) – name of property to search for

Returns:

element instance, or None if not found

Return type:

Gst.Element

Finds an element inside element that has a property with the specified name.

RB.player_gst_try_audio_sink(plugin_name, name)
Parameters:
  • plugin_name (str) – audio sink plugin name

  • name (str) – name to give to the element

Returns:

element instance, or None

Return type:

Gst.Element

Creates and tests an instance of the specified audio sink.

RB.player_new(want_crossfade)
Parameters:

want_crossfade (bool) – if True, try to use a backend that supports crossfading and other track transitions.

Raises:

GLib.Error

Returns:

new player object.

Return type:

RB.Player

Creates a new player object.

RB.podcast_parse_channel_copy(data)
Parameters:

data (RB.PodcastChannel) –

Return type:

RB.PodcastChannel

RB.podcast_parse_channel_new()
Return type:

RB.PodcastChannel

RB.podcast_parse_channel_ref(data)
Parameters:

data (RB.PodcastChannel) –

Return type:

RB.PodcastChannel

RB.podcast_parse_channel_unref(data)
Parameters:

data (RB.PodcastChannel) –

RB.podcast_parse_error_quark()
Return type:

int

RB.podcast_parse_item_copy(data)
Parameters:

data (RB.PodcastItem) –

Return type:

RB.PodcastItem

RB.podcast_parse_item_free(data)
Parameters:

data (RB.PodcastItem) –

RB.refstring_equal(ap, bp)
Parameters:
Returns:

True if the strings are the same

Return type:

bool

Key equality function suitable for use with GLib.HashTable. Equality checks for RB.RefString are just pointer comparisons, since there can only be one refstring for a given string.

RB.refstring_find(init)
Parameters:

init (str) – string to find

Returns:

existing RB.RefString, or None

Return type:

RB.RefString

Returns an existing RB.RefString for init if one exists, otherwise returns None. If an existing refstring is found, its reference count is increased.

RB.refstring_hash(p)
Parameters:

p (object or None) – an RB.RefString

Returns:

hash value for the string underlying p

Return type:

int

Hash function suitable for use with GHashTable.

RB.refstring_system_init()

Sets up the refstring system. Called on startup.

RB.refstring_system_shutdown()

Frees all data associated with the refstring system. Only called on shutdown.

RB.rhythmbox_get_resource()
Return type:

Gio.Resource

RB.rhythmdb_query_get_type()
Return type:

GObject.GType

RB.safe_strcmp(a, b)
Parameters:
Return type:

int

RB.sanitize_path_for_msdos_filesystem(path)
Parameters:

path (str) – a path segment to sanitize (modified in place)

Modifies path such that it represents a legal path for MS DOS filesystems. Note that it replaces forward slash characters, so it’s only appropriate for use with individual path segments rather than entire paths.

RB.sanitize_uri_for_filesystem(uri, filesystem)
Parameters:
  • uri (str) – a URI to sanitize

  • filesystem (str or None) – a specific filesystem to sanitize for

Returns:

sanitized copy of uri, must be freed by caller.

Return type:

str

Removes characters from uri that are not allowed by the filesystem on which it would be stored, or a specific type of filesystem if specified. At present, this only supports MS DOS filesystems.

RB.scale_pixbuf_to_size(pixbuf, size)
Parameters:
Returns:

scaled GdkPixbuf.Pixbuf

Return type:

GdkPixbuf.Pixbuf

Creates a new GdkPixbuf.Pixbuf from the original one, for a target of size, respecting the aspect ratio of the image.

RB.search_fold(original)
Parameters:

original (str) – the string to fold

Returns:

case-folded string

Return type:

str

Returns a case-folded and punctuation-stripped version of original, useful for performing text searches.

RB.set_tree_view_column_fixed_width(treeview, column, renderer, strings, padding)
Parameters:

Sets a fixed size for a tree view column based on a set of strings to be displayed in the column.

RB.settings_delayed_sync(settings, sync_func, *data)
Parameters:

Synchronizes settings in the settings instance after 500ms has elapsed with no further changes.

RB.shell_error_quark()
Returns:

shell error #GQuark

Return type:

int

Returns the #GQuark used for RB.Shell errors

RB.shell_player_error_quark()
Return type:

int

RB.stock_icons_init()

Initializes the stock icons, adding the necessary filesystem locations to the GTK icon search path. Must be called on startup.

RB.stock_icons_shutdown()

If anything was necessary to clean up the stock icons, this function would do it. Doesn’t do anything, but should be called on shutdown anyway.

RB.string_split_words(string)
Parameters:

string (str) – the string to split

Returns:

None-terminated array of strings

Return type:

[str]

Splits string on word boundaries using Unicode character definitions.

RB.uri_append_path(uri, path)
Parameters:
  • uri (str) – the URI to append to

  • path (str) – the path fragment to append

Returns:

new URI, must be freed by caller

Return type:

str

Creates a new URI consisting of path appended to uri.

RB.uri_append_uri(uri, fragment)
Parameters:
  • uri (str) – the URI to append to

  • fragment (str) – the URI fragment to append

Returns:

new URI, must be freed by caller

Return type:

str

Creates a new URI consisting of fragment appended to uri. Generally isn’t a good idea.

RB.uri_could_be_podcast(uri, is_opml)
Parameters:
  • uri (str) – a URI to check

  • is_opml (bool) – returns whether the URI identifies an OPML document

Returns:

True if uri may be a podcast

Return type:

bool

Checks if uri identifies a resource that is probably a podcast (RSS or Atom feed). This does not perform any IO, it just guesses based on the URI itself.

RB.uri_create_parent_dirs(uri)
Parameters:

uri (str) – a URI for which to create parent directories

Raises:

GLib.Error

Returns:

True if successful

Return type:

bool

Ensures that all parent directories of uri exist so that uri itself can be created directly.

RB.uri_exists(uri)
Parameters:

uri (str) – a URI to check

Returns:

True if uri exists

Return type:

bool

Checks if a URI identifies a resource that exists

RB.uri_get_dir_name(uri)
Parameters:

uri (str) – a URI

Returns:

new URI for parent of uri, must be freed by caller.

Return type:

str

Returns the directory component of uri, that is, everything up to the start of the filename.

RB.uri_get_filesystem_type(uri, mount_point)
Parameters:
  • uri (str) – URI to get filesystem type for

  • mount_point (str) – optionally returns the mount point for the filesystem as a URI

Returns:

filesystem type string, must be freed by caller.

Return type:

str

Returns a string describing the type of the filesystem containing uri.

RB.uri_get_mount_point(uri)
Parameters:

uri (str) – a URI

Returns:

filesystem mount point (must be freed by caller) or None.

Return type:

str

Returns the mount point of the filesystem holding uri. If uri is on a normal filesystem mount (such as /, /home, /var, etc.) this will be None.

RB.uri_get_short_path_name(uri)
Parameters:

uri (str) – a URI

Returns:

filename component of uri, must be freed by caller

Return type:

str

Returns the filename component of uri, that is, everything after the final slash and before the start of the query string or fragment.

RB.uri_handle_recursively(uri, cancel, func, *user_data)
Parameters:

Calls func for each file found under the directory identified by uri. If uri identifies a file, calls func for that instead.

RB.uri_handle_recursively_async(uri, cancel, func, *user_data)
Parameters:

Calls func for each file found under the directory identified by uri, or if uri identifies a file, calls it once with that.

If non-None, destroy_data will be called once all files have been processed, or when the operation is cancelled.

RB.uri_is_descendant(uri, ancestor)
Parameters:
  • uri (str) – URI to check

  • ancestor (str) – a URI to check against

Returns:

True if uri is a descendant of ancestor

Return type:

bool

Checks if uri refers to a path beneath ancestor, such that removing some number of path segments of uri would result in ancestor. It doesn’t do any filesystem operations, it just looks at the URIs as strings. The URI strings should be built by looking at a filesystem rather than user input, and must not have path segments that are empty (multiple slashes) or ‘.’ or ‘..’.

Given this input, checking if one URI is a descendant of another is pretty simple. A descendant URI must have the ancestor as a prefix, and if the ancestor ends with a slash, there must be at least one character after that, otherwise the following character must be a slash with at least one character after it.

RB.uri_is_directory(uri)
Parameters:

uri (str) – the URI to check

Returns:

True if uri is a directory

Return type:

bool

Checks if uri identifies a directory.

RB.uri_is_hidden(uri)
Parameters:

uri (str) – a URI to check

Returns:

True if uri is hidden

Return type:

bool

Checks if uri is hidden, according to the Unix filename convention. If the filename component of uri begins with a dot, the file is considered hidden.

RB.uri_is_local(uri)
Parameters:

uri (str) – a URI to check

Returns:

True if uri is local

Return type:

bool

Checks if uri identifies a local resource. Currently this just checks that it uses the ‘file’ URI scheme.

RB.uri_is_readable(uri)
Parameters:

uri (str) – a URI to check

Returns:

True if uri is readable

Return type:

bool

Checks if the user can read the resource identified by uri

RB.uri_is_writable(uri)
Parameters:

uri (str) – a URI to check

Returns:

True if uri is writable

Return type:

bool

Checks if the user can write to the resource identified by uri

RB.uri_list_parse(uri_list)
Parameters:

uri_list (str) – string containing URIs to parse

Returns:

GLib.List of URI strings

Return type:

[str]

Converts a single string containing a list of URIs into a GLib.List of URI strings.

RB.uri_make_hidden(uri)
Parameters:

uri (str) – a URI to construct a hidden version of

Returns:

hidden URI, must be freed by the caller.

Return type:

str

Constructs a URI that is similar to uri but which identifies a hidden file. This can be used for temporary files that should not be visible to the user while they are in use.

RB.uri_mkstemp(prefix, uri_ret, stream)
Parameters:
  • prefix (str) – URI prefix

  • uri_ret (str) – returns the temporary file URI

  • stream (Gio.OutputStream) – returns a GOutputStream for the temporary file

Raises:

GLib.Error

Returns:

True if successful

Return type:

bool

Creates a temporary file whose URI begins with prefix, returning the file URI and an output stream for writing to it.

Parameters:

uri (str) – the URI to process

Raises:

GLib.Error

Returns:

resolved URI, or None on error

Return type:

str

Attempts to resolve symlinks in uri and return a canonical URI for the file it identifies.

RB.user_cache_dir()
Returns:

string holding the path to the rhythmbox user cache directory, or None if the directory does not exist and could not be created.

Return type:

str

This will create the rhythmbox user cache directory, using the XDG Base Directory specification. If none of the XDG environment variables are set, this will be ~/.cache/rhythmbox.

RB.user_data_dir()
Returns:

string holding the path to the rhythmbox user data directory, or None if the directory does not exist and cannot be created.

Return type:

str

This will create the rhythmbox user data directory, using the XDG Base Directory specification. If none of the XDG environment variables are set, this will be ~/.local/share/rhythmbox.