Skip to content

Commit

Permalink
Merge pull request #1026 from rern/UPDATE
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
rern authored Sep 16, 2022
2 parents d8d92f0 + d0ac68e commit b04ad04
Show file tree
Hide file tree
Showing 44 changed files with 351 additions and 356 deletions.
9 changes: 9 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

alias=r1

# 20220916
dirmpd=/srv/http/data/mpd
if (( $( cat $dirmpd/counts | wc -l ) == 1 )); then
echo '{
"playlists" : '$( ls -1 /srv/http/data/playlists | wc -l )'
, "webradio" : '$( find -L /srv/http/data/webradio -type f ! -path '*/img/*' | wc -l )'
}' > $dirmpd/counts
fi

# 20220907
[[ $( pacman -Q bluez ) < 'bluez 5.65-3' ]] && pacman -Sy --noconfirm bluez bluez-utils

Expand Down
2 changes: 1 addition & 1 deletion srv/http/assets/css/common.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@font-face {
font-family: rern;
src: url( '/assets/fonts/rern.2022072100.woff2' ) format( 'woff2' );
src: url( '/assets/fonts/rern.2022091500.woff2' ) format( 'woff2' );
font-display: block;
font-style: normal;
font-weight: normal;
Expand Down
Binary file modified srv/http/assets/fonts/rern.woff2
Binary file not shown.
20 changes: 10 additions & 10 deletions srv/http/assets/js/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function addSimilar() {
similar += val[ i ].artist.name +'\n'+ val[ i ].name +'\n';
}
banner( title, 'Find similar tracks from Library ...', 'library blink', -1 );
bash( [ 'plsimilar', similar ], function( count ) {
bash( [ 'mpcsimilar', similar ], function( count ) {
getPlaylist();
setButtonControl();
banner( title, count +' tracks added.', 'library' );
Expand Down Expand Up @@ -566,7 +566,7 @@ $( '.contextmenu a, .contextmenu .submenu' ).click( function() {

switch ( cmd ) {
case 'current':
bash( [ 'plcurrent', G.list.index + 1 ] );
bash( [ 'mpcsetcurrent', G.list.index + 1 ] );
return
case 'directory':
if ( G.mode === 'latest' ) {
Expand Down Expand Up @@ -737,17 +737,17 @@ $( '.contextmenu a, .contextmenu .submenu' ).click( function() {
switch ( mode ) {
case '':
if ( G.list.singletrack || G.mode.slice( -5 ) === 'radio' ) { // single track
mpccmd = [ 'pladd', path ];
mpccmd = [ 'mpcadd', path ];
} else if ( $( '.licover' ).length && !$( '.licover .lipath' ).length ) {
mpccmd = [ 'plfindadd', 'multi', G.mode, path, 'album', G.list.album ];
mpccmd = [ 'mpcfindadd', 'multi', G.mode, path, 'album', G.list.album ];
} else { // directory or album
mpccmd = [ 'plls', path ];
mpccmd = [ 'mpcls', path ];
}
break;
case 'pl':
cmd = cmd.slice( 2 );
if ( G.library ) {
mpccmd = [ 'plload', path ];
mpccmd = [ 'mpcload', path ];
} else { // saved playlist
var play = cmd.slice( -1 ) === 'y' ? 1 : 0;
var replace = cmd.slice( 0, 1 ) === 'r' ? 1 : 0;
Expand All @@ -762,20 +762,20 @@ $( '.contextmenu a, .contextmenu .submenu' ).click( function() {
}
break;
case 'playnext':
mpccmd = [ 'pladdplaynext', path ];
mpccmd = [ 'mpcaddplaynext', path ];
break
case 'wr':
cmd = cmd.slice( 2 );
var charset = G.list.li.data( 'charset' );
if ( charset ) path += '#charset='+ charset
mpccmd = [ 'pladd', path ];
mpccmd = [ 'mpcadd', path ];
break;
default:
if ( !G.list.name ) {
mpccmd = [ 'plfindadd', mode, path ];
mpccmd = [ 'mpcfindadd', mode, path ];
if ( G.list.artist ) mpccmd.push( 'artist', G.list.artist );
} else {
mpccmd = [ 'plfindadd', 'multi', G.mode, $( '#mode-title' ).text(), 'album', G.list.name ];
mpccmd = [ 'mpcfindadd', 'multi', G.mode, $( '#mode-title' ).text(), 'album', G.list.name ];
}
}
if ( !mpccmd ) mpccmd = [];
Expand Down
3 changes: 2 additions & 1 deletion srv/http/assets/js/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ $( '#setting-stoptimer' ).click( function() {
}
, ok : function() {
bash( [ 'stoptimerset', ...infoVal() ] );
notify( 'Scrobble', G.stoptimer ? 'Change ...' : 'Enable ...', 'stopwatch' );
notify( 'Stop Timer', G.stoptimer ? 'Change ...' : 'Enable ...', 'stopwatch' );
}
} );
} );
Expand All @@ -480,6 +480,7 @@ function renderPage() {
$( '#redirecturi' ).text( G.spotifyredirect );
$( '#upmpdcli' ).toggleClass( 'disabled', G.upmpdcliactive );
$( '#hostapd' ).toggleClass( 'disabled', G.wlanconnected );
$( '#stoptimer' ).toggleClass( 'disabled', !G.playing );
if ( G.nosound ) {
$( '#divdsp, #divsnapserver' ).addClass( 'hide' );
} else {
Expand Down
45 changes: 33 additions & 12 deletions srv/http/assets/js/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ function playlistFilter() {
}
function playlistRemove( $li ) {
if ( $( '#pl-list li' ).length === 1 ) {
bash( [ 'plremove' ] );
bash( [ 'mpcremove' ] );
} else {
var total = $( '#pl-time' ).data( 'time' ) - $li.find( '.time' ).data( 'time' );
var file = $li.hasClass( 'file' );
Expand Down Expand Up @@ -989,7 +989,7 @@ function playlistRemove( $li ) {
$li.prev().addClass( 'active' );
}
}
bash( [ 'plremove', pos, poscurent ] );
bash( [ 'mpcremove', pos, poscurent ] );
$( '#pl-list li .pos' ).slice( pos ).each( function() {
$( this ).text( pos );
pos++
Expand Down Expand Up @@ -1127,10 +1127,7 @@ function renderPlayback() {

local();
if ( G.status.state === 'stop' ) setProgress( 0 );
$volumeRS.setValue( G.status.volume );
if ( G.status.volume === 0 ) $volumehandle.rsRotate( -310 );
G.status.volumemute !== 0 ? volumeColorMute( G.status.volumemute ) : volumeColorUnmute();
$( '#volume-bar' ).css( 'width', G.status.volume +'%' );
setVolume();
clearInterval( G.intBlinkDot );
if ( !G.status.pllength && G.status.player === 'mpd' && G.status.state === 'stop' ) { // empty queue
setPlaybackBlank();
Expand Down Expand Up @@ -1695,11 +1692,28 @@ function setTrackCoverart() {
$( '#lib-list li' ).eq( 1 ).removeClass( 'track1' );
}
}
function setVolume() {
var mute = G.status.volumemute !== 0;
$volumeRS.setValue( G.status.volume );
if ( G.status.volume === 0 ) $volumehandle.rsRotate( -310 );
mute ? volumeColorMute( G.status.volumemute ) : volumeColorUnmute();
$( '#voldn' ).toggleClass( 'disabled', G.status.volume === 0 );
$( '#volmute' ).toggleClass( 'disabled', G.status.volume === 0 && !mute );
$( '#volup' ).toggleClass( 'disabled', G.status.volume === 100 );
$( '#volume-bar' ).css( 'width', G.status.volume +'%' );
$( '#volume-text' )
.text( G.status.volumemute || G.status.volume )
.toggleClass( 'bl', mute );
if ( $( '#time-knob' ).is( ':hidden' ) ) {
var prefix = $( '#time-knob' ).is( ':visible' ) ? 'ti' : 'i';
$( '#'+ prefix +'-mute' ).toggleClass( 'hide', !mute );
}
}
function sortPlaylist( pl, iold, inew ) {
G.sortable = 1;
setTimeout( function() { G.sortable = 0 }, 500 );
if ( pl === 'pl-list' ) {
bash( [ 'plorder', iold + 1, inew + 1 ] );
bash( [ 'mpcmove', iold + 1, inew + 1 ] );
} else {
bash( [ 'savedpledit', $( '#pl-path .lipath' ).text(), 'move', iold, inew ] );
}
Expand Down Expand Up @@ -1793,10 +1807,16 @@ function volumeBarHide() {
}
function volumeBarSet( pageX ) {
clearTimeout( G.volumebar );
var posX = pageX - $( '#volume-band' ).offset().left;
var bandW = $( '#volume-band' ).width();
posX = posX < 0 ? 0 : ( posX > bandW ? bandW : posX );
var vol = Math.round( posX / bandW * 100 );
if ( pageX === 'toggle' ) {
var vol = G.status.volumemute || 0;
var cmd = [ 'volume' ];
} else {
var posX = pageX - $( '#volume-band' ).offset().left;
var bandW = $( '#volume-band' ).width();
posX = posX < 0 ? 0 : ( posX > bandW ? bandW : posX );
var vol = Math.round( posX / bandW * 100 );
var cmd = [ 'volume', G.status.volume, vol, G.status.card, G.status.control ]
}
if ( G.drag ) {
$( '#volume-bar' ).css( 'width', vol +'%' );
bash( [ 'volume', 'drag', vol, G.status.card, G.status.control ] );
Expand All @@ -1813,7 +1833,8 @@ function volumeBarSet( pageX ) {
}
);
$( '.volumeband' ).addClass( 'disabled' );
bash( [ 'volume', G.status.volume, vol, G.status.card, G.status.control ], function() {

bash( cmd, function() {
$( '.volumeband' ).removeClass( 'disabled' );
} );
}
Expand Down
22 changes: 7 additions & 15 deletions srv/http/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ $( '#volume-band' ).on( 'touchstart mousedown', function() {
} );
$( '#volmute, #volM' ).click( function() {
$( '#volume-knob, #vol-group i' ).addClass( 'disabled' );
bash( [ 'volume', G.status.volume, 0, G.status.card, G.status.control ] );
bash( [ 'volume' ] );
} );
$( '#volup, #voldn, #volT, #volB, #volL, #volR' ).click( function( e ) {
var voldn = [ 'voldn', 'volB', 'volL' ].includes( e.currentTarget.id );
Expand Down Expand Up @@ -833,17 +833,9 @@ $( '#volume-band-dn, #volume-band-up' ).click( function() {
bash( [ 'volume', 'drag', vol, G.status.card, G.status.control ] );
}, 100 );
} );
$( '#volume-text' ).click( function() { // mute /unmute
$( '#volume-text' ).click( function() { // mute / unmute
clearTimeout( G.volumebar );
if ( G.status.volumemute ) {
var offL = $( '#volume-band' ).offset().left;
var barW = G.status.volumemute ? $( '#volume-band' ).width() * G.status.volumemute / 100 : 0;
var pageX = offL + barW;
} else {
var pageX = 0
G.status.volumemute = G.status.volume;
}
volumeBarSet( pageX );
volumeBarSet( 'toggle' );
} );
$( '#divcover' ).press( function( e ) {
if (
Expand Down Expand Up @@ -1848,7 +1840,7 @@ $( '#button-pl-shuffle' ).click( function() {
, title : 'Shuffle Playlist'
, message : 'Shuffle all tracks in playlist?'
, ok : function() {
bash( [ 'plshuffle' ] );
bash( [ 'mpcshuffle' ] );
}
} );
} );
Expand All @@ -1860,7 +1852,7 @@ $( '#button-pl-clear' ).click( function() {
, oklabel : '<i class="fa fa-minus-circle"></i>Clear'
, okcolor : red
, ok : function() {
bash( [ 'plremove' ] );
bash( [ 'mpcremove' ] );
banner( 'Playlist', 'Clear ...', 'playlist blink', -1 );
}
} );
Expand All @@ -1878,13 +1870,13 @@ $( '#button-pl-clear' ).click( function() {
, function() {
$( '#pl-list li:not( .active )' ).remove();
if ( !G.status.librandom ) local();
bash( [ 'plcrop' ] );
bash( [ 'mpccrop' ] );
}
]
, oklabel : '<i class="fa fa-minus-circle"></i>All'
, okcolor : red
, ok : function() {
bash( [ 'plremove' ] );
bash( [ 'mpcremove' ] );
setPlaybackBlank();
}
} );
Expand Down
20 changes: 5 additions & 15 deletions srv/http/assets/js/passive.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,24 +576,14 @@ function psVolume( data ) {

clearTimeout( G.debounce );
G.debounce = setTimeout( function() {
var vol = data.val;
var mute = data.type === 'mute';
if ( mute ) {
G.status.volumemute = vol;
vol = 0;
if ( data.type === 'mute' ) {
G.status.volume = 0;
G.status.volumemute = data.val;
} else {
G.status.volume = data.val;
G.status.volumemute = 0;
}
$volumeRS.setValue( vol );
mute ? volumeColorMute() : volumeColorUnmute();
$( '#volume-bar' ).css( 'width', vol +'%' )
$( '#volume-text' )
.text( mute ? data.val : vol )
.toggleClass( 'bl', mute );
if ( $( '#time-knob' ).is( ':hidden' ) ) {
var prefix = $( '#time-knob' ).is( ':visible' ) ? 'ti' : 'i';
$( '#'+ prefix +'-mute' ).toggleClass( 'hide', !mute );
}
setVolume();
}, G.debouncems );
}
function psVUmeter( data ) {
Expand Down
2 changes: 0 additions & 2 deletions srv/http/assets/js/plugin/jquery-3.6.0.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions srv/http/assets/js/plugin/jquery-3.6.1.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion srv/http/bash/bluetoothcommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ if [[ $udev == connect ]]; then # >>>> bluetooth.rules: 1. pair from sender; 2.

#-----
pushstreamNotifyBlink Bluetooth "$msg" bluetooth
if (( $( bluetoothctl info $mac | egrep 'Paired: yes|Trusted: yes' | wc -l ) == 2 )); then
if (( $( bluetoothctl info $mac | grep -E 'Paired: yes|Trusted: yes' | wc -l ) == 2 )); then
action=connect
else
sleep 2
Expand Down
Loading

0 comments on commit b04ad04

Please sign in to comment.