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 \
G gitnext gitundo goodpasswd histogram mtrr mirrorpdf neno \
off pdfman plotpipe puniq ramusage rand rclean rina rn rrm \
shython sound-reload stdout swapout T timestamp tracefile \
transpose upsidedown vid w4it-for-port-open wifi-reload wssh \
ytv yyyymmdd
fxkill G gitnext gitundo goodpasswd histogram mtrr mirrorpdf \
neno off pdfman plotpipe puniq ramusage rand rclean rina rn \
rrm shython splitvideo sound-reload stdout swapout T \
timestamp tracefile transpose upsidedown vid \
w4it-for-port-open wifi-reload wssh ytv yyyymmdd
all: blink/blink.1 bsearch/bsearch.1 burncpu/burncpu.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 \
plotpipe/plotpipe.1 puniq/puniq.1 rand/rand.1 rina/rina.1 \
rn/rn.1 rrm/rrm.1 shython/shython.1 \
sound-reload/sound-reload.1 stdout/stdout.1 \
timestamp/timestamp.1 tracefile/tracefile.1 \
sound-reload/sound-reload.1 splitvideo/splitvideo.1 \
stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 \
transpose/transpose.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \
wifi-reload/wifi-reload.1 wssh/wssh.1 ytv/ytv.1 \
yyyymmdd/yyyymmdd.1
@ -25,3 +25,4 @@ install:
parallel eval ln -sf `pwd`/*/{} /usr/local/bin/{} ::: $(CMD)
mkdir -p /usr/local/share/man/man1
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
@ -55,8 +55,8 @@ List only normal files.
=item B<--local>
List only files in current directory. Useful to avoid matching at
system files.
List only files in current directory. Useful to avoid matching system
files.
=item B<-n>
@ -84,14 +84,14 @@ List only files once.
=item B<--read>
List only files being access for reading.
List only files being accessed for reading.
=item B<-w>
=item B<--write>
List only files being access for writing.
List only files being accessed for writing.
=back
@ -255,6 +255,7 @@ init_functions();
my @cmd = shell_quote(@ARGV);
my $dir = ".";
my $pid = $opt::pid ? "-p $opt::pid" : "";
my %seen;
# 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;
@ -493,3 +494,4 @@ sub my_dump(@) {
}
}
$opt::debug = $opt::all;

View file

@ -43,18 +43,20 @@ def mergeparts(tabs,part):
p2 = []
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)
spc = [ i.encode("utf-8")
for i in ("", " ", " ", " ", " ", " ", " ", " ") ]
def recur(pre,n):
if n == len(part)-1:
for i in ("", " ", " ", " ", " ", " ", " ", " "):
sha1 = (hashlib.sha1((pre+i+part[n]).encode("utf-8")).hexdigest())[0:searchlen];
for i in spc:
sha1 = (hashlib.sha1(pre+i+part[n]).hexdigest())[0:searchlen];
if sha1 in searchstrings:
print(hashlib.sha1((pre+i+part[n]).encode("utf-8")).hexdigest())
print(pre+i+part[n])
print(hashlib.sha1(pre+i+part[n]).hexdigest())
print((pre+i+part[n]).decode())
else:
for i in ("", " ", " ", " ", " ", " ", " ", " "):
for i in spc:
recur(pre+i+part[n],n+1)
bits = searchlen*4
@ -65,7 +67,7 @@ if tabs > len(part)-1:
exit(1);
part = mergeparts(tabs,part)
s="0123456789abcdef"
s = "0123456789abcdef"
# Chop at searchlen
searchstrings = [ i[0:searchlen] for i in
# Generate 111..1 222..2 .. fff..f

View file

@ -79,10 +79,8 @@ startnm() {
config() {
IF=$1
sudo bash -c 'cat >> /etc/resolv.conf' < /etc/resolvconf/resolv.conf.d/head
sudo iwconfig $IF essid Turris
#sudo iwconfig $IF essid olet
#sudo iwconfig $IF essid elverhoej
#sudo iwconfig $IF essid Leif
#sudo iwconfig wls1 essid Turris
#sudo iwconfig wls1 essid Leif
#sudo iwconfig wls1 essid SKYbroadbandCC95
sudo wpa_supplicant -c/etc/wpa_supplicant.conf -i$IF -d &
sudo dhclient $IF &
@ -90,11 +88,11 @@ config() {
stop
starthw
config wlp3s0
#startnm
IF=$(stdout iwconfig |perl -ane '/^\s|no wireless extension/ and next; print $F[0],"\n"')
iwconfig
config $IF
startnm
if tty -s ; then
# STDIN is terminal
true timeout 12 dmesg -Tw &
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 {
my $url = shift;
print "Playing $url\n";
if(-e $url) {
playfiles($url);
return;
}
if(not fork()) {
# Download in the background
system(qw(youtube-dl --all-subs --skip-download), @tor,$url);
@ -119,28 +161,7 @@ sub play {
# Mark as seen
map { $before{$_} = -M $_ } @new;
# Run VLC on the matching files
if($opt::kodi) {
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);
}
playfiles(@new);
@new = grep { not $before{$_} or $before{$_} > -M $_ } <*>;
}
}