Skip to content

Commit

Permalink
Merge pull request #987 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Aug 14, 2022
2 parents 06cc4a2 + 147b9d3 commit fd732e7
Show file tree
Hide file tree
Showing 22 changed files with 299 additions and 292 deletions.
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

alias=r1

# 20220810
! grep -q bluez-utils /etc/pacman.conf && sed -i '/#IgnorePkg/ a\IgnorePkg = bluez-utils' /etc/pacman.conf
# 20220814
sed -i '/bluez-utils/ d' /etc/pacman.conf

# 20220805
dirdata=/srv/http/data
Expand Down
1 change: 1 addition & 0 deletions srv/http/assets/css/info.css
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ hr {
}
#infoContent .bklabel {
height: auto;
line-height: 30px;
}
#infoTopBg {
width: 100%;
Expand Down
31 changes: 17 additions & 14 deletions srv/http/assets/js/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ function bookmarkNew() {
}
, ok : function() {
var name = infoVal();
$.post( cmdphp, {
cmd : 'bookmark'
, path : path
, name : name
, coverart : coverart
}, function( std ) {
bash( [ 'bookmarkadd', name, path, coverart ], function( std ) {
if ( std == -1 ) {
bannerHide();
info( {
Expand All @@ -46,9 +41,10 @@ function bookmarkNew() {
+'<br><wh>'+ path +'</wh>'
+'<br><br><wh>'+ name +'</wh> already exists.'
} );
} else {
banner( 'Bookmark Added', path, 'bookmark' );
}
} );
banner( 'Bookmark Added', path, 'bookmark' );
}
} );
} );
Expand Down Expand Up @@ -630,19 +626,26 @@ $( '.contextmenu a, .contextmenu .submenu' ).click( function() {
case 'wrdirdelete':
var path = G.list.li.find( '.lipath' ).text();
info( {
icon : 'webradio'
, title : 'Web Radio Delete'
icon : G.mode
, title : 'Delete Folder'
, message : 'Folder:'
+'<br><wh>'+ path +'</wh>'
, oklabel : '<i class="fa fa-minus-circle"></i>Delete'
, okcolor : red
, ok : function() {
bash( [ 'wrdirdelete', path ], function( std ) {
bash( [ 'wrdirdelete', path, G.mode ], function( std ) {
if ( std == -1 ) {
info( {
icon : 'webradio'
, title : 'Web Radio Delete'
, message : 'Folder <wh>'+ path +'</wh> not empty.'
, message : 'Folder not empty:'
+'<br><wh>'+ path +'</wh>'
+'<br>Confirm delete?'
, oklabel : '<i class="fa fa-minus-circle"></i>Delete'
, okcolor : red
, ok : function() {
bash( [ 'wrdirdelete', path, G.mode, 'noconfirm' ] );
}
} );
}
} );
Expand All @@ -654,16 +657,16 @@ $( '.contextmenu a, .contextmenu .submenu' ).click( function() {
var name = path.pop();
var path = path.join( '/' );
info( {
icon : 'webradio'
, title : 'Web Radio Rename'
icon : G.mode
, title : 'Rename Folder'
, textlabel : 'Name'
, focus : 0
, values : name
, checkblank : 1
, checkchange : 1
, oklabel : 'Rename'
, ok : function() {
bash( [ 'wrdirrename', path, name, infoVal() ] );
bash( [ 'wrdirrename', path, name, infoVal(), G.mode ] );
}
} );
return
Expand Down
20 changes: 11 additions & 9 deletions srv/http/assets/js/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function contextmenuLibrary( $li, $target ) {
$li.addClass( 'active' );
return
}
var filemode = [ 'nas', 'sd', 'usb', 'webradio' ].includes( G.mode );
var filemode = [ 'nas', 'sd', 'usb', 'dabradio', 'webradio' ].includes( G.mode );
$menu.find( '.playnext, .replace' ).toggleClass( 'hide', !G.status.pllength );
$menu.find( '.replace' ).next().toggleClass( 'hide', !G.status.pllength );
$menu.find( '.refresh-library' ).toggleClass( 'hide', !( 'updating_db' in G.status ) );
Expand Down Expand Up @@ -630,15 +630,17 @@ function imageLoad( list ) {
$this.attr( 'src', src );
} );
} else {
if ( G.mode.slice( -5 ) === 'radio' ) {
var mode = G.mode;
var menumode = 'webradio';
} else {
var mode = 'folder';
var menumode = 'folder';
}
var radio = G.mode.slice( -5 ) === 'radio';
$lazyload.off( 'error' ).on( 'error', function() {
$( this ).replaceWith( '<i class="fa fa-'+ mode +' lib-icon" data-target="#menu-'+ menumode +'"></i>' );
var $this = $( this );
var dir = $this.parent().hasClass( 'dir' );
var mode = dir ? 'folder' : G.mode;
if ( radio ) {
var menu = dir ? 'wrdir' : 'webradio';
} else {
var menu = 'folder';
}
$this.replaceWith( '<i class="fa fa-'+ mode +' lib-icon" data-target="#menu-'+ menu +'"></i>' );
} );
}
} else {
Expand Down
42 changes: 16 additions & 26 deletions srv/http/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ $( '#lib-mode-list' ).on( 'click', '.mode-bookmark', function( e ) { // delegate
} ).on( 'click', '.bk-remove', function() {
var $this = $( this ).parent();
var path = $this.find( '.lipath' ).text();
var name = $this.find( '.bklabel' ).text() || path.split( '/' ).pop();
var name = $this.find( '.label' ).text() || path.split( '/' ).pop();
var $img = $this.find( 'img' );
if ( $img.length ) {
var src = $img.attr( 'src' );
Expand All @@ -1461,36 +1461,26 @@ $( '#lib-mode-list' ).on( 'click', '.mode-bookmark', function( e ) { // delegate
, okcolor : red
, ok : function() {
G.bookmarkedit = 1;
$.post( cmdphp, {
cmd : 'bookmarkremove'
, path : path
, delete : name
} );
$this.parent().remove();
bash( [ 'bookmarkremove', name, path ] );
}
} );
} ).on( 'click', '.bk-rename', function() {
var $this = $( this ).parent();
var path = $this.find( '.lipath' ).text();
var name = $this.find( '.bklabel' ).text() || path.split( '/' ).pop();
var name = $this.find( '.label' ).text() || path.split( '/' ).pop();
info( {
icon : 'bookmark'
, title : 'Rename Bookmark'
, message : '<div class="infobookmark"><i class="fa fa-bookmark bookmark"></i>'
icon : 'bookmark'
, title : 'Rename Bookmark'
, message : '<div class="infobookmark"><i class="fa fa-bookmark bookmark"></i>'
+'<br><span class="bklabel">'+ name +'</span></div>'
, textlabel : 'To:'
, values : name
, checkblank : 1
, oklabel : '<i class="fa fa-flash"></i>Rename'
, ok : function() {
, textlabel : 'To:'
, values : name
, checkblank : 1
, checkchanged : 1
, oklabel : '<i class="fa fa-flash"></i>Rename'
, ok : function() {
var newname = infoVal();
$.post( cmdphp, {
cmd : 'bookmarkrename'
, path : path
, name : name
, rename : newname
} );
$this.find( '.bklabel' ).text( newname );
bash( [ 'bookmarkrename', name, newname, path ] );
}
} );
} ).on( 'click', '.bk-cover .iconcover', function() {
Expand Down Expand Up @@ -1522,7 +1512,7 @@ $( '#lib-mode-list' ).on( 'click', '.mode-bookmark', function( e ) { // delegate
, buttonlabel : !thumbnail ? '' : '<i class="fa fa-bookmark"></i>Default'
, buttoncolor : !thumbnail ? '' : orange
, button : !thumbnail ? '' : function() {
bash( [ 'bookmarkreset', imagepath, name ] );
bash( [ 'bookmarkcoverreset', imagepath, name ] );
}
, ok : function() {
imageReplace( imagepath +'/coverart', 'bookmark', name ); // no ext
Expand All @@ -1532,7 +1522,7 @@ $( '#lib-mode-list' ).on( 'click', '.mode-bookmark', function( e ) { // delegate
if ( G.drag ) return

G.bookmarkedit = 1;
G.bklabel = $( this ).find( '.bklabel' );
G.bklabel = $( this ).find( '.label' );
$( '.mode-bookmark' ).each( function() {
var $this = $( this );
var path = $this.find( '.lipath' ).text();
Expand All @@ -1543,7 +1533,7 @@ $( '#lib-mode-list' ).on( 'click', '.mode-bookmark', function( e ) { // delegate
} );
$( '.mode-bookmark' )
.css( 'background', 'hsl(0,0%,15%)' )
.find( '.fa-bookmark, .bklabel, img' )
.find( '.fa-bookmark, .label, img' )
.css( 'opacity', 0.33 );
} );
new Sortable( document.getElementById( 'lib-mode-list' ), {
Expand Down
4 changes: 2 additions & 2 deletions srv/http/assets/js/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function renderQR() {
}
}
function scanBluetooth() {
bash( '/srv/http/bash/settings/networks-scanbt.sh', function( data ) {
bash( '/srv/http/bash/settings/networks-scan.sh', function( data ) {
if ( data ) {
G.listbtscan = data;
var htmlbt = '';
Expand All @@ -517,7 +517,7 @@ function scanBluetooth() {
}, 'json' );
}
function scanWlan() {
bash( '/srv/http/bash/settings/networks-scanwlan.sh', function( data ) {
bash( '/srv/http/bash/settings/networks-scan.sh wlan', function( data ) {
if ( data ) {
var signals = '';
data.forEach( function( list, i, obj ) {
Expand Down
34 changes: 22 additions & 12 deletions srv/http/assets/js/passive.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ function bookmarkCover( src, path ) {
htmlbk += '<img class="bkcoverart" src="'+ src +'">';
} else {
htmlbk += '<i class="fa fa-bookmark"></i>'
+'<div class="divbklabel">'
+'<span class="bklabel label">'+ path.split( '/' ).pop() +'</span></div>'
+'<a class="label">'+ path.split( '/' ).pop() +'</a>'
}
$this.find( '.mode' ).html( htmlbk );
return false
Expand Down Expand Up @@ -156,23 +155,34 @@ function psBtReceiver( connected ) {
$( '#'+ prefix +'-btsender' ).toggleClass( 'hide', !connected );
}
function psBookmark( data ) {
if ( 'html' in data ) {
$( '#lib-mode-list' ).append( data.html );
} else {
var $bookmark = $( '.lib-mode' ).filter( function() {
return $( this ).find( '.lipath' ) === data.path;
} );
if ( data.type === 'delete' ) {
$bookmark.remove();
if ( data.type === 'add' ) {
if ( data.src ) {
var icon = '<img class="bkcoverart" src="'+ data.src +'">';
} else {
$bookmark.find( '.bklabel' ).text( data.name );
var icon = '<i class="fa fa-bookmark"></i><a class="label">'+ data.name +'</a>';
}
var html = `
<div class="lib-mode bookmark">
<div class="mode mode-bookmark">
<a class="lipath">${ data.path }</a>
${ icon }
</div></div>
`;
$( '#lib-mode-list' ).append( html );
} else {
$( '.lib-mode.bookmark' ).each( function() {
var $this = $( this );
if ( $this.find( '.lipath' ).text() === data.path ) {
data.type === 'delete' ? $this.remove() : $this.find( '.label' ).text( data.name );
return false
}
} );
}
$( '.mode-bookmark, .bklabel' ).removeAttr( 'style' );
if ( 'order' in data ) {
G.display.order = data.order;
orderLibrary();
}
$( '#lib-mode-list' ).click();
}
function psCoverart( data ) {
clearTimeout( G.timeoutCover );
Expand Down
16 changes: 16 additions & 0 deletions srv/http/assets/js/plugin/simple-keyboard-3.4.139.min.js

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions srv/http/assets/js/plugin/simple-keyboard-3.4.81.min.js

This file was deleted.

4 changes: 2 additions & 2 deletions srv/http/assets/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ disconnect = () => {
hiddenSet = () => {
if ( page === 'networks' ) {
if ( !$( '#divbluetooth' ).hasClass( 'hide' ) || !$( '#divwifi' ).hasClass( 'hide' ) ) {
bash( 'killall -q networks-scanbt.sh; killall -q networks-scanwlan.sh' );
bash( 'killall -q networks-scan.sh &> /dev/null' );
clearTimeout( G.timeoutScan );
$( '#scanning-bt, #scanning-wifi' ).removeClass( 'blink' );
$( '.back' ).click();
Expand Down Expand Up @@ -414,7 +414,7 @@ $( '.container' ).click( function( e ) {
$( '#close' ).click( function() {
if ( page === 'networks' ) {
clearTimeout( G.timeoutScan );
bash( 'killall networks-scanbt.sh networks-scanwlan.sh &> /dev/null' );
bash( 'killall networks-scan.sh &> /dev/null' );
}
bash( [ 'cmd', 'rebootlist' ], function( list ) {
if ( !list ) {
Expand Down
8 changes: 5 additions & 3 deletions srv/http/bash/bluetoothcommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ if [[ $udev == connect ]]; then # >>>> bluetooth.rules: 1. pair from sender; 2.
grep -q $mac $dirshm/btconnected &> /dev/null && mac= || break
fi
done
# unpaired sender only - fix: rAudio triggered to connect by unpaired receivers when power on
if bluetoothctl paired-devices | grep -q $mac; then
# unpaired sender only - fix: rAudio triggered to connect by unpaired receivers when power on
controller=$( bluetoothctl show | head -1 | cut -d' ' -f2 )
if [[ -e /var/lib/bluetooth/$controller/$mac ]]; then
if [[ -e $dirsystem/camilladsp ]] && bluetoothctl info $mac | grep -q 'UUID: Audio Sink'; then
name=$( bluetoothctl info $mac | grep '^\s*Alias:' | sed 's/^\s*Alias: //' )
bluetoothctl disconnect $mac
Expand Down Expand Up @@ -157,7 +158,8 @@ elif [[ $action == disconnect || $action == remove ]]; then # from rAudio only
else
bluetoothctl remove $mac &> /dev/null
for i in {1..5}; do
bluetoothctl paired-devices 2> /dev/null | grep -q $mac && sleep 1 || break
controller=$( bluetoothctl show | head -1 | cut -d' ' -f2 )
[[ -e /var/lib/bluetooth/$controller/$mac ]] && sleep 1 || break
done
disconnectRemove Removed
fi
Expand Down
Loading

0 comments on commit fd732e7

Please sign in to comment.