Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**************************************************************************
- * Amarok 2 lyrics script to fetch Googlyrics from all the web *
- * *
- * Copyright *
- * (C) 2009 <> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- **************************************************************************/
- Importer.loadQtBinding( "qt.core" );
- Importer.loadQtBinding( "qt.network" );
- Importer.loadQtBinding( "qt.xml" );
- function parseLyrics( lyrics )
- {
- Amarok.debug( "parsing..." );
- );
- TrackInfo = Amarok.Engine.currentTrack();
- lyricsStr = lyrics;
- xml = xml.replace( "{lyrics}", lyricsStr );
- Amarok.debug( xml );
- Amarok.Lyrics.showLyrics( xml );
- }
- function lyricsFetchResult( reply )
- {
- lyrics = reply;
- Amarok.debug( lyrics );
- );
- Amarok.debug( "searching..." );
- );
- Amarok.debug( "found lyrics");
- parseLyrics( lyrics );
- }
- function fetchLyrics( artist, title )
- {
- try{
- //xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><lyric artist=\"{artist}\" title=\"{title}\">{lyrics}</lyric>";
- xml = "{lyrics}";
- var path = "http://localhost:8801/+_+" + artist + "+_+" + title;
- url = new QUrl( path );
- Amarok.debug( "url address:" + url.toString() );
- d = new Downloader( url, lyricsFetchResult, "UTF-8" );
- }
- catch( err )
- {
- Amarok.debug (err);
- }
- }
- Amarok.Lyrics.fetchLyrics.connect( fetchLyrics );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement