diff --git a/routes.sh b/routes.sh new file mode 100644 index 0000000..978097b --- /dev/null +++ b/routes.sh @@ -0,0 +1,7 @@ +#router "/profile/:user" "app/webroot/index.shs" +#router "/uwu" "owo" + +router "/watch" "${cfg[namespace]}/webroot/watch.shs" +router "/channel/:id" "${cfg[namespace]}/webroot/channel.shs" +router "/user/:user" "${cfg[namespace]}/webroot/channel.shs" +router "/playlist" "${cfg[namespace]}/webroot/playlist.shs" diff --git a/webroot/channel.shs b/webroot/channel.shs index c4bac65..5c0c541 100644 --- a/webroot/channel.shs +++ b/webroot/channel.shs @@ -1,7 +1,12 @@ #!/bin/bash -if [[ ${get_data[id]} ]]; then + +if [[ "${params[id]}" ]]; then + data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/channel/${params[id]}") +elif [[ "${params[user]}" ]]; then + data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/user/${params[user]}") +elif [[ "${get_data[id]}" ]]; then data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/channel/${get_data[id]}") -elif [[ ${get_data[name]} ]]; then +elif [[ "${get_data[name]}" ]]; then data=$(haruhi-dl -J --flat-playlist "https://www.youtube.com/user/${get_data[name]}") else echo "Please specify either id or name" diff --git a/webroot/playlist.shs b/webroot/playlist.shs index d210b15..11acc62 100644 --- a/webroot/playlist.shs +++ b/webroot/playlist.shs @@ -1,10 +1,10 @@ #!/bin/bash -title=$(curl https://www.youtube.com/feeds/videos.xml?playlist_id=${get_data[id]} | grep title | head -n 1 | sed -s 's/