yt: increases speed
This commit is contained in:
		
							parent
							
								
									bde3e58618
								
							
						
					
					
						commit
						af5dc3b865
					
				
							
								
								
									
										11
									
								
								yt
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								yt
									
									
									
									
									
								
							@ -1,6 +1,6 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
 | 
					# Copyright (c) 2023, 2025 Emma Tebibyte <emma@tebibyte.media>
 | 
				
			||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
 | 
					# SPDX-License-Identifier: AGPL-3.0-or-later
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# This program is free software: you can redistribute it and/or modify it under
 | 
					# This program is free software: you can redistribute it and/or modify it under
 | 
				
			||||||
@ -230,7 +230,7 @@ queue() {
 | 
				
			|||||||
search() {
 | 
					search() {
 | 
				
			||||||
	test -z "$1" && usage 'search term [count]'
 | 
						test -z "$1" && usage 'search term [count]'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	results="$(yt-dlp "ytsearch$2:$1" --print "$FMT")"
 | 
						results="$(yt-dlp -isq --flat-playlist --print "$FMT" "ytsearch$2:$1")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cache "$(printf '%s\n' "$results" | sed -e 's/.*\[//g' -e 's/\]/ /g' \
 | 
						cache "$(printf '%s\n' "$results" | sed -e 's/.*\[//g' -e 's/\]/ /g' \
 | 
				
			||||||
		| tr -d '\n')" &
 | 
							| tr -d '\n')" &
 | 
				
			||||||
@ -247,9 +247,6 @@ search() {
 | 
				
			|||||||
			"copy")
 | 
								"copy")
 | 
				
			||||||
				wl-copy "$selection"
 | 
									wl-copy "$selection"
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
			"music")
 | 
					 | 
				
			||||||
				music "$selection"
 | 
					 | 
				
			||||||
				;;
 | 
					 | 
				
			||||||
			"play")
 | 
								"play")
 | 
				
			||||||
				play "$selection"
 | 
									play "$selection"
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
@ -301,7 +298,7 @@ verify() { # replaces videos with archived versions if they are not available
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		printf "%s: %s: Verifying playlist.\n" "$argv0" "$1" 1>&2
 | 
							printf "%s: %s: Verifying playlist.\n" "$argv0" "$1" 1>&2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for video in $(lines "$1"); do
 | 
							for video in $(lines "$1"); do {
 | 
				
			||||||
			if test -n "$(yt-dlp -s "$video" 2>&1 \
 | 
								if test -n "$(yt-dlp -s "$video" 2>&1 \
 | 
				
			||||||
				| grep -i -e 'video unavailable' -e 'private video' -e 'been removed')"
 | 
									| grep -i -e 'video unavailable' -e 'private video' -e 'been removed')"
 | 
				
			||||||
			then
 | 
								then
 | 
				
			||||||
@ -334,7 +331,7 @@ verify() { # replaces videos with archived versions if they are not available
 | 
				
			|||||||
				cache "$video" &
 | 
									cache "$video" &
 | 
				
			||||||
				archive "$video" &
 | 
									archive "$video" &
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		done
 | 
							} & done
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		shift
 | 
							shift
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user