From 0d152e8cf3f822037684e1d7e59bfca9449a0c34 Mon Sep 17 00:00:00 2001 From: rern Date: Fri, 16 Sep 2022 14:30:17 +0700 Subject: [PATCH 1/7] Update cmd.sh --- srv/http/bash/cmd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/http/bash/cmd.sh b/srv/http/bash/cmd.sh index 65e133095..b2561916e 100644 --- a/srv/http/bash/cmd.sh +++ b/srv/http/bash/cmd.sh @@ -315,7 +315,7 @@ webradioCount() { [[ $1 == dabradio ]] && type=dabradio || type=webradio count=$( find -L $dirdata/$type -type f ! -path '*/img/*' | wc -l ) pushstream radiolist '{"type":"'$type'", "count":'$count'}' - [[ $1 == dabradio ]] && count+=, + grep -q "$type.*,"$ $dirmpd/counts && count+=, sed -i -E 's/("'$type'": ).*/\1'$count'/' $dirmpd/counts } webradioPlaylistVerify() { From 615b69a2c8779d8267c28f44fac890e2d082f511 Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 17 Sep 2022 00:57:02 +0700 Subject: [PATCH 2/7] Update mpdlibrary.php --- srv/http/mpdlibrary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index 473633513..455eb6186 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -146,7 +146,6 @@ break; case 'radio': $dir = '/srv/http/data/'.$gmode.'/'; - $dir.= $string; $subdirs = []; $files = []; $indexes = []; @@ -157,6 +156,7 @@ , $files ); } else { $searchmode = 0; + $dir.= $string; exec( 'ls -1 "'.$dir.'" \ | grep -E -v "^img|\.jpg$|\.gif$"' , $lists ); From aa8fc855705906d781a1c6237a1d53798465be95 Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 17 Sep 2022 01:39:24 +0700 Subject: [PATCH 3/7] Update mpdlibrary.php --- srv/http/mpdlibrary.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index 455eb6186..c4d1fe02f 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -392,10 +392,10 @@ function htmlRadio( $subdirs, $files, $dir ) { usort( $array, function( $a, $b ) { return strnatcasecmp( $a->sort, $b->sort ); } ); - $path = substr( $dir, 9 ); // /srv/http/data/webradio/... > /data/webradio/.. - $lipath = substr( $path, 15 ); // /data/webradio/path.. > path - $lipath.= $lipath ? '/'.$subdir : $subdir; + $path = str_replace( '/srv/http/data/'.$gmode.'/', '', $dir ); // /srv/http/data/webradio/path > path + if ( $path ) $path.= '/'; foreach( $array as $each ) { + $subdir = $each->subdir; if ( count( $files ) ) { $html.= '
  • '; } else { @@ -403,10 +403,9 @@ function htmlRadio( $subdirs, $files, $dir ) { $indexes[] = $index; $html.= '
  • '; } - $subdir = $each->subdir; - $thumbsrc = rawurlencode( $path.$subdir.'/thumb.'.time().'.jpg' ); + $thumbsrc = rawurlencode( '/data/'.$gmode.'/'.$subdir.'/thumb.'.time().'.jpg' ); $html.= ' - '.$lipath.' + '.$path.$subdir.' '.$subdir.'
  • '; } From c11ad1dc704c0c349cb39ea7f9534e22a58a6371 Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 17 Sep 2022 01:50:52 +0700 Subject: [PATCH 4/7] Update mpdlibrary.php --- srv/http/mpdlibrary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index c4d1fe02f..e46d4c2e4 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -392,7 +392,7 @@ function htmlRadio( $subdirs, $files, $dir ) { usort( $array, function( $a, $b ) { return strnatcasecmp( $a->sort, $b->sort ); } ); - $path = str_replace( '/srv/http/data/'.$gmode.'/', '', $dir ); // /srv/http/data/webradio/path > path + $path = str_replace( '/srv/http/data/'.$gmode.'/', '', $dir ); // /srv/http/data/webradio/path/to > path/to if ( $path ) $path.= '/'; foreach( $array as $each ) { $subdir = $each->subdir; From 493434175ecbe880a56d19e837e6d797e284aa5a Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 17 Sep 2022 02:02:31 +0700 Subject: [PATCH 5/7] Update mpdlibrary.php --- srv/http/mpdlibrary.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index e46d4c2e4..6392cc270 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -381,7 +381,6 @@ function htmlRadio( $subdirs, $files, $dir ) { global $mode; global $gmode; global $html; - $dirimg = '/data/'.$gmode.'/img/'; if ( count( $subdirs ) ) { foreach( $subdirs as $subdir ) { $each = ( object )[]; @@ -392,7 +391,7 @@ function htmlRadio( $subdirs, $files, $dir ) { usort( $array, function( $a, $b ) { return strnatcasecmp( $a->sort, $b->sort ); } ); - $path = str_replace( '/srv/http/data/'.$gmode.'/', '', $dir ); // /srv/http/data/webradio/path/to > path/to + $path = str_replace( '/srv/http/data/'.$gmode.'/', '', $dir ); // /srv/http/data/webradio/path/to > path/to if ( $path ) $path.= '/'; foreach( $array as $each ) { $subdir = $each->subdir; @@ -403,7 +402,7 @@ function htmlRadio( $subdirs, $files, $dir ) { $indexes[] = $index; $html.= '
  • '; } - $thumbsrc = rawurlencode( '/data/'.$gmode.'/'.$subdir.'/thumb.'.time().'.jpg' ); + $thumbsrc = rawurlencode( "/data/$gmode/$subdir/thumb.time().jpg" ); $html.= ' '.$path.$subdir.' '.$subdir.' @@ -425,14 +424,13 @@ function htmlRadio( $subdirs, $files, $dir ) { usort( $array, function( $a, $b ) { return strnatcasecmp( $a->sort, $b->sort ); } ); - $time = time(); foreach( $array as $each ) { $index = strtoupper( mb_substr( $each->sort, 0, 1, 'UTF-8' ) ); $indexes[] = $index; $url = $each->url; $urlname = str_replace( '/', '|', $url ); $datacharset = $each->charset ? ' data-charset="'.$each->charset.'"' : ''; - $thumbsrc = rawurlencode( $dirimg.$urlname.'-thumb.'.$time.'.jpg' ); + $thumbsrc = rawurlencode( '/data/'.$gmode.'/img/'.$urlname.'-thumb.'.time().'.jpg' ); $liname = $each->name; $name = $searchmode ? preg_replace( "/($string)/i", '$1', $liname ) : $liname; $html.= '
  • From 686ac9fcd80be7ae5a01cf7ec0cfe79de4d2beb3 Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 17 Sep 2022 02:10:00 +0700 Subject: [PATCH 6/7] Update mpdlibrary.php --- srv/http/mpdlibrary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/http/mpdlibrary.php b/srv/http/mpdlibrary.php index 6392cc270..2aea407b0 100644 --- a/srv/http/mpdlibrary.php +++ b/srv/http/mpdlibrary.php @@ -427,9 +427,9 @@ function htmlRadio( $subdirs, $files, $dir ) { foreach( $array as $each ) { $index = strtoupper( mb_substr( $each->sort, 0, 1, 'UTF-8' ) ); $indexes[] = $index; + $datacharset = $each->charset ? ' data-charset="'.$each->charset.'"' : ''; $url = $each->url; $urlname = str_replace( '/', '|', $url ); - $datacharset = $each->charset ? ' data-charset="'.$each->charset.'"' : ''; $thumbsrc = rawurlencode( '/data/'.$gmode.'/img/'.$urlname.'-thumb.'.time().'.jpg' ); $liname = $each->name; $name = $searchmode ? preg_replace( "/($string)/i", '$1', $liname ) : $liname; From a3ae97488e4089899330676ee48e0992faaf549b Mon Sep 17 00:00:00 2001 From: rern Date: Sat, 17 Sep 2022 07:55:18 +0700 Subject: [PATCH 7/7] Update cmd-list.sh --- srv/http/bash/cmd-list.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srv/http/bash/cmd-list.sh b/srv/http/bash/cmd-list.sh index 4eb854d9c..f4c6933a2 100644 --- a/srv/http/bash/cmd-list.sh +++ b/srv/http/bash/cmd-list.sh @@ -110,7 +110,7 @@ latest=$( cat "$dirmpd/latest" 2> /dev/null | wc -l ) for mode in NAS SD USB; do printf -v $mode '%s' $( mpc ls $mode 2> /dev/null | wc -l ) done -dabradio=$( find -L $dirdabradio -type f ! -path '*/img/*' | wc -l ) +dabradio=$( find -L $dirdata/dabradio -type f ! -path '*/img/*' 2> /dev/null | wc -l ) # no $dirdabradio if dab not installed playlists=$( ls -1 $dirplaylists | wc -l ) song=$( mpc stats | awk '/^Songs/ {print $NF}' ) webradio=$( find -L $dirwebradio -type f ! -path '*/img/*' | wc -l )