+
+
Subscribe to Channels
+
+
+
diff --git a/tubearchivist/home/templates/home/home.html b/tubearchivist/home/templates/home/home.html
index c91fe12a..9ddeb4ac 100644
--- a/tubearchivist/home/templates/home/home.html
+++ b/tubearchivist/home/templates/home/home.html
@@ -4,33 +4,31 @@
Recent Videos
-
+
-
-
Sort order from {{ sortorder }}
+
Sort order from {{ sortorder }}
-
-
-
Hide watched videos {{ hide_watched }}
+
+
+
Hide watched videos {{ hide_watched }}
-
+
+
-
diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py
index b9780737..5768c832 100644
--- a/tubearchivist/home/views.py
+++ b/tubearchivist/home/views.py
@@ -314,28 +314,41 @@ class ChannelView(View):
colors = config['application']['colors']
return es_url, colors
- @staticmethod
- def post(request):
+ def post(self, request):
""" handle http post requests """
subscriptions_post = dict(request.POST)
print(subscriptions_post)
subscriptions_post = dict(request.POST)
if 'subscribe' in subscriptions_post.keys():
- youtube_ids = process_url_list(subscriptions_post['subscribe'])
- if youtube_ids[0]['type'] == 'video':
- youtube_id = youtube_ids[0]['url']
- vid_details = PendingList().get_youtube_details(youtube_id)
+ sub_str = subscriptions_post['subscribe']
+ try:
+ youtube_ids = process_url_list(sub_str)
+ self.subscribe_to(youtube_ids)
+ except ValueError:
+ print('parsing subscribe ids failed!')
+ print(sub_str)
+
+ sleep(1)
+ return redirect('channel', permanent=True)
+
+ @staticmethod
+ def subscribe_to(youtube_ids):
+ """ process the subscribe ids """
+ for youtube_id in youtube_ids:
+ if youtube_id['type'] == 'video':
+ to_sub = youtube_id['url']
+ vid_details = PendingList().get_youtube_details(to_sub)
channel_id_sub = vid_details['channel_id']
+ elif youtube_id['type'] == 'channel':
+ channel_id_sub = youtube_id['url']
else:
- channel_id_sub = youtube_ids[0]['url']
+ raise ValueError('failed to subscribe to: ' + youtube_id)
+
ChannelSubscription().change_subscribe(
channel_id_sub, channel_subscribed=True
)
print('subscribed to: ' + channel_id_sub)
- sleep(1)
- return redirect('channel', permanent=True)
-
class VideoView(View):
""" resolves to /video/
/
diff --git a/tubearchivist/static/css/style.css b/tubearchivist/static/css/style.css
index f684884a..2762a317 100644
--- a/tubearchivist/static/css/style.css
+++ b/tubearchivist/static/css/style.css
@@ -182,11 +182,7 @@ button:hover {
.sort {
display: flex;
flex-wrap: wrap;
-}
-
-.sort > div {
- width: 100%;
- display: inline;
+ align-content: center;
}
.padding-box {
@@ -201,13 +197,6 @@ button:hover {
width: 50%;
}
-.search-form {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- justify-content: flex-end;
-}
-
.search-form input {
width: 90%;
}
@@ -615,9 +604,6 @@ button:hover {
.sort {
display: block;
}
- .sort > div {
- display: block;
- }
.sort select {
width: 100%;
margin: unset;