~qioeujqioejqioe-deactivatedaccount/exaile/missing-signals

« back to all changes in this revision

Viewing changes to plugins/lastfmproxy/lastfmproxy.py

  • Committer: Adam Olsen
  • Date: 2008-04-25 00:27:05 UTC
  • Revision ID: arolsen@gmail.com-20080425002705-xiea417h9spv7fce
added "urlhandler" support to Exaile, and updated lastfmproxy plugin to use
it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
PLUGIN_NAME = _("LastFM Radio")
29
29
PLUGIN_AUTHORS = ['Adam Olsen <arolsen@gmail.com>']
30
 
PLUGIN_VERSION = "0.2.3"
 
30
PLUGIN_VERSION = "0.2.4"
31
31
PLUGIN_DESCRIPTION = _(r"""Allows for streaming via lastfm proxy.\n\nThis
32
32
plugin is very beta and still doesn't work perfectly.""")
33
33
PLUGIN_ENABLED = False
201
201
        self.model.remove(load_node)
202
202
        self.last_node = node
203
203
 
 
204
    def handles_url(self, url):
 
205
        """
 
206
            Check to see if this is a lastfm:// url, and if so, return True
 
207
        """
 
208
        if re.match(r"^lastfm://.*$", url):
 
209
            return True
 
210
 
 
211
    def handle_url(self, url):
 
212
        """
 
213
            Handle a url
 
214
        """
 
215
        url = "lastfm://%s" % urllib.quote(url.replace('lastfm://', ''))
 
216
        item = radio.RadioGenre(url, self)
 
217
        item.lastfm_url = url
 
218
        self.load_genre(item)
 
219
 
204
220
    def load_genre(self, genre, rel=False):
205
221
        current = self.exaile.player.current
206
222
        if hasattr(current, 'lastfm_track'):
375
391
        PLUGIN.config = config
376
392
        APP.pradio_panel.add_driver(PLUGIN, plugins.name(__file__))
377
393
        HTTP_CLIENT = httpclient.httpclient('localhost', config.listenport)
 
394
        APP.add_urlhandler(PLUGIN)
378
395
 
379
396
    PROXY = lastfmmain.proxy(config.username, config.password)
380
397
    PROXY.np_image_func = album_callback
414
431
 
415
432
    if PLUGIN:
416
433
        APP.pradio_panel.remove_driver(PLUGIN)
 
434
        APP.remove_urlhandler(PLUGIN)
417
435
 
418
436
    if BUTTONS:
419
437
        for button in BUTTONS: