Beispiel #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)
Beispiel #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)
    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
    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
    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
Beispiel #6
0
 def json_to_douban_tracks(self, item):
     return DoubanTrack(**item)