Home | Trees | Indices | Help |
|
---|
|
1 # This program is free software: you can redistribute it and/or modify 2 # it under the terms of the GNU General Public License as published by 3 # the Free Software Foundation, either version 3 of the License, or 4 # (at your option) any later version. 5 # 6 # This program is distributed in the hope that it will be useful, 7 # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 # GNU General Public License for more details. 10 # 11 # You should have received a copy of the GNU General Public License 12 # along with this program. If not, see <http://www.gnu.org/licenses/>. 13 14 15 from AmazonCoverArtSearch import AmazonCoverArtSearch 16 from Loader import Loader 17 import os 18 19 import threading 20 import time 2123 loader = None 24 Result = False 25 artist = "" 26 album = "" 27 callback_fn = False 28 29 AlbumCover = "/tmp/nowplaying-album.jpg" 307132 self.loader = Loader() 33 self.engine = AmazonCoverArtSearch(self.loader) 34 self.Result = False 35 threading.Thread.__init__(self)36 41 4749 data = self.engine.get_best_match_urls(result) 50 if data and self.artist == artist and self.album == album: 51 #print data[0] 52 self.loader.get_url(data[0], self.saveimg)5355 if os.path.exists(self.AlbumCover): os.remove(self.AlbumCover) 56 self.Result = False 57 self.engine.search (self.artist, self.album, self.cb) 58 while True: 59 if self.Result: 60 break 61 if not self.engine.search_next (): 62 break 63 64 cover = False 65 if os.path.exists(self.AlbumCover): 66 cover = self.AlbumCover 67 68 #print threading.currentThread() 69 self.callback_fn(cover) 70 return None
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jan 4 16:58:27 2012 | http://epydoc.sourceforge.net |