diff options
| -rwxr-xr-x | article2pdf | 21 | ||||
| -rwxr-xr-x | logitech | 12 | ||||
| -rwxr-xr-x | mscz2pdfs | 2 | ||||
| -rwxr-xr-x | youboat | 32 | ||||
| -rwxr-xr-x | yt-channel-id | 4 | ||||
| -rwxr-xr-x | yt-dl-choose | 17 |
6 files changed, 71 insertions, 17 deletions
diff --git a/article2pdf b/article2pdf index 4259ee4..dcef441 100755 --- a/article2pdf +++ b/article2pdf @@ -11,11 +11,28 @@ html_file=`mktemp` user_agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0' curl --user-agent "$user_agent" --location --silent "$1" > "$html_file" -pdf_file=$pdfs_dir/`pup --file "$html_file" 'title text{}' \ +title=`pup --file "$html_file" 'title text{}' \ | grep -v '^\s*$' \ | head -n 1 \ - | sed -e 's/^ *//' -e 's/ *$//' -e 's/ /-/g'`.pdf + | sed -e 's/^ *//' -e 's/ *$//' -e 's/ /-/g'` +echo "title based on html: |$title|" + +if [ -z "$title" ]; then + title=${1##*/} + title=${title%.*} +fi + +echo "final title: $title" + +#pdf_file=$pdfs_dir/`pup --file "$html_file" 'title text{}' \ + #| grep -v '^\s*$' \ + #| head -n 1 \ + #| sed -e 's/^ *//' -e 's/ *$//' -e 's/ /-/g'`.pdf + +pdf_file="$pdfs_dir/$title.pdf" + +echo "pdf file: $pdf_file" if pandoc --request-header User-Agent:"$user_agent" "$1" --pdf-engine=xelatex -o "$pdf_file"; then exit 0 @@ -6,6 +6,9 @@ # there's only one webcam connected. # NOTE: when one of the parameters is set, auto-setting it by the webcam is # disabled. +# +# Getting device info: +# v4l2-ctl -d <device ID> --all device= exposure= @@ -30,9 +33,8 @@ if [ -z "$device" ]; then fi if [ -n "$exposure" ]; then - v4l2-ctl -d "$device" --set-ctrl exposure_auto=1 - v4l2-ctl -d "$device" --set-ctrl exposure_auto_priority=0 - v4l2-ctl -d "$device" --set-ctrl exposure_absolute="$exposure" + v4l2-ctl -d "$device" --set-ctrl auto_exposure=1 + v4l2-ctl -d "$device" --set-ctrl exposure_time_absolute="$exposure" fi if [ -n "$gain" ]; then @@ -40,11 +42,11 @@ if [ -n "$gain" ]; then fi if [ -n "$temperature" ]; then - v4l2-ctl -d "$device" --set-ctrl white_balance_temperature_auto=0 + v4l2-ctl -d "$device" --set-ctrl white_balance_automatic=0 v4l2-ctl -d "$device" --set-ctrl white_balance_temperature="$temperature" fi if [ -n "$focus" ]; then - v4l2-ctl -d "$device" --set-ctrl focus_auto=0 + v4l2-ctl -d "$device" --set-ctrl focus_automatic_absolute=0 v4l2-ctl -d "$device" --set-ctrl focus_absolute="$focus" fi @@ -23,7 +23,7 @@ base_filename=${score##*/} json=`mktemp "/tmp/tmp-XXXXXXX.json"` echo "putting json in $json" -musescore --score-parts-pdf "$score" > "$json" +mscore3 --score-parts-pdf "$score" > "$json" parts=`jq --raw-output '.parts[]' "$json"` @@ -0,0 +1,32 @@ +#!/bin/bash + +URLS_FILE=~/.config/newsboat/youtube-urls + +if [[ "$1" == "sub" ]]; then + if [[ -n "$2" ]]; then + link="$2" + else + echo 'Provide channel link:' + read link + fi + + html_file=`mktemp` + curl --silent $link > $html_file + channel_id=`yt-channel-id $link` + channel_name=`pup --file $html_file 'meta[property="og:title"]' attr{content}` + rm $html_file + + if [[ -z "$channel_id" ]]; then + echo "Failed to parse channel ID" + exit 1 + fi + + feed_url="https://www.youtube.com/feeds/videos.xml?channel_id=$channel_id" + + + echo "$feed_url video \"~$channel_name\"" >> "$URLS_FILE" + echo "Added channel: $channel_name" + exit 0 +fi + +newsboat -u "$URLS_FILE" -c ~/.local/share/newsboat/youtube-cache.db diff --git a/yt-channel-id b/yt-channel-id new file mode 100755 index 0000000..a412974 --- /dev/null +++ b/yt-channel-id @@ -0,0 +1,4 @@ +#!/bin/bash + +URL=$1 +curl --silent $URL | grep -Po 'channel_id=.{24}' | head -n 1 | cut -d'=' -f 2 diff --git a/yt-dl-choose b/yt-dl-choose index 7d33588..63a78a7 100755 --- a/yt-dl-choose +++ b/yt-dl-choose @@ -22,15 +22,14 @@ if [[ $NO_PLAYLIST ]]; then URL=`echo "$URL" | sed -e 's/&list=.*&/\&/'` fi -formats=`yt-dlp --list-formats $URL \ - | grep -v "audio only" \ - | grep -v "video only" \ - | grep -v mhtml \ - | sed '0,/---------/d' ` -format=`echo "$formats" | dmenu | cut -d' ' -f1` - -if [ -z "$format" ]; then +video_formats=`yt-dlp --list-formats $URL \ + | grep "video only" \ + | grep -v mhtml` +echo "video formats are:\n$video_formats" +video_format=`echo "$video_formats" | dmenu | cut -d' ' -f1` + +if [ -z "$video_format" ]; then exit 0; fi -mpv --ytdl-format=$format $1 +mpv --ytdl-format="$video_format+bestaudio" $URL |