SHARE
TWEET

m

a guest Feb 1st, 2009 27 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**************************************************************************    
  2. *   Amarok 2 lyrics script to fetch Googlyrics from all the web           *    
  3. *                                                                         *    
  4. *   Copyright                                                             *    
  5. *   (C) 2009  <>                                                          *    
  6. *                                                                         *    
  7. *   This program is free software; you can redistribute it and/or modify  *    
  8. *   it under the terms of the GNU General Public License as published by  *    
  9. *   the Free Software Foundation; either version 2 of the License, or     *    
  10. *   (at your option) any later version.                                   *    
  11. *                                                                         *    
  12. *   This program is distributed in the hope that it will be useful,       *    
  13. *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *    
  14. *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *    
  15. *   GNU General Public License for more details.                          *    
  16. *                                                                         *    
  17. *   You should have received a copy of the GNU General Public License     *    
  18. *   along with this program; if not, write to the                         *    
  19. *   Free Software Foundation, Inc.,                                       *    
  20. *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *    
  21. **************************************************************************/    
  22.  
  23. Importer.loadQtBinding( "qt.core" );
  24. Importer.loadQtBinding( "qt.network" );
  25. Importer.loadQtBinding( "qt.xml" );    
  26.  
  27. function parseLyrics( lyrics )
  28. {                            
  29.     Amarok.debug( "parsing..." );
  30.  
  31. );                                                            
  32.  
  33.     TrackInfo = Amarok.Engine.currentTrack();
  34.                        
  35.     lyricsStr = lyrics;                                                        
  36.  
  37.     xml = xml.replace( "{lyrics}", lyricsStr );        
  38.     Amarok.debug( xml );                                
  39.  
  40.     Amarok.Lyrics.showLyrics( xml );
  41. }                                  
  42.  
  43. function lyricsFetchResult( reply )
  44. {                                  
  45.     lyrics = reply;                
  46.     Amarok.debug( lyrics );        
  47. );                                    
  48.                                                                                
  49.     Amarok.debug( "searching..." );                                            
  50. );                                                            
  51.  
  52.        
  53.     Amarok.debug( "found lyrics");                          
  54.     parseLyrics( lyrics );                    
  55. }                                                            
  56.  
  57. function fetchLyrics( artist, title )
  58. {
  59.     try{
  60.     //xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><lyric artist=\"{artist}\" title=\"{title}\">{lyrics}</lyric>";
  61.     xml = "{lyrics}";
  62.  
  63.     var path = "http://localhost:8801/+_+" + artist + "+_+" + title;
  64.  
  65.     url = new QUrl( path );
  66.     Amarok.debug( "url address:" + url.toString() );
  67.     d = new Downloader( url, lyricsFetchResult, "UTF-8" );
  68.     }
  69.     catch( err )
  70.     {
  71.         Amarok.debug (err);
  72.     }
  73. }
  74.  
  75. Amarok.Lyrics.fetchLyrics.connect( fetchLyrics );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top