ytv: Re-play is now default action.

This commit is contained in:
Ole Tange 2019-10-12 22:20:20 +02:00
parent 70ae9392fb
commit 3af3b34a1d
6 changed files with 78 additions and 49 deletions

View file

@ -1,9 +1,9 @@
CMD = blink bsearch burncpu duplicate-packets em encdir field forever \ CMD = blink bsearch burncpu duplicate-packets em encdir field forever \
G gitnext gitundo goodpasswd histogram mtrr mirrorpdf neno \ fxkill G gitnext gitundo goodpasswd histogram mtrr mirrorpdf \
off pdfman plotpipe puniq ramusage rand rclean rina rn rrm \ neno off pdfman plotpipe puniq ramusage rand rclean rina rn \
shython sound-reload stdout swapout T timestamp tracefile \ rrm shython splitvideo sound-reload stdout swapout T \
transpose upsidedown vid w4it-for-port-open wifi-reload wssh \ timestamp tracefile transpose upsidedown vid \
ytv yyyymmdd w4it-for-port-open wifi-reload wssh ytv yyyymmdd
all: blink/blink.1 bsearch/bsearch.1 burncpu/burncpu.1 \ all: blink/blink.1 bsearch/bsearch.1 burncpu/burncpu.1 \
encdir/encdir.1 G/G.1 gitnext/gitnext.1 gitundo/gitundo.1 \ encdir/encdir.1 G/G.1 gitnext/gitnext.1 gitundo/gitundo.1 \
@ -11,8 +11,8 @@ all: blink/blink.1 bsearch/bsearch.1 burncpu/burncpu.1 \
mirrorpdf/mirrorpdf.1 neno/neno.1 off/off.1 pdfman/pdfman.1 \ mirrorpdf/mirrorpdf.1 neno/neno.1 off/off.1 pdfman/pdfman.1 \
plotpipe/plotpipe.1 puniq/puniq.1 rand/rand.1 rina/rina.1 \ plotpipe/plotpipe.1 puniq/puniq.1 rand/rand.1 rina/rina.1 \
rn/rn.1 rrm/rrm.1 shython/shython.1 \ rn/rn.1 rrm/rrm.1 shython/shython.1 \
sound-reload/sound-reload.1 stdout/stdout.1 \ sound-reload/sound-reload.1 splitvideo/splitvideo.1 \
timestamp/timestamp.1 tracefile/tracefile.1 \ stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 \
transpose/transpose.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \ transpose/transpose.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \
wifi-reload/wifi-reload.1 wssh/wssh.1 ytv/ytv.1 \ wifi-reload/wifi-reload.1 wssh/wssh.1 ytv/ytv.1 \
yyyymmdd/yyyymmdd.1 yyyymmdd/yyyymmdd.1
@ -25,3 +25,4 @@ install:
parallel eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: $(CMD) parallel eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: $(CMD)
mkdir -p /usr/local/share/man/man1 mkdir -p /usr/local/share/man/man1
parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1 parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1
ln -s `pwd`/splitvideo/dotlocal/share/vlc/lua/extensions/splitvideo.lua $(HOME)/.local/share/vlc/lua/extensions/splitvideo.lua

5
fxkill/fxkill Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
# Kill firefox content processes
ps aux |G firefox contentproc childID -v grep |field 2 | xargs -r kill

View file

@ -1,4 +1,4 @@
#!/usr/bin/perl #!/usr/bin/perl -w
=head1 NAME =head1 NAME
@ -55,8 +55,8 @@ List only normal files.
=item B<--local> =item B<--local>
List only files in current directory. Useful to avoid matching at List only files in current directory. Useful to avoid matching system
system files. files.
=item B<-n> =item B<-n>
@ -84,14 +84,14 @@ List only files once.
=item B<--read> =item B<--read>
List only files being access for reading. List only files being accessed for reading.
=item B<-w> =item B<-w>
=item B<--write> =item B<--write>
List only files being access for writing. List only files being accessed for writing.
=back =back
@ -255,6 +255,7 @@ init_functions();
my @cmd = shell_quote(@ARGV); my @cmd = shell_quote(@ARGV);
my $dir = "."; my $dir = ".";
my $pid = $opt::pid ? "-p $opt::pid" : ""; my $pid = $opt::pid ? "-p $opt::pid" : "";
my %seen;
# BUG: If command gives output on stderr that can confuse the strace output # BUG: If command gives output on stderr that can confuse the strace output
open(IN, "-|", "strace -ff $pid -e trace=file @cmd 2>&1 >/dev/null") || die; open(IN, "-|", "strace -ff $pid -e trace=file @cmd 2>&1 >/dev/null") || die;
@ -493,3 +494,4 @@ sub my_dump(@) {
} }
} }
$opt::debug = $opt::all;

View file

@ -43,18 +43,20 @@ def mergeparts(tabs,part):
p2 = [] p2 = []
for i in range(len(x)-1): for i in range(len(x)-1):
p2.append("".join(part[x[i]:x[i+1]])) p2.append(("".join(part[x[i]:x[i+1]])).encode("utf-8"))
return(p2) return(p2)
spc = [ i.encode("utf-8")
for i in ("", " ", " ", " ", " ", " ", " ", " ") ]
def recur(pre,n): def recur(pre,n):
if n == len(part)-1: if n == len(part)-1:
for i in ("", " ", " ", " ", " ", " ", " ", " "): for i in spc:
sha1 = (hashlib.sha1((pre+i+part[n]).encode("utf-8")).hexdigest())[0:searchlen]; sha1 = (hashlib.sha1(pre+i+part[n]).hexdigest())[0:searchlen];
if sha1 in searchstrings: if sha1 in searchstrings:
print(hashlib.sha1((pre+i+part[n]).encode("utf-8")).hexdigest()) print(hashlib.sha1(pre+i+part[n]).hexdigest())
print(pre+i+part[n]) print((pre+i+part[n]).decode())
else: else:
for i in ("", " ", " ", " ", " ", " ", " ", " "): for i in spc:
recur(pre+i+part[n],n+1) recur(pre+i+part[n],n+1)
bits = searchlen*4 bits = searchlen*4

View file

@ -79,10 +79,8 @@ startnm() {
config() { config() {
IF=$1 IF=$1
sudo bash -c 'cat >> /etc/resolv.conf' < /etc/resolvconf/resolv.conf.d/head sudo bash -c 'cat >> /etc/resolv.conf' < /etc/resolvconf/resolv.conf.d/head
sudo iwconfig $IF essid Turris #sudo iwconfig wls1 essid Turris
#sudo iwconfig $IF essid olet #sudo iwconfig wls1 essid Leif
#sudo iwconfig $IF essid elverhoej
#sudo iwconfig $IF essid Leif
#sudo iwconfig wls1 essid SKYbroadbandCC95 #sudo iwconfig wls1 essid SKYbroadbandCC95
sudo wpa_supplicant -c/etc/wpa_supplicant.conf -i$IF -d & sudo wpa_supplicant -c/etc/wpa_supplicant.conf -i$IF -d &
sudo dhclient $IF & sudo dhclient $IF &
@ -90,11 +88,11 @@ config() {
stop stop
starthw starthw
config wlp3s0 IF=$(stdout iwconfig |perl -ane '/^\s|no wireless extension/ and next; print $F[0],"\n"')
#startnm iwconfig
config $IF
startnm
if tty -s ; then if tty -s ; then
# STDIN is terminal # STDIN is terminal
true timeout 12 dmesg -Tw & true timeout 12 dmesg -Tw &
fi fi
#config wlp3s0
#config wlx0016e63a51cb

65
ytv/ytv
View file

@ -86,10 +86,52 @@ if(not @ARGV) {
} }
} }
sub playfiles {
my @files = @_;
if($opt::kodi) {
my @existing =
uniq(
grep { -f $_ }
map { $a=$b=$_; $b=~s/.part//; s/.temp//; $a,$b,$_ } @files
);
for (my $i = 0; $i <= $#existing; $i++) {
my $answer;
$_ = $existing[$i];
do {
print "KODI playing $_\n";
if(not fork()) {
exec("idok", $_);
}
print "Press (r)etry, (d)elete, (p)revious, (n)ext\n";
$answer = undef;
while(not defined $answer) {
open(my $tty_fh, "<", "/dev/tty") ||
::die_bug("interactive-tty");
$answer = <$tty_fh>;
close $tty_fh;
if($answer =~ /d/i) {
unlink $_;
}
if($answer =~ /p/i) {
$i -= 2;
}
}
} while($answer =~ /^$|r/i);
}
} else {
system("vlc", map { $a=$b=$_; $b=~s/.part//; s/.temp//; $a,$b,$_ } @files);
}
}
sub play { sub play {
my $url = shift; my $url = shift;
print "Playing $url\n"; print "Playing $url\n";
if(-e $url) {
playfiles($url);
return;
}
if(not fork()) { if(not fork()) {
# Download in the background # Download in the background
system(qw(youtube-dl --all-subs --skip-download), @tor,$url); system(qw(youtube-dl --all-subs --skip-download), @tor,$url);
@ -119,28 +161,7 @@ sub play {
# Mark as seen # Mark as seen
map { $before{$_} = -M $_ } @new; map { $before{$_} = -M $_ } @new;
# Run VLC on the matching files # Run VLC on the matching files
if($opt::kodi) { playfiles(@new);
for(uniq(map { $a=$b=$_; $b=~s/.part//; s/.temp//; $a,$b,$_ } @new)) {
my $answer;
do {
print "KODI playing $_\n";
if(not fork()) {
exec("idok", $_);
}
print "Press (r)etry, (d)elete, (n)ext\n";
while(not $answer) {
open(my $tty_fh, "<", "/dev/tty") || ::die_bug("interactive-tty");
$answer = <$tty_fh>;
close $tty_fh;
if($answer =~ /d/i) {
unlink $_;
}
}
} while($answer =~ /r/i);
}
} else {
system("vlc", map { $a=$b=$_; $b=~s/.part//; s/.temp//; $a,$b,$_ } @new);
}
@new = grep { not $before{$_} or $before{$_} > -M $_ } <*>; @new = grep { not $before{$_} or $before{$_} > -M $_ } <*>;
} }
} }