Parcourir la source

Added playlist settings page

sleepytaco il y a 3 ans
Parent
commit
e33d195fea

+ 28 - 1
apps/main/models.py

@@ -115,7 +115,7 @@ class PlaylistManager(models.Manager):
 
         # if its been a week since the last full scan, do a full playlist scan
         # basically checks all the playlist video for any updates
-        if playlist.last_full_scan_at + datetime.timedelta(hours=1) < datetime.datetime.now(pytz.utc):
+        if playlist.last_full_scan_at + datetime.timedelta(hours=24) < datetime.datetime.now(pytz.utc):
             print("DOING A FULL SCAN")
             current_video_ids = [video.video_id for video in playlist.videos.all()]
 
@@ -1011,6 +1011,33 @@ class PlaylistManager(models.Manager):
 
         return [0, deleted_videos, unavailable_videos, added_videos]
 
+    def deletePlaylistItems(self, user, playlist_id, playlist_item_ids):
+        """
+        Takes in playlist itemids for the videos in a particular playlist
+        """
+        credentials = self.getCredentials(user)
+        playlist = Playlist.objects.get(playlist_id=playlist_id)
+
+        num_deleted = 0
+        with build('youtube', 'v3', credentials=credentials) as youtube:
+            for playlist_item_id in playlist_item_ids:
+                pl_request = youtube.playlistItems().delete(
+                    id=playlist_item_id
+                )
+
+                try:
+                    pl_response = pl_request.execute()
+                except googleapiclient.errors.HttpError:  # failed to delete playlist item
+                    # possible causes:
+                    # playlistItemsNotAccessible (403)
+                    # playlistItemNotFound (404)
+                    # playlistOperationUnsupported (400)
+                    pass
+
+                # playlistItem was successfully deleted if no HttpError, so delete it from db
+                playlist.videos.get(playlist_item_id=playlist_item_id).delete()
+
+
 
 class Playlist(models.Model):
     # playlist details

+ 56 - 31
apps/main/templates/intercooler/videos.html

@@ -33,50 +33,75 @@
                           <img src="{% if video.thumbnail_url %}{{ video.thumbnail_url }}{% else %}https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg{% endif %}" class="img-fluid" alt="">
                       </div>
                         <div class="ms-4">
+
+                        {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
                             {{ video.video_position }}.
                             <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
                                 {{ video.name|truncatewords:"16" }}
-                            </a> by {{ video.channel_name }}<br>
+                            </a>
+                            <br>
+                            <span class="badge bg-dark">VIDEO UNAVAILABLE</span>
+                            {% if video.video_details_modified %}<span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>{% endif %}
+                            <br><br>
+                        {% else %}
+                            {{ video.video_position }}.
+                            <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
+                                {{ video.name|truncatewords:"16" }}
+                            </a> by {{ video.channel_name }} <br>
                             <span class="badge bg-secondary">{{ video.duration }}</span>
                             {% if video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
                             {% if video.published_at %}<span class="badge bg-secondary">{{ video.published_at }}</span>{% endif %}
-                            {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
+                          {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
 
                             {% if video.is_duplicate %}<span class="badge bg-primary">duplicate</span>{% endif %}
-                            {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}<span class="badge bg-dark">UNAVAILABLE</span>{% endif %}
-
-                            {% if video.video_details_modified %}
-                                <span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>
-                            {% endif %}<br>
+                            {% if video.video_details_modified %}<span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>{% endif %}<br>
                             <br>
-                        </div>
+                        {% endif %}
+
+
+                    </div>
+
                 </div>
                 <div class="ms-5">
-                    <a class="btn btn-sm btn-info mb-1" type="button" href="https://www.youtube.com/watch?v={{ video.video_id }}" class="btn btn-info me-1" target="_blank"><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
-                    <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
-                    <button class="copy-btn btn btn-success mb-1" data-clipboard-target="#video-{{ video.video_id }}">
-                        <i class="far fa-copy" aria-hidden="true"></i>
-                    </button>
-                    <button class="btn btn-sm btn-primary mb-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBackdrop" aria-controls="offcanvasBottom" hx-get="{% url 'video_details' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-details">Details</button>
-                    <button class="btn btn-sm btn-warning mb-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasForVideoNotes" aria-controls="offcanvasBottom" hx-get="{% url 'video_notes' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-notes">Notes</button>
-                    <button class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_favorite' playlist.playlist_id video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
-                        <div id="video-{{ forloop.counter }}-fav">
-                            {% if video.is_favorite %}
-                                <i class="fas fa-heart"></i>
-                            {% else %}
-                                <i class="far fa-heart"></i>
-                            {% endif %}
-                        </div>
-                    </button>
-                        {% if playlist.marked_as == "watching" %}
-                                            <button class="btn btn-sm btn-light mb-1" type="button">
-
-                            <i class="far fa-check-circle"></i>
-                                            </button>
+                {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
+                <button class="btn btn-sm  btn-warning mb-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasForVideoNotes" aria-controls="offcanvasBottom" hx-get="{% url 'video_notes' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-notes">Notes</button>
+                <button class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_favorite' playlist.playlist_id video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
+                    <div id="video-{{ forloop.counter }}-fav">
+                        {% if video.is_favorite %}
+                            <i class="fas fa-heart"></i>
+                        {% else %}
+                            <i class="far fa-heart"></i>
+                        {% endif %}
+                    </div>
+                </button>
+                {% else %}
 
+                <a class="btn btn-sm btn-info mb-1" type="button" href="https://www.youtube.com/watch?v={{ video.video_id }}" class="btn btn-info me-1" target="_blank"><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
+                <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
+                <button class="copy-btn btn btn-sm  btn-success mb-1" data-clipboard-target="#video-{{ video.video_id }}">
+                    <i class="far fa-copy" aria-hidden="true"></i>
+                </button>
+                <button class="btn btn-sm  btn-primary mb-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBackdrop" aria-controls="offcanvasBottom" hx-get="{% url 'video_details' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-details"><i class="fas fa-info"></i></button>
+                <button class="btn btn-sm  btn-warning mb-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasForVideoNotes" aria-controls="offcanvasBottom" hx-get="{% url 'video_notes' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-notes">Notes</button>
+                <button class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_favorite' playlist.playlist_id video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
+                    <div id="video-{{ forloop.counter }}-fav">
+                        {% if video.is_favorite %}
+                            <i class="fas fa-heart"></i>
+                        {% else %}
+                            <i class="far fa-heart"></i>
                         {% endif %}
-                </div>
-              {% endif %}
+                    </div>
+                </button>
+                    {% if playlist.marked_as == "watching" %}
+                                        <button class="btn btn-sm btn-light mb-1" type="button">
+
+                        <i class="far fa-check-circle"></i>
+                                        </button>
+
+                    {% endif %}
+                {% endif %}
+            </div>
+             {% endif %}
 
                 </li>
       {% endfor %}

+ 55 - 32
apps/main/templates/view_playlist.html

@@ -125,20 +125,6 @@
                         </a>
                     </div>
 
-                {% if playlist.is_user_owned %}
-                    <div class="btn-group me-2">
-                        <button type="button" class="btn btn-danger">
-                            <i class="fas fa-dumpster-fire"></i>
-                        </button>
-                    </div>
-
-                    <div class="btn-group me-2">
-                        <button type="button" class="btn btn-primary">
-                            <i class="fas fa-edit"></i>
-                        </button>
-                    </div>
-                {% endif %}
-
                     <div class="btn-group me-2">
 
                         <button class="btn btn-warning" type="button" hx-get="{% url 'mark_playlist_as' playlist.playlist_id 'favorite' %}" hx-target="#playlist-fav">
@@ -153,6 +139,12 @@
                     </div>
 
 
+                    <div class="btn-group me-2">
+                        <a href="{% url 'view_playlist_settings' playlist.playlist_id %}" class="btn btn-primary">
+                            <i class="fas fa-cog"></i>
+                        </a>
+                    </div>
+
 
                     <div class="btn-group me-2">
                         <button type="button" class="btn btn-light" onclick="row1_hide()">Manage</button>
@@ -181,7 +173,7 @@
                             Move
                         </button> -->
                            <button class="btn btn-success" id="move-copy-vids-btn" type="button" data-bs-toggle="collapse" data-bs-target="#moveItemsToCollapse" aria-expanded="false" aria-controls="moveItemsToCollapse">
-                                Move/Copy Videos
+                               {% if playlist.is_user_owned %}Move/{% endif %}Copy Videos
                            </button>
                     </div>
 
@@ -193,11 +185,13 @@
                         </button>
                     </div>
                     -->
+                    {% if playlist.is_user_owned %}
                     <div class="btn-group me-2">
                         <button hx-post="{% url 'delete_videos' playlist.playlist_id 'confirm' %}" hx-include="[id='video-checkboxes']" hx-target="#delete-videos-confirm-box" type="button" id="delete-vids-btn" class="btn btn-danger" data-bs-toggle="collapse" data-bs-target="#deleteItemsCollapse" aria-expanded="false" aria-controls="deleteItemsCollapse">
-                            Delete Selected
+                            Delete Selected Videos
                         </button>
                     </div>
+                    {% endif %}
                 </div>
             </div>
 
@@ -219,13 +213,15 @@
     <div class="collapse border-danger" id="moveItemsToCollapse">
     <div class="card card-body bg-dark text-white-50">
 
-      <h5>Move or Copy videos to another playlist!</h5>
+      <h5>{% if playlist.is_user_owned %}Move or {% endif %}Copy videos to another playlist!</h5>
 
       <div class="d-flex justify-content-start">
-          <input class="form-control w-50 bg-dark text-white border border-secondary" placeholder="Enter playlist ID here">
+          <input class="form-control w-50 bg-dark text-white border border-secondary" placeholder="Enter playlist ID or comma seperated list of playlist IDs here">
+          {% if playlist.is_user_owned %}
           <div class="btn-group ms-2">
             <button type="button" class="btn btn-info" id="select-all-btn">Move!</button>
           </div>
+          {% endif %}
           <div class="btn-group ms-2">
             <button type="button" class="btn btn-info" id="select-all-btn">Copy!</button>
           </div>
@@ -303,22 +299,48 @@
                       <img src="{% if video.thumbnail_url %}{{ video.thumbnail_url }}{% else %}https://i.ytimg.com/vi/9219YrnwDXE/maxresdefault.jpg{% endif %}" class="img-fluid" alt="">
                    </div>
                     <div class="ms-4">
-                        {{ video.video_position }}.
-                        <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
-                            {{ video.name|truncatewords:"16" }}
-                        </a> by {{ video.channel_name }} <br>
-                        <span class="badge bg-secondary">{{ video.duration }}</span>
-                        {% if video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
-                        {% if video.published_at %}<span class="badge bg-secondary">{{ video.published_at }}</span>{% endif %}
-                      {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
-
-                        {% if video.is_duplicate %}<span class="badge bg-primary">duplicate</span>{% endif %}
-                        {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}<span class="badge bg-dark">UNAVAILABLE</span>{% endif %}
-                        {% if video.video_details_modified %}<span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>{% endif %}<br>
-                        <br>
+
+                        {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
+                            {{ video.video_position }}.
+                            <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
+                                {{ video.name|truncatewords:"16" }}
+                            </a>
+                            <br>
+                            <span class="badge bg-dark">VIDEO UNAVAILABLE</span>
+                            {% if video.video_details_modified %}<span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>{% endif %}
+                            <br><br>
+                        {% else %}
+                            {{ video.video_position }}.
+                            <a class="link-dark" href="https://www.youtube.com/watch?v={{ video.video_id }}&list={{ video.playlist.playlist_id }}" target="_blank">
+                                {{ video.name|truncatewords:"16" }}
+                            </a> by {{ video.channel_name }} <br>
+                            <span class="badge bg-secondary">{{ video.duration }}</span>
+                            {% if video.has_cc %}<span class="badge bg-secondary">CC</span>{% endif %}
+                            {% if video.published_at %}<span class="badge bg-secondary">{{ video.published_at }}</span>{% endif %}
+                          {% if video.view_count %}<span class="badge bg-info">{{ video.view_count|intword|intcomma }} views</span>{% endif %}
+
+                            {% if video.is_duplicate %}<span class="badge bg-primary">duplicate</span>{% endif %}
+                            {% if video.video_details_modified %}<span class="badge bg-danger">UPDATED - {% if video.was_deleted_on_yt %}WENT PRIVATE/DELETED{% else %}NEWLY ADDED{% endif %}</span>{% endif %}<br>
+                            <br>
+                        {% endif %}
+
+
                     </div>
             </div>
             <div class="ms-5">
+                {% if video.is_unavailable_on_yt and video.was_deleted_on_yt %}
+                <button class="btn btn-sm  btn-warning mb-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasForVideoNotes" aria-controls="offcanvasBottom" hx-get="{% url 'video_notes' playlist.playlist_id video.video_id %}" hx-trigger="click" hx-target="#video-notes">Notes</button>
+                <button class="btn btn-sm btn-dark mb-1" type="button" hx-get="{% url 'mark_video_favorite' playlist.playlist_id video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
+                    <div id="video-{{ forloop.counter }}-fav">
+                        {% if video.is_favorite %}
+                            <i class="fas fa-heart"></i>
+                        {% else %}
+                            <i class="far fa-heart"></i>
+                        {% endif %}
+                    </div>
+                </button>
+                {% else %}
+
                 <a class="btn btn-sm btn-info mb-1" type="button" href="https://www.youtube.com/watch?v={{ video.video_id }}" class="btn btn-info me-1" target="_blank"><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
                 <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
                 <button class="copy-btn btn btn-sm  btn-success mb-1" data-clipboard-target="#video-{{ video.video_id }}">
@@ -342,6 +364,7 @@
                                         </button>
 
                     {% endif %}
+                {% endif %}
             </div>
           {% endif %}
 
@@ -349,9 +372,9 @@
 
         {% endfor %}
 
-    {% endif %}
         </div>
     </div>
+    {% endif %}
 
 
     </div>

+ 206 - 0
apps/main/templates/view_playlist_settings.html

@@ -0,0 +1,206 @@
+
+{% extends 'base.html' %}
+{% load humanize %}
+{% load static %}
+
+{% block content %}
+
+
+    <div id="view_playlist">
+        <br>
+    {% if playlist.is_user_owned %}
+
+        <div class="table-responsive" id="videos-div">
+
+            <div id="settings-status-div" class="text-dark">
+
+            </div>
+
+              <div class="card bg-dark text-white mb-3">
+                <div class="card-body">
+                    <div id="settings-form">
+
+                    <div class="row">
+                    <div class="col-sm-3">
+                      <h6 class="mb-0">Playlist Name</h6>
+                    </div>
+                    <div class="col-sm-9 text-white-50">
+                        <input type="text" class="form-control" name="username" id="username" value="{{ playlist.name }}">
+                    </div>
+                  </div>
+                    <hr>
+
+                      <div class="row">
+                        <div class="col-sm-3">
+                          <h6 class="mb-0">Owned By</h6>
+                        </div>
+                        <div class="col-sm-9 text-white-50">
+                            <input type="text" class="form-control" id="fullname" value="{{ playlist.channel_name }}" disabled>
+                        </div>
+                      </div>
+                      <hr>
+                      <div class="row">
+                          <div class="col-sm-3">
+                          <h6 class="mb-0">Playlist Description</h6>
+                        </div>
+                        <div class="col-sm-9 text-white-50">
+                            <textarea class="form-control form-text" id="summary" rows="6" placeholder="Enter a playlist description here!">{{ playlist.description }}</textarea>
+                        </div>
+                        </div>
+                      <hr>
+                    <div class="row">
+                      <div class="col-sm-3">
+                          <h6 class="mb-0">Playlist Privacy</h6>
+                        </div>
+                        <div class="col-sm-9 text-white-50">
+                            <select  class="form-select w-25" id="playlistPrivacy">
+                                  <option value="Public" {% if not playlist.is_private_on_yt %}selected{% endif %}>Public</option>
+                                  <option value="Private" {% if playlist.is_private_on_yt %}selected{% endif %}>Private</option>
+                            </select>
+                        </div>
+                        </div>
+                      <hr>
+                        <div class="row">
+                        <div class="col-sm-3">
+                            <h6 class="mb-0">Preferences</h6>
+                        </div>
+                        <div class="col-sm-9 text-white">
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="open search in new tab" type="checkbox" id="openSearchCheckDefault" {% if user.profile.open_search_new_tab %} checked {% endif %}>
+                            <label class="form-check-label" for="openSearchCheckDefault">Open Search in new tab</label>
+                            </div>
+
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="auto refresh playlists" type="checkbox" id="flexSwitchCheckDefault">
+                            <label class="form-check-label" for="flexSwitchCheckDefault">Automatically refresh playlists on visit</label>
+                            </div>
+
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="hide videos" type="checkbox" id="flexSwitchCheckChecked" checked>
+                            <label class="form-check-label" for="flexSwitchCheckChecked">Hide deleted/private videos</label>
+                            </div>
+
+
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="confirm before deleting" type="checkbox" id="flexSwitchCheckChecked" checked>
+                            <label class="form-check-label" for="flexSwitchCheckChecked">Confirm before deleting</label>
+                            </div>
+                        </div>
+                    </div>
+                    <hr>
+                    <div class="row">
+                        <div class="col-sm-3">
+                          <h6 class="mb-0">Danger Zone</h6>
+                        </div>
+                        <div class="col-sm-9 text-white-50">
+                            <button type="button" class="btn btn-outline-danger">Delete Playlist From YouTube</button>
+                        </div>
+                      </div>
+
+                </div>
+                </div>
+              </div>
+
+            <div class="d-flex justify-content-center">
+                            <div class="btn-group">
+                <a href="{% url 'playlist' playlist.playlist_id %}" class="btn btn-secondary me-2">Back</a>
+
+                <button type="button" class="btn btn-success me-2">Save</button>
+                                </div>
+              </div>
+        </div>
+
+    {% else %}
+        <div class="table-responsive" id="videos-div">
+
+            <div id="settings-status-div" class="text-dark">
+
+            </div>
+
+              <div class="card bg-dark text-white mb-3">
+                <div class="card-body">
+                    <div id="settings-form">
+
+                    <div class="row">
+                    <div class="col-sm-3">
+                      <h6 class="mb-0">Playlist Name on YouTube</h6>
+                    </div>
+                    <div class="col-sm-9 text-white-50">
+                        <input type="text" class="form-control" name="username" id="username" value="{{ playlist.name }}">
+                    </div>
+                  </div>
+                    <hr>
+
+                    <div class="row">
+                    <div class="col-sm-3">
+                      <h6 class="mb-0">Playlist User Label</h6>
+                    </div>
+                    <div class="col-sm-9 text-white-50">
+                        <input type="text" class="form-control" name="user_label" id="user_label" placeholder="Enter a personal label you want to identify this playlist with" value="{{ playlist.user_label }}">
+                    </div>
+                  </div>
+                      <hr>
+                      <div class="row">
+                        <div class="col-sm-3">
+                          <h6 class="mb-0">Owned By</h6>
+                        </div>
+                        <div class="col-sm-9 text-white-50">
+                            <input type="text" class="form-control" id="fullname" value="{{ playlist.channel_name }}" disabled>
+                        </div>
+                      </div>
+                      <hr>
+                        <div class="row">
+                        <div class="col-sm-3">
+                            <h6 class="mb-0">Preferences</h6>
+                        </div>
+                        <div class="col-sm-9 text-white">
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="open search in new tab" type="checkbox" id="openSearchCheckDefault" {% if user.profile.open_search_new_tab %} checked {% endif %}>
+                            <label class="form-check-label" for="openSearchCheckDefault">Open Search in new tab</label>
+                            </div>
+
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="auto refresh playlists" type="checkbox" id="flexSwitchCheckDefault">
+                            <label class="form-check-label" for="flexSwitchCheckDefault">Automatically refresh playlists on visit</label>
+                            </div>
+
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="hide videos" type="checkbox" id="flexSwitchCheckChecked" checked>
+                            <label class="form-check-label" for="flexSwitchCheckChecked">Hide deleted/private videos</label>
+                            </div>
+
+
+                            <div class="mb-3 form-check form-switch">
+                            <input class="form-check-input" name="confirm before deleting" type="checkbox" id="flexSwitchCheckChecked" checked>
+                            <label class="form-check-label" for="flexSwitchCheckChecked">Confirm before deleting</label>
+                            </div>
+                        </div>
+                    </div>
+
+                        <hr>
+                      <div class="row">
+                        <div class="col-sm-3">
+                          <h6 class="mb-0">Danger Zone</h6>
+                        </div>
+                        <div class="col-sm-9 text-white-50">
+                            <button type="button" class="btn btn-outline-danger">Remove Playlist From UnTube</button>
+                        </div>
+                      </div>
+
+                </div>
+                </div>
+              </div>
+
+            <div class="d-flex justify-content-center">
+                            <div class="btn-group">
+                <a href="{% url 'playlist' playlist.playlist_id %}" class="btn btn-secondary me-2">Back</a>
+
+                <button type="button" class="btn btn-success me-2">Save</button>
+                                </div>
+              </div>
+        </div>
+    {% endif %}
+
+
+    </div>
+{% endblock %}

+ 1 - 0
apps/main/urls.py

@@ -19,6 +19,7 @@ urlpatterns = [
 
     ### STUFF RELATED TO ONE PLAYLIST
     path("playlist/<slug:playlist_id>", views.view_playlist, name='playlist'),
+    path("playlist/<slug:playlist_id>/settings", views.view_playlist_settings, name="view_playlist_settings"),
     path("playlist/<slug:playlist_id>/order-by/<slug:order_by>", views.order_playlist_by,
          name='order_playlist_by'),
     path("playlist/<slug:playlist_id>/mark-as/<slug:mark_as>", views.mark_playlist_as,

+ 11 - 5
apps/main/views.py

@@ -284,6 +284,8 @@ def playlists_home(request):
 def delete_videos(request, playlist_id, command):
     video_ids = request.POST.getlist("video-id", default=[])
 
+    print(request.META, request.META["HTTP_HOST"])
+
     if command == "confirm":
         print(video_ids)
         num_vids = len(video_ids)
@@ -298,14 +300,12 @@ def delete_videos(request, playlist_id, command):
         return HttpResponse(
             f"<h5>Are you sure you want to delete {delete_text} from your YouTube playlist?{extra_text}This cannot be undone.</h5>")
     elif command == "confirmed":
+        print(video_ids)
         return HttpResponse(
             f'<div class="spinner-border text-light" role="status" hx-post="/from/{playlist_id}/delete-videos/start" hx-trigger="load" hx-swap="outerHTML"></div>')
     elif command == "start":
-        for i in range(1000):
-            pass
-        return HttpResponse('DONE!')
-    print(len(video_ids), request.POST)
-    return HttpResponse("Worked!")
+        Playlist.objects.deletePlaylistItems(request.user, playlist_id, video_ids)
+        return HttpResponse(f'<div hx-get="http://{request.META["HTTP_HOST"]}/update_playlist/{playlist_id}/manual" hx-target="#view_playlist" hx-trigger="load">Done!</div>')
 
 
 @login_required
@@ -638,3 +638,9 @@ def update_playlist(request, playlist_id, type):
         .render(
         {"playlist_changed_text": "\n".join(playlist_changed_text),
          "playlist_id": playlist_id}))
+
+
+def view_playlist_settings(request, playlist_id):
+    playlist = request.user.profile.playlists.get(playlist_id=playlist_id)
+
+    return render(request, 'view_playlist_settings.html', {"playlist": playlist})

+ 1 - 10
templates/base.html

@@ -52,7 +52,7 @@
     <body class="bg-dark text-white"  style="font-family: 'Fredoka One',fantasy; filter: contrast(80%);">
         <nav class="navbar navbar-expand-lg navbar-light" id="navbar">
             <div class="container-fluid">
-                <a class="navbar-brand" href="{% url 'home' %}"><h3>UnTube</h3></a>
+                <a class="navbar-brand" href="{% url 'home' %}"><h3><kbd>UnTube</kbd></h3></a>
                 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                     <span class="navbar-toggler-icon"></span>
                 </button>
@@ -168,20 +168,11 @@
                 bsDeleteCollapse.hide();
             });
             moveCopyCollapse.addEventListener('show.bs.collapse', function () {
-                    moveCopyBtn.classList = "btn btn-success";
                     bsDeleteCollapse.hide();
-
-            });
-            moveCopyCollapse.addEventListener('hide.bs.collapse', function () {
-                    moveCopyBtn.classList = "btn btn-outline-success";
             });
             deleteCollapse.addEventListener('show.bs.collapse', function () {
-                    deleteBtn.classList = "btn btn-danger";
                     bsMoveCopyCollapse.hide();
             });
-            deleteCollapse.addEventListener('hide.bs.collapse', function () {
-                    deleteBtn.classList = "btn btn-outline-danger";
-            });
 
             <!-- end -->