RB.PlaylistManager

g GObject.Object GObject.Object RB.PlaylistManager RB.PlaylistManager GObject.Object->RB.PlaylistManager

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class error_quark ()
class new (shell, playlists_file)
  add_to_playlist (name, uri)
  create_static_playlist (name)
  delete_playlist (name)
  export_playlist (name, uri, m3u_format)
  get_playlist_names ()
  get_playlists ()
  load_playlists ()
  new_playlist (suggested_name, automatic)
  new_playlist_from_selection_data (data)
  parse_file (uri)
  remove_from_playlist (name, uri)
  save_playlist_file (source)
  save_playlists (force)
  shutdown ()

Virtual Methods

Inherited:GObject.Object (7)
  do_load_finish ()
  do_load_start ()
  do_playlist_added (source)
  do_playlist_created (source)

Properties

Name Type Flags Short Description
playlists-file str r/w playlists file
shell RB.Shell r/w RB.Shell object
source RB.Source r/w RB.Source object

Signals

Inherited:GObject.Object (1)
Name Short Description
load-finish Emitted when the playlist manager finishes loading the user’s playlist file.
load-start Emitted when the playlist manager starts loading the user’s playlist file.
playlist-added Emitted when a playlist is added, including when being loaded from the user’s playlist file.
playlist-created Emitted when a new playlist is created.

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent GObject.Object r  

Class Details

class RB.PlaylistManager(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:RB.PlaylistManagerClass
classmethod error_quark()
Return type:int
classmethod new(shell, playlists_file)
Parameters:
  • shell (RB.Shell) – the RB.Shell
  • playlists_file (str) – the full path to the playlist file to load
Returns:

the RB.PlaylistManager

Return type:

RB.PlaylistManager

Creates the RB.PlaylistManager instance

add_to_playlist(name, uri)
Parameters:
  • name (str) – name of the playlist to add to
  • uri (str) – URI of the entry to add to the playlist
Raises:

GLib.Error

Returns:

True if successful.

Return type:

bool

Adds an entry to the specified playlist. Fails if no playlist with that name exists. This is part of the playlist manager dbus interface.

create_static_playlist(name)
Parameters:name (str) – name of the new playlist
Raises:GLib.Error
Returns:True if successful.
Return type:bool

Creates a new static playlist source with the given name. Will fail if a playlist with that name already exists. This is part of the playlist manager dbus interface.

delete_playlist(name)
Parameters:name (str) – name of the playlist to delete
Raises:GLib.Error
Returns:True if successful.
Return type:bool

Deletes the specified playlist. Will fail if no playlist with that name exists. This is part of the playlist manager dbus interface.

export_playlist(name, uri, m3u_format)
Parameters:
  • name (str) – name of the playlist to export
  • uri (str) – playlist save location
  • m3u_format (bool) – if True, save in M3U format, otherwise save in PLS format
Raises:

GLib.Error

Returns:

True if successful.

Return type:

bool

Saves the specified playlist to a file in either M3U or PLS format. This is part of the playlist manager dbus interface.

get_playlist_names()
Raises:GLib.Error
Returns:True if successful.
playlists:holds the array of playlist names on reutrn
Return type:(bool, playlists: str)

Allocates and returns an array containing the names of all local playlists. This is part of the playlist manager dbus interface.

get_playlists()
Returns:list of playlists
Return type:[RB.Source]

Returns a GLib.List containing all local playlist source objects.

load_playlists()

Loads the user’s playlists, or if the playlist file does not exists, reads the default playlist file. Should be called only once on startup.

new_playlist(suggested_name, automatic)
Parameters:
  • suggested_name (str) – optional name to use for the new playlist
  • automatic (bool) – if True, create an auto playlist
Returns:

the new playlist object.

Return type:

RB.Source

Creates a new playlist and adds it to the source list.

new_playlist_from_selection_data(data)
Parameters:data (Gtk.SelectionData) – the Gtk.SelectionData from which to create a playlist
Returns:the new playlist.
Return type:RB.Source

Creates a new playlist based on selection data from gtk. Used to implement playlist creation through drag and drop to the source list.

parse_file(uri)
Parameters:uri (str) – URI of the playlist to load
Raises:GLib.Error
Returns:True on success
Return type:bool

Parses a playlist file, adding entries to the database and to a new static playlist. If the playlist file includes a title, the static playlist created will have the same title.

remove_from_playlist(name, uri)
Parameters:
  • name (str) – name of the playlist to remove from
  • uri (str) – URI of the entry to remove from the playlist
Raises:

GLib.Error

Returns:

True if successful.

Return type:

bool

Removes an entry from the specified playlist. Fails if no playlist with that name exists. This is part of the playlist manager dbus interface.

save_playlist_file(source)
Parameters:source (RB.Source) –
save_playlists(force)
Parameters:force (bool) – if True, save playlists synchronously and unconditionally
Returns:True if a playlist save operation has been started
Return type:bool

Saves the user’s playlists. If the force flag is True, the playlists will always be saved. Otherwise, the playlists will only be saved if a playlist has been created, modified, or deleted since the last time the playlists were saved, and no save operation is currently taking place.

shutdown()

Shuts down the playlist manager, making sure any outstanding playlist save operation finishes.

do_load_finish() virtual
do_load_start() virtual
do_playlist_added(source) virtual
Parameters:source (RB.Source) –
do_playlist_created(source) virtual
Parameters:source (RB.Source) –

Signal Details

RB.PlaylistManager.signals.load_finish(playlist_manager)
Signal Name:load-finish
Flags:RUN_LAST
Parameters:playlist_manager (RB.PlaylistManager) – The object which received the signal

Emitted when the playlist manager finishes loading the user’s playlist file.

RB.PlaylistManager.signals.load_start(playlist_manager)
Signal Name:load-start
Flags:RUN_LAST
Parameters:playlist_manager (RB.PlaylistManager) – The object which received the signal

Emitted when the playlist manager starts loading the user’s playlist file.

RB.PlaylistManager.signals.playlist_added(playlist_manager, source)
Signal Name:

playlist-added

Flags:

RUN_LAST

Parameters:

Emitted when a playlist is added, including when being loaded from the user’s playlist file.

RB.PlaylistManager.signals.playlist_created(playlist_manager, source)
Signal Name:

playlist-created

Flags:

RUN_LAST

Parameters:

Emitted when a new playlist is created.

Property Details

RB.PlaylistManager.props.playlists_file
Name:playlists-file
Type:str
Default Value:None
Flags:READABLE, WRITABLE

playlists file

RB.PlaylistManager.props.shell
Name:shell
Type:RB.Shell
Default Value:None
Flags:READABLE, WRITABLE

RB.Shell object

RB.PlaylistManager.props.source
Name:source
Type:RB.Source
Default Value:None
Flags:READABLE, WRITABLE

RB.Source object