mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Show info instead of empty playlist when possible
This commit is contained in:
parent
25ba5bda62
commit
29a6291957
1 changed files with 12 additions and 2 deletions
|
@ -401,12 +401,17 @@ get "/playlist" do |env|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
playlist = fetch_playlist(plid)
|
playlist = fetch_playlist(plid)
|
||||||
videos = fetch_playlist_videos(plid, page, playlist.video_count)
|
|
||||||
rescue ex
|
rescue ex
|
||||||
error_message = ex.message
|
error_message = ex.message
|
||||||
next templated "error"
|
next templated "error"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
videos = fetch_playlist_videos(plid, page, playlist.video_count)
|
||||||
|
rescue ex
|
||||||
|
videos = [] of PlaylistVideo
|
||||||
|
end
|
||||||
|
|
||||||
templated "playlist"
|
templated "playlist"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2872,12 +2877,17 @@ get "/api/v1/playlists/:plid" do |env|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
playlist = fetch_playlist(plid)
|
playlist = fetch_playlist(plid)
|
||||||
videos = fetch_playlist_videos(plid, page, playlist.video_count)
|
|
||||||
rescue ex
|
rescue ex
|
||||||
error_message = {"error" => "Playlist is empty"}.to_json
|
error_message = {"error" => "Playlist is empty"}.to_json
|
||||||
halt env, status_code: 404, response: error_message
|
halt env, status_code: 404, response: error_message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
videos = fetch_playlist_videos(plid, page, playlist.video_count)
|
||||||
|
rescue ex
|
||||||
|
videos = [] of PlaylistVideo
|
||||||
|
end
|
||||||
|
|
||||||
response = JSON.build do |json|
|
response = JSON.build do |json|
|
||||||
json.object do
|
json.object do
|
||||||
json.field "title", playlist.title
|
json.field "title", playlist.title
|
||||||
|
|
Loading…
Reference in a new issue