gsettings set org.gnome.desktop.screensaver lock-enabled false
#!/bin/bash
if [ -z "$1" ];
then echo -e "\033[1m ply2m3u [-R]... [URL]\033[0m \nPlease, use \033[1m -r \033[0m option to reverse the playlist\nspecify the playlist link as argument\nhttps://www.youtube.com/playlist?list=PLj_5LD9rCCkQ4Q6NWQ3oYXIJufk7Oafiu\n" 1>&2
exit 1
fi
if [ -z "$2" ];
then URL="$1" ;ID="$(echo $1 | sed 's/.*=//g' | sed 's/&.*=//g')"
else URL="$2" ;ID="$(echo $2 | sed 's/.*=//g' | sed 's/&.*=//g')"
fi
if [[ "$1" = "-R" ]];
then REVERSE=true
else REVERSE=false
fi
TMPFILE=$(mktemp "/tmp/ply.tmp.XXXXXX") || {
echo "Temporary file creation failed" 1>&2
exit 1
}
COMMAND=""
if [[ -n $(type -p wget) ]];
then
COMMAND="wget -o /dev/null -O '$TMPFILE' '$URL'"
fi
if [ -z "$COMMAND" ] && [[ -n $(type -p curl) ]];
then
COMMAND="curl -s -o '$TMPFILE' '$URL'"
fi
if [ -z "$COMMAND" ];
then
echo "Please, install wget or curl to use this script" 1>&2
exit 1
fi
eval "$COMMAND"
### ИЗ ТАЙТЛА ПЛЕЙЛИСТА,БУДУДЕТ НАЗВАН ВЫХОДНОЙ ФАЙЛ
TITLE=$(grep "<title>.*" $TMPFILE | sed -r 's/.*>(.*) - YouTube.*/\1/')
#echo -e "===\n$TITLE\n==="
grep -e "^<tr.*<a href=\"/watch?v=.*$ID" "$TMPFILE" | sed 's/.*data-title=\"/\'$'\n''/g' | sed 's/\"/\'$'\n''/' | sed 's/.*watch/https:\/\/www.youtube.com\/watch/g' | sed 's/&.*//g' | grep -v '^$' > "ply_$TITLE.m3u"
CONTINUATION=$(grep 'continuation=' $TMPFILE | head -n1 | cut -d ';' -f2-3 | cut -d '"' -f 1 | cut -d '\' -f1)
while [[ "$CONTINUATION" =~ ^continuation.* ]]
do URL='https://www.youtube.com/browse_ajax?action_continuation=1&'$CONTINUATION
if [[ -n $(type -p wget) ]];
then wget -o /dev/null -O "$TMPFILE" "$URL"
else curl -s -o "$TMPFILE" "$URL"
fi
sed 's/\\n/\'$'\n''/g' "$TMPFILE" | grep -e "data-title=" | sed 's/.*data-title=\\"/\'$'\n''/g'| sed 's/\\"/\'$'\n''/'| sed 's/.*watch/https:\/\/www.youtube.com\//g'| sed 's/\\u0026amp.*//g' | grep -v '^$' >> "ply_$TITLE.m3u"
CONTINUATION=$(sed 's/action_continuation=1\\u0026amp;/\'$'\n''/g' $TMPFILE | tail -n1 | cut -d '\' -f1)
done
### УДАЛЕНИЕ ВРЕМЕННОГО ФАЙЛА
rm -f $TMPFILE
### ДОБАВЛЕНИЕ #EXTINF:0, К ЗАГОЛОВКАМ
sed -i -re 's/^(.*)/#EXTINF:0,\1/g' -e 's/#EXTINF:0,https/https/g' "ply_$TITLE.m3u"
### ДОБАВЛЕНИЕ #EXTM3U В ПЕРВУЮ СТРОКУ ФАЙЛА
sed -i -e '1 s/^/#EXTM3U\n/;' "ply_$TITLE.m3u"
### РЕВЕРС ПЛЕЙЛИСТА
if $REVERSE;
then perl -i -0ne 's/#EXTM3U\n//g;s/(#EXTINF.*)\n(http.*)/\2\n\1/g;$_.="#EXTM3U\n";print join("\n",reverse(split("\n"))),"\n";' "ply_$TITLE.m3u"
fi
echo -e "\n File was created successfully :)\n\033[1m $(pwd)/ply_$TITLE.m3u \033[0m"
#cat $TMPFILE
не открывается окно настроек или как???
https://forum.rosalinux.ru/viewtopic.php?t=9435
https://wiki.archlinux.org/index.php/Xfce#Lock_the...