aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/common.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-08 02:56:54 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-08 16:22:23 -0700
commit26620cbac85f1fa5057e54fa8d91c35d907c0e0f (patch)
tree40763f1590f80c1d4e5d7d0ac1c1ce9d720ad3fb /youtube/common.py
parent6ad09eb53a8b79b2241f56009d9757f8cac7181f (diff)
downloadyt-local-26620cbac85f1fa5057e54fa8d91c35d907c0e0f.tar.lz
yt-local-26620cbac85f1fa5057e54fa8d91c35d907c0e0f.tar.xz
yt-local-26620cbac85f1fa5057e54fa8d91c35d907c0e0f.zip
front-end support for adding to playlists
Diffstat (limited to 'youtube/common.py')
-rw-r--r--youtube/common.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/youtube/common.py b/youtube/common.py
index 3ee952d..f0d6694 100644
--- a/youtube/common.py
+++ b/youtube/common.py
@@ -1,4 +1,5 @@
from youtube.template import Template
+from youtube import local_playlist
import html
import json
import re
@@ -280,8 +281,33 @@ def medium_video_item_html(medium_video_info):
)
-
-
+header_template = Template('''
+ <header>
+ <div id="header-left">
+ <form id="site-search" action="/youtube.com/search">
+ <input type="search" name="query" class="search-box">
+ <button type="submit" value="Search" class="search-button">Search</button>
+ </form>
+ </div>
+ <div id="header-right">
+ <form id="playlist-add" action="/youtube.com/edit_playlist" method="post" target="_self">
+ <input type="hidden" name="action" value="add">
+ <input name="playlist_name" id="playlist-name-selection" list="playlist-options" type="text">
+ <datalist id="playlist-options">
+$playlists
+ </datalist>
+ <button type="submit" id="playlist-add-button">Add to playlist</button>
+ <button type="reset" id="item-selection-reset">Clear selection</button>
+ </form>
+ </div>
+ </header>
+''')
+playlist_option_template = Template('''<option value="$name">$name</option>''')
+def get_header():
+ playlists = ''
+ for name in local_playlist.get_playlist_names():
+ playlists += playlist_option_template.substitute(name = name)
+ return header_template.substitute(playlists=playlists)