Column 2 is not always basename.L18L wrote:Why 3 columns?
Preferable it collects information from meta tags or m3u-file.
Else, I find this excellent!!!!!L18L wrote:Where is $1 ? $1 is for pMusic internal redirectionzigbert wrote:Also, what we want is to define a alternative max value to find timestamps in a specific period. - Like february 2012. Let's say that is $4.
Here is a solution using $1 and $2 timestamp from and -to
#!/bin/ash
#additional output filename only=basename
#TIMESTAMP from to
#
LANG=C
#
FIND_FROM=$1 #timestamp
FIND_TO=$2
awk -F, -v TS1=$FIND_FROM -v TS2=$FIND_TO '{
split($1, a, "|"); $1=a[2] # fix first entry
max=NF; min=0;
while (max-min > 1) {
i=int( (max+min)/2 )
if (TS1 >= $i) min = i
else max = i
}
from=NF-min
max=NF; min=0;
while (max-min > 1) {
i=int( (max+min)/2 )
if (TS2 >= $i) min = i
else max = i
}
to=NF-min
variable 'to' is never 0, even if zero hits
num=split (a[1], b , "/")
print a[1], b[num], from-to
}' database.txt
And our thanks go to: jamesbondzigbert wrote:Else, I find this excellent!!!!!