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