#NEWLINE# def fetch( ) : #NEWLINE# #INDENT# if ( not dbus ) : #NEWLINE# #INDENT# logger . debug ( '%s (dbus not installed)' , FETCH_ERROR ) #NEWLINE# return [ ] #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# bus = dbus . SessionBus ( ) #NEWLINE# #UNINDENT# except dbus . exceptions . DBusException as e : #NEWLINE# #INDENT# logger . debug ( '%s (%s)' , FETCH_ERROR , e ) #NEWLINE# return [ ] #NEWLINE# #UNINDENT# if ( not bus . name_has_owner ( 'org.freedesktop.secrets' ) ) : #NEWLINE# #INDENT# logger . debug ( '%s (org.freedesktop.secrets service not running)' , FETCH_ERROR ) #NEWLINE# return [ ] #NEWLINE# #UNINDENT# service = _service ( bus ) #NEWLINE# session = service . OpenSession ( 'plain' , EMPTY_STRING ) [ 1 ] #NEWLINE# ( items , locked ) = service . SearchItems ( { #NEWLINE# #INDENT# 'service' : 'mopidy' , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( ( not locked ) and ( not items ) ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# if locked : #NEWLINE# #INDENT# ( items , prompt ) = service . Unlock ( locked ) #NEWLINE# if ( prompt != '/' ) : #NEWLINE# #INDENT# _prompt ( bus , prompt ) . Dismiss ( ) #NEWLINE# logger . debug ( '%s (Keyring is locked)' , FETCH_ERROR ) #NEWLINE# return [ ] #NEWLINE# #UNINDENT# #UNINDENT# result = [ ] #NEWLINE# secrets = service . GetSecrets ( items , session , byte_arrays = True ) #NEWLINE# for ( item_path , values ) in secrets . items ( ) : #NEWLINE# #INDENT# ( session_path , parameters , value , content_type ) = values #NEWLINE# attrs = _item_attributes ( bus , item_path ) #NEWLINE# result . append ( ( attrs [ 'section' ] , attrs [ 'key' ] , bytes ( value ) ) ) #NEWLINE# #UNINDENT# return result