Amarok Scripting API
Anmol Ahuja
darthcodus at gmail.com
Wed Aug 28 20:24:38 UTC 2013
Amarok Scripting API Status 2.0
Existing:
Amarok.Lyrics
public slots:
void showLyrics( const QString& lyrics ) const;
void showLyricsHtml( const QString& lyrics ) const;
void showLyricsError( const QString& error ) const;
void showLyricsNotFound( const QString& msg ) const;
QString escape( const QString& str );
void setLyricsForTrack( const QString& trackUrl , const
QString& lyrics ) const;
QString toUtf8( const QByteArray& lyrics, const QString&
encoding = "UTF-8" );
QString QStringtoUtf8( const QString& lyrics, const QString&
encoding = "UTF-8" );
QByteArray fromUtf8( const QString& str, const QString&
encoding );
signals:
void fetchLyrics( const QString& artist, const QString& title,
const QString& );
Amarok.Script
public slots:
QVariant readConfig( const QString &name, const QVariant
&defaultValue ) const;
QString readConfig( const QString &name, const QString
&defaultValue ) const;
void writeConfig( const QString &name, const QVariant &content
);
void writeConfig( const QString &name, const QString &content );
ScriptableServiceScript
public slots:
int insertItem( StreamItem* item );
void setCurrentInfo( const QString &infoHtml );
int donePopulating() const;
void setIcon( const QPixmap &icon );
void setEmblem( const QPixmap &icon );
void setScalableEmblem( const QString &emblemPath );
signals:
void populate( int, QString, QString );
void fetchInfo( int, QString );
void customize();
Amarok.CollectionManager [previously Amarok.Collection]
public slots:
int totalAlbums() const;
int totalArtists() const;
int totalComposers() const;
int totalGenres() const;
int totalTracks() const;
QStringList collectionLocation() const;
QStringList query( const QString& sql ) const;
QString escape( const QString& sql ) const;
void scanCollection() const;
void scanCollectionChanges() const;
Amarok.Window.OSD
public slots:
void showCurrentTrack();
* To show an OSD with the current settings, call show();
void show();
void setDuration( int ms );
void setTextColor( const QColor &color );
void setOffset( int y );
void setImage( const QImage &image );
void setScreen( int screen );
void setText( const QString &text );
void setRating( const short rating );
Amarok
public slots:
void quitAmarok();
void debug( const QString& text ) const;
int alert( const QString& text, const QString& type =
"information" ) const;
void end();
bool runScript( const QString& name ) const;
bool stopScript( const QString& name ) const;
QStringList listRunningScripts() const;
signals:
void configured();
Amarok.StreamItem
QString itemName
QString infoHtml
QString playableUrl
QString callbackData
int level
QString album
QString artist
QString genre
QString composer
int year
QString coverUrl
Amarok.Window.Statusbar
public slots:
void longMessage( const QString &text );
void shortMessage( const QString &text );
Amarok.Playlist
public slots:
int activeIndex();
int totalTrackCount();
QString saveCurrentPlaylist();
void addMedia( const QUrl &url );
void addMediaList( const QVariantList &urls );
void clearPlaylist();
void playByIndex( int index );
void playMedia( const QUrl &url );
void playMediaList( const QVariantList &urls );
void removeCurrentTrack();
void removeByIndex( int index );
void savePlaylist( const QString& path );
void setStopAfterCurrent( bool on );
bool stopAfterCurrent();
void togglePlaylist();
QStringList filenames();
Meta::TrackPtr trackAt( int row );
QList<int> selectedIndexes();
QStringList selectedFilenames();
signals:
void trackInserted( int start, int end );
void trackRemoved( int start, int end );
Amarok.Info
public slots:
QString scriptPath() const;
QString scriptConfigPath( const QString& name ) const;
QString iconPath( const QString& name, int size ) const;
QString version() const;
Amarok.Window.KNotify
bool kNotifyEnabled
public slots:
void showCurrentTrack();
void show(const QString &title, const QString &body, const
QPixmap &pixmap = QPixmap() );
Amarok.Engine
bool randomMode
bool dynamicMode
bool repeatPlaylist
bool repeatTrack
int volume
int fadeoutLength
public slots:
void Play() const;
void Stop( bool forceInstant = false ) const;
void Pause() const;
void Next() const;
void Prev() const;
void PlayPause() const;
void Seek( int ms ) const;
void SeekRelative( int ms ) const;
void SeekForward( int ms = 10000 ) const;
void SeekBackward( int ms = 10000 ) const;
int IncreaseVolume( int ticks = 100/25 );
int DecreaseVolume( int ticks = 100/25 );
void Mute();
int trackPosition() const;
int trackPositionMs() const;
int engineState() const;
Meta::TrackPtr currentTrack() const;
signals:
void trackFinished();
void trackChanged();
void newMetaData( const QHash<qint64, QString> &metaData, bool
newTrack );
void trackSeeked( int );
void volumeChanged( int );
void trackPlayPause( int state );
Amarok.Window
public slots:
bool addToolsMenu( QString id, QString menuTitle, QString icon
= "amarok" );
void addToolsSeparator();
bool addSettingsMenu( QString id, QString menuTitle, QString
icon = "amarok" );
void addSettingsSeparator();
signals:
void prepareToQuit();
Amarok.ServicePluginManager
public slots:
QStringList loadedServices();
QStringList loadedServiceNames();
QString serviceDescription( const QString &service );
QString serviceMessages( const QString &service );
QString sendMessage( const QString &service, const QString
&message );
Track
QString title
int sampleRate
int bitrate
double score
int rating
bool inCollection
QString type
int length
int fileSize
int trackNumber
int discNumber
int playCount
bool playable
QString album
QString artist
QString composer
QString genre
int year
QString comment
QString path
bool isValid
bool isEditable
QString lyrics
QString imageUrl
QString url
double bpm
public slots:
QScriptValue imagePixmap( int size = 1 ) const;
Importer
public slots:
void loadExtension( const QString &src );
bool loadQtBinding( const QString &binding );
bool include( const QString &relativeFile );
New:
Amarok.Window
QMainWindow mainWindow
bool isTrayIconShown
QString activeBrowserName
QString styleSheet
public slots:
void showBrowser( QString browser ) const;
void showTrayIcon( bool show );
QPalette palette() const;
void setPalette( const QPalette & palette );
signals:
void newPalette( QPalette );
Amarok.CollectionManager
public slots:
Collections::QueryMaker *queryMaker() const;
Collections::CollectionList queryableCollections() const;
Collections::CollectionList viewableCollections() const;
void dumpDatabaseContent() const;
signals:
void collectionAdded( Collections::Collection *newCollection );
void collectionDataChanged( Collections::Collection
*changedCollection );
void collectionRemoved( QString collectionId );
Amarok.Bookmark
int id
BookmarkGroupPtr parent
QString command
QString name
QString path
QString description
bool isNull
QString customValue
QString url
int id
BookmarkGroupPtr parent
QString name
QString description
int childCount
public slots:
AmarokUrlPtr contextView();
AmarokUrlPtr currentPlaylistView();
AmarokUrlPtr browserView();
AmarokUrlPtr createCurrentTrackBookmark();
// AmarokUrlPtr artist( Meta::AlbumPtr album );
Amarok.Engine.Equalizer
bool enabled
bool isSupported
QString selectedPreset
QStringList userPresets
QStringList translatedGlobalPresetList
QStringList globalPresetList
QStringList translatedDefaultPresetList
QStringList defaultPresetList
QList<int> gains
int maxGain
QStringList bandFrequencies
public slots:
QList<int> getPresetGains( const QString &presetName );
bool deletePreset( const QString &presetName );
void savePreset( const QString &name, const QList<int>
&presetGains );
signals:
void presetApplied( QString name );
void gainsChanged( QList<int> gains );
void presetsChanged( QString name );
Importer
public slots:
void loadAmarokBinding( const QString &name );
Amarok.PlaylistManager
QList<int> availableCategories
public slots:
Playlists::PlaylistList playlistsOfCategory( int
playlistCategory );
Playlists::PlaylistProviderList providersForCategory( int
playlistCategory );
//void setupSync( const Playlists::PlaylistPtr master, const
Playlists::PlaylistPtr slave );
Playlists::PlaylistProvider *playlistProvider( int category,
QString name );
Playlists::PlaylistProvider *toProvider = 0 );
bool import( const QString &fromLocation );
bool rename( Playlists::PlaylistPtr playlist, const QString
&newName );
bool deletePlaylists( Playlists::PlaylistList playlistList );
getProvidersForPlaylist( const Playlists::PlaylistPtr playlist
);
bool isWritable( const Playlists::PlaylistPtr &playlist );
signals:
void updated( int category );
void categoryAdded( int category );
void providerAdded( Playlists::PlaylistProvider *provider, int
category );
void providerRemoved( Playlists::PlaylistProvider *provider,
int category );
void playlistAdded( Playlists::PlaylistPtr playlist, int
category );
void playlistRemoved( Playlists::PlaylistPtr playlist, int
category );
void playlistUpdated( Playlists::PlaylistPtr playlist, int
category );
void renamePlaylist( Playlists::PlaylistPtr playlist );
PlaylistProvider
bool isWritable
QString prettyName
bool isValid
QIcon icon
int category
int playlistCount
public slots:
QString toString() const;
Playlists::PlaylistList playlists();
Playlists::PlaylistPtr addPlaylist( Playlists::PlaylistPtr
playlist );
void renamePlaylist( Playlists::PlaylistPtr playlist, const
QString &newName );
bool deletePlaylists( const Playlists::PlaylistList
&playlistlist );
Playlists::PlaylistPtr save( const Meta::TrackList &tracks,
const QString &name = QString() );
signals:
void updated();
void playlistAdded( Playlists::PlaylistPtr playlist );
void playlistRemoved( Playlists::PlaylistPtr playlist );
BiasFactory
ctors: new BiasFactory()
bool enabled
QString name
QString identifier
QString description
QScriptValue widget
QScriptValue fromXml
QScriptValue toXml
QScriptValue matchingTracks
QScriptValue trackMatches
QScriptValue toStringFunction
QScriptValue init
QScriptValue paintOperator
int count
bool isFull
bool isOutstanding
bool isEmpty
TrackSet (+script ctors )
int count
bool isFull
bool isOutstanding
bool isEmpty
public slots:
void reset( bool value );
bool contains( const QString& uid ) const;
bool contains( const Meta::TrackPtr track ) const;
Meta::TrackPtr getRandomTrack() const;
void uniteTrack( const Meta::TrackPtr &track );
void uniteTrackSet( const Dynamic::TrackSet &trackSet );
void uniteUids( const QStringList &uids );
void intersectTrackSet( const Dynamic::TrackSet &trackSet );
void intersectUids( const QStringList &uids );
void subtractTrack( const Meta::TrackPtr &track );
void subtractTrackSet( const Dynamic::TrackSet &trackSet );
void subtractUids( const QStringList &uids );
QueryMaker
bool isValid
QString filter
public slots:
void run();
void abort();
void addFilter( const QString &filter );
signals:
void newResultReady( Meta::TrackList );
void queryDone();
Collection
bool isOrganizable
bool isWritable
QString collectionId
QString prettyName
float usedCapacity
float totalCapacity
bool isValid
QIcon icon
bool isQueryable
bool isViewable
bool supportsTranscode
QString prettyLocation
QStringList actualLocation
public slots:
void copyTracks( const Meta::TrackList &tracks,
Collections::Collection *targetCollection );
void copyTracks( const Meta::TrackPtr track,
Collections::Collection *targetCollection );
void queryAndCopyTracks( Collections::QueryMaker *queryMaker,
Collections::Collection *targetCollection );
void moveTracks( const Meta::TrackList &tracks,
Collections::Collection *targetCollection );
void moveTracks( const Meta::TrackPtr track,
Collections::Collection *targetCollection );
void queryAndMoveTracks( Collections::QueryMaker *queryMaker,
Collections::Collection *targetCollection );
void removeTracks( const Meta::TrackList &trackList );
void removeTracks( const Meta::TrackPtr track );
void queryAndRemoveTracks( Collections::QueryMaker *qm );
Collections::QueryMaker *queryMaker();
signals:
void updated();
void removed();
void finishCopy();
void finishRemove();
void aborted();
Playlist
bool isValid
QString name
QUrl uidUrl
int trackCount
Playlists
public slots:
Meta::TrackList tracks();
void triggerFullLoad();
void triggerQuickLoad();
void addTrack( Meta::TrackPtr track, int position = -1 );
void removeTrack( int position );
QString toString() const;
signals:
void loaded( Meta::TrackList tracks );
void addedTrack( Meta::TrackPtr track, int position );
void removedTrack( int position );
Track
Ctors: new Track (QUrl )
bool isLoaded
signals:
void loaded( Meta::TrackPtr );
Bookmark
ctors:
new Bookmark( QString urlString )
new Bookmark( QString urlString, BookmarkGroupPtr parent )
new Bookmark( Meta::Track track, longlong time )
int id
BookmarkGroupPtr parent
QString command
QString name
QString path
QString description
bool isNull
QString customValue
QString url
public slots:
bool save();
void initFromString( const QString & urlString );
bool run();
void removeFromDb();
QString prettyCommand() const;
StringMap args() const;
void setArg( const QString &name, const QString &value );
BookmarkGroup
ctors:
BookmarkGroup( QString name )
BookmarkGroup( QString name, customType )
BookmarkGroup( QString name, BookmarkGroup parent )
int id
BookmarkGroupPtr parent
QString name
QString description
int childCount
public slots:
void save();
BookmarkGroupList childGroups() const;
BookmarkList childBookmarks() const;
void clear();
void deleteChildBookmark( AmarokUrlPtr bookmark );
void deleteChildBookmarkgroup( BookmarkGroupPtr bookmarkGroup );
Amarok.Window.CollectionView
QString filter
QScriptValue selection
bool showYears
bool showTrackNumbers
bool showCovers
QList<Category> levels
public slots:
// void setLevel( int level, Category type );
void toggleView( bool merged );
void setAction( const QScriptValue &value );
CollectionViewItem
CollectionTreeItem* parent
int childCount
int row
int level
int childCount
bool isCollection
Meta::TrackList descendentTracks
Collections::Collection* parentCollection
public slots:
CollectionTreeItem* child( int row );
Selection
bool singleCollection
int collectionCount
QList<CollectionViewItem*> selectedItems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/amarok-devel/attachments/20130829/1e3959d0/attachment-0001.html>
More information about the Amarok-devel
mailing list