mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 20:00:15 +00:00
add new ta_playlist index and task to find playlists of channel
This commit is contained in:
parent
1bfb912d09
commit
eaf107d0d2
@ -509,10 +509,13 @@ class YoutubePlaylist:
|
|||||||
|
|
||||||
all_members = []
|
all_members = []
|
||||||
for idx, entry in enumerate(playlist["entries"]):
|
for idx, entry in enumerate(playlist["entries"]):
|
||||||
|
uploader = entry["uploader"]
|
||||||
|
if not uploader:
|
||||||
|
continue
|
||||||
to_append = {
|
to_append = {
|
||||||
"youtube_id": entry["id"],
|
"youtube_id": entry["id"],
|
||||||
"title": entry["title"],
|
"title": entry["title"],
|
||||||
"uploader": entry["uploader"],
|
"uploader": uploader,
|
||||||
"idx": idx,
|
"idx": idx,
|
||||||
}
|
}
|
||||||
all_members.append(to_append)
|
all_members.append(to_append)
|
||||||
|
@ -154,6 +154,15 @@ INDEX_CONFIG = [
|
|||||||
"number_of_replicas": "0",
|
"number_of_replicas": "0",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"index_name": "playlist",
|
||||||
|
"expected_map": {
|
||||||
|
"playlist_description": {"type": "text"},
|
||||||
|
},
|
||||||
|
"expected_set": {
|
||||||
|
"number_of_replicas": "0",
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ from celery import Celery, shared_task
|
|||||||
from home.src.config import AppConfig
|
from home.src.config import AppConfig
|
||||||
from home.src.download import ChannelSubscription, PendingList, VideoDownloader
|
from home.src.download import ChannelSubscription, PendingList, VideoDownloader
|
||||||
from home.src.helper import RedisArchivist, RedisQueue, UrlListParser
|
from home.src.helper import RedisArchivist, RedisQueue, UrlListParser
|
||||||
|
from home.src.index import YoutubeChannel, YoutubePlaylist
|
||||||
from home.src.index_management import backup_all_indexes, restore_from_backup
|
from home.src.index_management import backup_all_indexes, restore_from_backup
|
||||||
from home.src.reindex import (
|
from home.src.reindex import (
|
||||||
ManualImport,
|
ManualImport,
|
||||||
@ -198,3 +199,15 @@ def subscribe_to(url_str):
|
|||||||
RedisArchivist().set_message(
|
RedisArchivist().set_message(
|
||||||
"progress:subscribe", {"status": "subscribing"}
|
"progress:subscribe", {"status": "subscribing"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@shared_task()
|
||||||
|
def index_channel_playlists(channel_id):
|
||||||
|
"""add all playlists of channel to index"""
|
||||||
|
channel_handler = YoutubeChannel(channel_id)
|
||||||
|
all_playlists = channel_handler.get_all_playlists()
|
||||||
|
|
||||||
|
for playlist_id, playlist_title in all_playlists:
|
||||||
|
print("add playlist: " + playlist_title)
|
||||||
|
playlist_handler = YoutubePlaylist(playlist_id)
|
||||||
|
playlist_handler.upload_to_es()
|
||||||
|
Loading…
Reference in New Issue
Block a user