@@ -51,7 +51,7 @@ get_tags() {
51
51
get_video_data_fallback () {
52
52
command -v kdialog > /dev/null
53
53
if [[ $? -eq 0 ]]; then
54
- DATA=$( kdialog --title ReadItLater --inputbox " description and duration (comma separated)" )
54
+ DATA=$( kdialog --title ReadItLater --inputbox " tags, description and duration (comma separated)" )
55
55
if [ $? -eq 0 ] && [ -n " $DATA " ]; then
56
56
echo " $DATA "
57
57
return 0
@@ -60,7 +60,7 @@ get_video_data_fallback() {
60
60
fi
61
61
command -v termux-setup-storage > /dev/null
62
62
if [[ $? -eq 0 ]]; then
63
- DATA=$( termux-dialog text -t " ReadItLater" -i " description and duration (comma separated)" | jq -r .text)
63
+ DATA=$( termux-dialog text -t " ReadItLater" -i " tags, description and duration (comma separated)" | jq -r .text)
64
64
if [ $? -eq 0 ] && [ -n " $DATA " ]; then
65
65
echo " $DATA "
66
66
return 0
@@ -118,25 +118,17 @@ process_youtube() {
118
118
return 0
119
119
fi
120
120
121
- custom_tags= ` get_tags `
121
+ values= $( get_video_data_fallback )
122
122
123
- if [[ " $url " =~ " playlist" ]]; then
124
- title=$( yt-dlp --skip-download --print playlist_title " $url " | uniq)
125
- rc=$?
126
- title=" $title playlist"
127
- else
128
- info=$( yt-dlp --skip-download --get-title --get-duration " $url " )
129
- rc=$?
130
- title=$( echo " $info " | sed -n ' 1p' )
131
- duration=$( echo " $info " | sed -n ' 2p' )
132
- fi
123
+ custom_tags=$( echo " $values " | cut -d" ," -f1 | tr -d ' ' )
124
+
125
+ title=$( echo " $values " | cut -d" ," -f2)
126
+ # remove trailing white spaces
127
+ title=$( echo $title )
128
+
129
+ duration_minutes=$( echo " $values " | cut -d" ," -f3 | tr -d ' ' )
130
+ duration=$(( duration_minutes * 60 ))
133
131
134
- if [ $rc -ne 0 ]; then
135
- values=$( get_video_data_fallback)
136
- title=$( echo " $values " | cut -d" ," -f1)
137
- duration_minutes=$( echo " $values " | cut -d" ," -f2)
138
- duration=$(( duration_minutes * 60 ))
139
- fi
140
132
if [ -z " $title " ] || [ -z " $duration " ]; then
141
133
$WARNING " Could not process link: missing title or duration"
142
134
exit 1
0 commit comments