Example #1
0
	def POST(self, action):
		if action == "play":
			data = json.load(StringIO(web.data()))
			video = findVideoInPlaylist(data['id'])
			if video:
				prepareVideo(video)
				playVideo(data['id'])
		web.seeother('/playlist')
Example #2
0
 def POST(self):
     from youtupi.playlist import findVideoInPlaylist, prepareVideo
     data = json.load(StringIO(web.data()))
     video = findVideoInPlaylist(data['id'])
     if video:
         dfolder = expanduser(config.conf.get('download-folder', "~/Downloads"))
         ensure_dir.ensure_dir(dfolder)
         dfile = os.path.join(dfolder, video.data['title'] + ".mp4")
         if not video.url:
             prepareVideo(video)
         downloader.download(video.url, dfile)