def on_mainwindow_favoriteVideo(self): body = """<?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom"> <id>%s</id> </entry>""" % self._yt_id req = Request("https://gdata.youtube.com/feeds/api/users/default/favorites", util.vlcstring(body)) req.add_header("Content-Type", "application/atom+xml") req.add_header("Content-Length", len(body)) req.add_header("GData-Version", "2") req.add_header("X-GData-Key", auth.GDATA_KEY) auth.yauth.urlopen(req)
def set_url(self, newurl): preservepos = self.player.get_state() != self.player.State.Stopped self._yt_is_video = True self.main_window.shareButton.setEnabled(True) if (preservepos): pos = self.player.get_position() media = qplayer.getInstance().media_new_location(util.vlcstring(newurl)) media.set_meta(0, self._yt_title) media.set_meta(1, self._yt_uploa) self.player.set_media(media) self.play() if (preservepos): self.player.set_position(pos)
def on_mainwindow_likeVideo(self): body = """<?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:yt="http://gdata.youtube.com/schemas/2007"> <yt:rating value="like"/> </entry>""" req = Request("https://gdata.youtube.com/feeds/api/videos/%s/ratings" % self._yt_id, util.vlcstring(body)) req.add_header("Content-Type", "application/atom+xml") req.add_header("Content-Length", len(body)) req.add_header("GData-Version", "2") req.add_header("X-GData-Key", auth.GDATA_KEY) auth.yauth.urlopen(req)
def set_sub(self, path): self.player.video_set_subtitle_file(util.vlcstring(path))
def set_info(self, info): self._yt_title = util.vlcstring(info.title) self._yt_uploa = util.vlcstring(info.uploader) self._yt_id = info.video_id if (self.rdg.isVisible()): self.rdg.setText("Opening YouTube Video:\n\"%s\"" % info.title)