updates per admin guidance. sync to master
This commit is contained in:
parent
76e61aeb1a
commit
ee43d91d78
|
@ -37,7 +37,6 @@ from home.tasks import (
|
|||
check_reindex,
|
||||
download_pending,
|
||||
extrac_dl,
|
||||
get_playlist_art,
|
||||
run_restore_backup,
|
||||
subscribe_to,
|
||||
)
|
||||
|
@ -537,7 +536,6 @@ class PlaylistApiView(ApiBaseView):
|
|||
action,
|
||||
UserConfig(request.user.id).get_value("hide_watched"),
|
||||
)
|
||||
get_playlist_art.delay(playlist_id)
|
||||
return Response({"success": True}, status=status.HTTP_201_CREATED)
|
||||
|
||||
def delete(self, request, playlist_id):
|
||||
|
|
|
@ -202,7 +202,11 @@ class ThumbManager(ThumbManagerBase):
|
|||
if skip_existing and os.path.exists(thumb_path):
|
||||
return
|
||||
|
||||
img_raw = self.download_raw(url)
|
||||
img_raw = (
|
||||
self.download_raw(url)
|
||||
if not isinstance(url, str) or url.startswith("http")
|
||||
else Image.open(os.path.join(self.CACHE_DIR, url))
|
||||
)
|
||||
width, height = img_raw.size
|
||||
|
||||
if not width / height == 16 / 9:
|
||||
|
|
|
@ -27,7 +27,7 @@ class YoutubePlaylist(YouTubeItem):
|
|||
|
||||
def __init__(self, youtube_id=None):
|
||||
if youtube_id is None:
|
||||
youtube_id = "PL_" + str(uuid.uuid4())
|
||||
youtube_id = "TA_playlist_" + str(uuid.uuid4())
|
||||
super().__init__(youtube_id)
|
||||
self.all_members = False
|
||||
self.nav = False
|
||||
|
@ -241,7 +241,7 @@ class YoutubePlaylist(YouTubeItem):
|
|||
def create(self, name):
|
||||
self.json_data = {
|
||||
"playlist_id": self.youtube_id,
|
||||
"playlist_active": True,
|
||||
"playlist_active": False,
|
||||
"playlist_name": name,
|
||||
"playlist_last_refresh": int(datetime.now().timestamp()),
|
||||
"playlist_entries": [],
|
||||
|
@ -375,15 +375,11 @@ class YoutubePlaylist(YouTubeItem):
|
|||
self.json_data["playlist_thumbnail"] = False
|
||||
|
||||
for video in playlist:
|
||||
url = self.get_video_thumbnail(video["youtube_id"])
|
||||
url = ThumbManager(video["youtube_id"]).vid_thumb_path()
|
||||
if url is not None:
|
||||
self.json_data["playlist_thumbnail"] = url
|
||||
break
|
||||
|
||||
def get_video_thumbnail(self, video_id):
|
||||
video = YoutubeVideo(video_id)
|
||||
video.get_from_es()
|
||||
return video.json_data["vid_thumb_url"]
|
||||
self.get_playlist_art()
|
||||
|
||||
def get_video_metadata(self, video_id):
|
||||
video = YoutubeVideo(video_id)
|
||||
|
|
|
@ -363,7 +363,10 @@ class Reindex(ReindexBase):
|
|||
self._get_all_videos()
|
||||
playlist = YoutubePlaylist(playlist_id)
|
||||
playlist.get_from_es()
|
||||
if not playlist.json_data:
|
||||
if (
|
||||
not playlist.json_data
|
||||
or playlist.json_data["playlist_type"] == "custom"
|
||||
):
|
||||
return
|
||||
|
||||
subscribed = playlist.json_data["playlist_subscribed"]
|
||||
|
|
|
@ -92,7 +92,7 @@ class Parser:
|
|||
item_type = "video"
|
||||
elif len_id_str == 24:
|
||||
item_type = "channel"
|
||||
elif len_id_str in (34, 26, 18) or id_str.startswith("PL_"):
|
||||
elif len_id_str in (34, 26, 18) or "_playlist_" in id_str:
|
||||
item_type = "playlist"
|
||||
else:
|
||||
raise ValueError(f"not a valid id_str: {id_str}")
|
||||
|
|
|
@ -21,7 +21,6 @@ from home.src.es.index_setup import ElasitIndexWrap
|
|||
from home.src.index.channel import YoutubeChannel
|
||||
from home.src.index.filesystem import Scanner
|
||||
from home.src.index.manual import ImportFolderScanner
|
||||
from home.src.index.playlist import YoutubePlaylist
|
||||
from home.src.index.reindex import Reindex, ReindexManual, ReindexPopulate
|
||||
from home.src.ta.config import AppConfig, ReleaseVersion, ScheduleBuilder
|
||||
from home.src.ta.notify import Notifications
|
||||
|
@ -104,11 +103,6 @@ class BaseTask(Task):
|
|||
"group": "setting:thumbnailsync",
|
||||
"api-start": True,
|
||||
},
|
||||
"get_playlist_art": {
|
||||
"title": "Get Playlist Thumbnail",
|
||||
"group": "setting:thumbnailsync",
|
||||
"api-start": True,
|
||||
},
|
||||
"index_playlists": {
|
||||
"title": "Index Channel Playlist",
|
||||
"group": "channel:indexplaylist",
|
||||
|
@ -362,16 +356,6 @@ def subscribe_to(self, url_str: str, expected_type: str | bool = False):
|
|||
SubscriptionHandler(url_str, task=self).subscribe(expected_type)
|
||||
|
||||
|
||||
@shared_task(bind=True, name="get_playlist_art", base=BaseTask)
|
||||
def get_playlist_art(self, playlist_id):
|
||||
"""
|
||||
download a thumb image for a playlist
|
||||
"""
|
||||
playlist = YoutubePlaylist(playlist_id)
|
||||
playlist.get_from_es()
|
||||
playlist.get_playlist_art()
|
||||
|
||||
|
||||
@shared_task(bind=True, name="index_playlists", base=BaseTask)
|
||||
def index_channel_playlists(self, channel_id):
|
||||
"""add all playlists of channel to index"""
|
||||
|
|
|
@ -138,12 +138,9 @@
|
|||
{% endif %}
|
||||
<span>{{ video.published }} | {{ video.player.duration_str }}</span>
|
||||
</div>
|
||||
<div class="video-desc-details">
|
||||
<div>
|
||||
<a class="video-more" href="{% url 'video' video.youtube_id %}"><h2>{{ video.title }}</h2></a>
|
||||
</div>
|
||||
<img id="{{ video.youtube_id }}-button2" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showDotMenu(this)" class="dot-button" title="More actions">
|
||||
</div>
|
||||
<div>
|
||||
<a class="video-more" href="{% url 'video' video.youtube_id %}"><h2>{{ video.title }}</h2></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -33,12 +33,9 @@
|
|||
{% endif %}
|
||||
<span>{{ video.published }} | {{ video.player.duration_str }}</span>
|
||||
</div>
|
||||
<div class="video-desc-details">
|
||||
<div>
|
||||
<a href="{% url 'channel_id' video.channel.channel_id %}"><h3>{{ video.channel.channel_name }}</h3></a>
|
||||
<a class="video-more" href="{% url 'video' video.youtube_id %}"><h2>{{ video.title }}</h2></a>
|
||||
</div>
|
||||
<img id="{{ video.youtube_id }}-button1" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showDotMenu(this)" class="dot-button" title="More actions">
|
||||
<div>
|
||||
<a href="{% url 'channel_id' video.channel.channel_id %}"><h3>{{ video.channel.channel_name }}</h3></a>
|
||||
<a class="video-more" href="{% url 'video' video.youtube_id %}"><h2>{{ video.title }}</h2></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -124,13 +121,10 @@
|
|||
{% endif %}
|
||||
<span>{{ video.published }} | {{ video.player.duration_str }}</span>
|
||||
</div>
|
||||
<div class="video-desc-details">
|
||||
<div>
|
||||
<a href="{% url 'channel_id' video.channel.channel_id %}"><h3>{{ video.channel.channel_name }}</h3></a>
|
||||
<a class="video-more" href="{% url 'video' video.youtube_id %}"><h2>{{ video.title }}</h2></a>
|
||||
</div>
|
||||
<img id="{{ video.youtube_id }}-button2" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showDotMenu(this)" class="dot-button" title="More actions">
|
||||
</div>
|
||||
<div>
|
||||
<a href="{% url 'channel_id' video.channel.channel_id %}"><h3>{{ video.channel.channel_name }}</h3></a>
|
||||
<a class="video-more" href="{% url 'video' video.youtube_id %}"><h2>{{ video.title }}</h2></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -155,15 +155,13 @@
|
|||
{% if playlist_info.playlist_type == "custom" %}
|
||||
{% if pagination %}
|
||||
{% if pagination.last_page > 0 %}
|
||||
<img id="{{ video.youtube_id }}-button2" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showDotMenuCustomPlaylist(this,'{{playlist_info.playlist_id}}',{{pagination.current_page}},{{pagination.last_page}})" class="dot-button" title="More actions">
|
||||
<img id="{{ video.youtube_id }}-button" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showCustomPlaylistMenu(this,'{{playlist_info.playlist_id}}',{{pagination.current_page}},{{pagination.last_page}})" class="dot-button" title="More actions">
|
||||
{% else %}
|
||||
<img id="{{ video.youtube_id }}-button2" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showDotMenuCustomPlaylist(this,'{{playlist_info.playlist_id}}',{{pagination.current_page}},{{pagination.current_page}})" class="dot-button" title="More actions">
|
||||
<img id="{{ video.youtube_id }}-button" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showCustomPlaylistMenu(this,'{{playlist_info.playlist_id}}',{{pagination.current_page}},{{pagination.current_page}})" class="dot-button" title="More actions">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<img id="{{ video.youtube_id }}-button2" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showDotMenuCustomPlaylist(this,'{{playlist_info.playlist_id}}',0,0)" class="dot-button" title="More actions">
|
||||
<img id="{{ video.youtube_id }}-button" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showCustomPlaylistMenu(this,'{{playlist_info.playlist_id}}',0,0)" class="dot-button" title="More actions">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<img id="{{ video.youtube_id }}-button2" src="{% static 'img/icon-dot-menu.svg' %}" alt="dot-menu-icon" data-id="{{ video.youtube_id }}" data-context="video" onclick="showDotMenu(this)" class="dot-button" title="More actions">
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
<span>Are you sure? </span><button class="danger-button" onclick="deleteVideo(this)" data-id="{{ video.youtube_id }}" data-redirect = "{{ video.channel.channel_id }}">Delete</button> <button onclick="cancelDelete()">Cancel</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button id="{{ video.youtube_id }}-button" data-id="{{ video.youtube_id }}" data-context="video" onclick="showAddToPlaylistMenu(this)">Add To Playlist</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-box-item">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
apprise==1.6.0
|
||||
apprise==1.7.1
|
||||
celery==5.3.6
|
||||
Django==4.2.7
|
||||
Django==4.2.9
|
||||
django-auth-ldap==4.6.0
|
||||
django-cors-headers==4.3.1
|
||||
djangorestframework==3.14.0
|
||||
|
@ -10,4 +10,4 @@ requests==2.31.0
|
|||
ryd-client==0.0.6
|
||||
uWSGI==2.0.23
|
||||
whitenoise==6.6.0
|
||||
yt-dlp==2023.11.16
|
||||
yt-dlp==2023.12.30
|
||||
|
|
|
@ -576,12 +576,6 @@ video:-webkit-full-screen {
|
|||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.video-popup-menu img {
|
||||
width: 12px;
|
||||
cursor: pointer;
|
||||
filter: var(--img-filter);
|
||||
}
|
||||
|
||||
.video-popup-menu img.move-video-button {
|
||||
width: 24px;
|
||||
cursor: pointer;
|
||||
|
@ -628,12 +622,6 @@ video:-webkit-full-screen {
|
|||
filter: var(--img-filter);
|
||||
}
|
||||
|
||||
.video-popup-menu-close-button {
|
||||
cursor: pointer;
|
||||
filter: var(--img-filter);
|
||||
float:right;
|
||||
}
|
||||
|
||||
.video-more {
|
||||
text-decoration: underline;
|
||||
text-align: right;
|
||||
|
@ -718,6 +706,19 @@ video:-webkit-full-screen {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
.video-popup-menu img {
|
||||
width: 12px;
|
||||
cursor: pointer;
|
||||
filter: var(--img-filter);
|
||||
}
|
||||
|
||||
|
||||
.video-popup-menu-close-button {
|
||||
cursor: pointer;
|
||||
filter: var(--img-filter);
|
||||
float:right;
|
||||
}
|
||||
|
||||
.description-text {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ function addToQueue(autostart = false) {
|
|||
}
|
||||
|
||||
//shows the video sub menu popup
|
||||
function showDotMenu(input1) {
|
||||
function showAddToPlaylistMenu(input1) {
|
||||
let dataId, playlists, form_code, buttonId;
|
||||
dataId = input1.getAttribute('data-id');
|
||||
buttonId = input1.getAttribute('id');
|
||||
|
@ -239,7 +239,7 @@ function removeDotMenu(input1, button_id) {
|
|||
}
|
||||
|
||||
//shows the video sub menu popup on custom playlist page
|
||||
function showDotMenuCustomPlaylist(input1, playlist_id, current_page, last_page) {
|
||||
function showCustomPlaylistMenu(input1, playlist_id, current_page, last_page) {
|
||||
let dataId, form_code, buttonId;
|
||||
dataId = input1.getAttribute('data-id');
|
||||
buttonId = input1.getAttribute('id');
|
||||
|
@ -1200,13 +1200,10 @@ function createVideo(video, viewStyle) {
|
|||
${watchStatusIndicator}
|
||||
<span>${videoPublished} | ${videoDuration}</span>
|
||||
</div>
|
||||
<div class="video-desc-details">
|
||||
<div>
|
||||
<a href="/channel/${channelId}/"><h3>${channelName}</h3></a>
|
||||
<a class="video-more" href="/video/${videoId}/"><h2>${videoTitle}</h2></a>
|
||||
</div>
|
||||
<img id="${videoId}-button2" src="../static/img/icon-dot-menu.svg" alt="dot-menu-icon" data-id="${videoId}" data-context="video" onclick="showDotMenu(this)" class="dot-button" title="More actions">
|
||||
</div>
|
||||
<div>
|
||||
<a href="/channel/${channelId}/"><h3>${channelName}</h3></a>
|
||||
<a class="video-more" href="/video/${videoId}/"><h2>${videoTitle}</h2></a>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
const videoDiv = document.createElement('div');
|
||||
|
|
Loading…
Reference in New Issue