I took a look at an example script for Amarok 2 which pulled lyrics for songs. This I then used in order to write a small script in order to search YouTube for related videos. I’m not sure exactly what it would do, but this is more for my edification then any real work.
Importer.loadQtBinding( “qt.core” )
Importer.loadQtBinding( “qt.network” )
Now, If I’m learning at all I’m assuming that the first code block is to load up libraries one will be calling during the scripts run that would allow it to use things outside of the Amarok 2 scripting API. This doesn’t seem to be too difficult, and would allow someone to load up say libgpod and call from it.
function onFinished( dat )
Amarok.Window.showBrowser( dat );
catch ( err )
Amarok.debug( “error: ” + err );
The second block defines the function that would display the information pulled from the third Block.
function getYouTUbe ( artist, title, url )
var url = new QUrl( “http://gdata.youtube.com/feeds/api/videos” );
url.addQueryItem( “func”, “q” );
url.addQueryItem( “artist”, artist );
url.addQueryItem( “song”, title );
Amarok.debug( “request URL: ” + url.toString() );
new Downloader( url, onFinished );
catch( err )
Amarok.debug( “error: ” + err );
The Third Block seems to be dependent on the API you are pulling from. Say for instance YouTubes API defines how you will search for the information you are wanting. In this case the artist and song from the Amarok library which is then sent to YouTube and downloaded.
Amarok.Window.showBrowser.connect( getYouTube );
The Final codeblock allows for one to display the results from the query function just written. This doesn’t seem to be TOO difficult if you are trying to pull information from services and display them in Amarok 2. Things like this however probably belong more in the app area or helping the video app build up and grow.
This leads me to the most recent post I put up on the Amarok forum. I’m basically asking about calls that will be added to the Aamrok 2 scripting API relating to calls to media devices and other things. They MAY intend to include this in the DBus API information, but I am asking mostly for clarification.
Right now, my scripting thoughts are going like this.
Media Device transcoder/uploader
Function developed to pull information from file for tags;
Function developed to add information for Video to tags
Function to ask for specific variable information. vbit, abit, wxh, fps if not known will attempt to guess fps
Function to call mp4box and set information for transcoding
Function to transcode audio stream (can be adapted for transcoding music files for transfer)
Function to transcode video stream (should be able to be set for media devices prefered format)
Function to mux video and audio into media device file
Function to add all tagging information
Function to allow for image uplaod to media device (should allow for image convertion to media device specific format)
Function to clean up temp files
Function to write all files to media device
Function to ctach and display all error codes
Take a look at the psuedocode here and let me know if this is the sort of thing that should even BE in a script like this. Perhaps something else would be a better fit for this type of scripting for Amarok 2.