예제 #1
0
 def on_copy_permalink(self, *e):
     track = self.dbfm_plugin.get_current_track()
     sid = track.get_tag_raw('sid')[0]
     ssid = track.get_tag_raw('ssid')[0]
     t = DoubanTrack(sid=sid, ssid=ssid)
     url = t.get_uri()
     c = gtk.Clipboard()
     c.set_text(url)
예제 #2
0
 def on_copy_permalink(self, *e):
     track = self.dbfm_plugin.get_current_track()
     sid = track.get_tag_raw('sid')[0]
     ssid = track.get_tag_raw('ssid')[0]
     t = DoubanTrack(sid=sid, ssid=ssid)
     url = t.get_uri()
     c = gtk.Clipboard()
     c.set_text(url)
예제 #3
0
    def share(self, target, track):
        if target not in SHARE_TEMPLATE:
            return None

        templ = SHARE_TEMPLATE[target]
        data = {}
        data['title'] = track.get_tag_raw('title')[0]
        data['artist'] = track.get_tag_raw('artist')[0]
        data['sid'] = track.get_tag_raw('sid')[0]
        data['ssid'] = track.get_tag_raw('ssid')[0]
        data['picture'] = track.get_tag_raw('cover_url')[0]

        track = DoubanTrack(**data)

        if target == 'renren':
            title = track.title + ", " + track.artist
            p = templ % tuple(
                map(urllib.quote_plus, [title.encode('utf8'),
                                        track.get_uri()]))
            return p
        if target == 'kaixin001':
            title = track.title + ", " + track.artist
            p = templ % tuple(
                map(urllib.quote_plus,
                    [track.get_uri(), title.encode('utf8')]))
            return p
        if target == 'sina':
            title = track.title + ", " + track.artist
            p = templ % tuple(
                map(urllib.quote_plus,
                    [track.get_uri(),
                     title.encode('utf8'), track.picture]))
            return p
        if target == 'twitter':
            title = track.title + ", " + track.artist
            p = templ % tuple(
                map(urllib.quote_plus, [title.encode('utf8'),
                                        track.get_uri()]))
            return p
        if target == 'fanfou':
            title = track.title + ", " + track.artist
            p = templ % tuple(
                map(urllib.quote_plus,
                    [track.get_uri(), title.encode('utf8')]))
            return p
        if target == 'douban':
            p = templ % tuple(
                map(urllib.quote_plus, [
                    track.title.encode('utf8'),
                    track.get_uri(), track.picture, "Exaile DoubanFM Plugin",
                    track.sid
                ]))
            return p
예제 #4
0
    def share(self, target, track):
        if target not in SHARE_TEMPLATE:
            return None

        templ = SHARE_TEMPLATE[target]
        data = {}
        data["title"] = track.get_tag_raw("title")[0]
        data["artist"] = track.get_tag_raw("artist")[0]
        data["sid"] = track.get_tag_raw("sid")[0]
        data["ssid"] = track.get_tag_raw("ssid")[0]
        data["picture"] = track.get_tag_raw("cover_url")[0]

        track = DoubanTrack(**data)

        if target == "renren":
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [title.encode("utf8"), track.get_uri()]))
            return p
        if target == "kaixin001":
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [track.get_uri(), title.encode("utf8")]))
            return p
        if target == "sina":
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [track.get_uri(), title.encode("utf8"), track.picture]))
            return p
        if target == "twitter":
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [title.encode("utf8"), track.get_uri()]))
            return p
        if target == "fanfou":
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [track.get_uri(), title.encode("utf8")]))
            return p
        if target == "douban":
            p = templ % tuple(
                map(
                    urllib.quote_plus,
                    [track.title.encode("utf8"), track.get_uri(), track.picture, "Exaile DoubanFM Plugin", track.sid],
                )
            )
            return p
예제 #5
0
    def share(self, target, track):
        if target not in SHARE_TEMPLATE:
            return None

        templ = SHARE_TEMPLATE[target]
        data = {}
        data['title'] = track.get_tag_raw('title')[0]
        data['artist'] = track.get_tag_raw('artist')[0]
        data['sid'] = track.get_tag_raw('sid')[0]
        data['ssid'] = track.get_tag_raw('ssid')[0]
        data['picture'] = track.get_tag_raw('cover_url')[0]

        track = DoubanTrack(**data)

        if target == 'renren':
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [title.encode('utf8'), track.get_uri()]))
            return p
        if target == 'kaixin001':
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [track.get_uri(), title.encode('utf8')]))
            return p
        if target == 'sina':
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [track.get_uri(), title.encode('utf8'), track.picture]))
            return p
        if target == 'twitter':
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [title.encode('utf8'), track.get_uri()]))
            return p
        if target == 'fanfou':
            title = track.title + ", " + track.artist
            p = templ % tuple(map(urllib.quote_plus, [track.get_uri(), title.encode('utf8')]))
            return p
        if target == 'douban':
            p = templ % tuple(map(urllib.quote_plus, [track.title.encode('utf8'),track.get_uri(), track.picture, "Exaile DoubanFM Plugin"]))
            return p