12-29-2022, 01:41 AM
If you're on Linux, using Audacious music player and have loads of music that you don't have time to listen to entirely, I have written a tool to make your life a bit easier.
Press escape key at any time in the run to quit the program. This program expects Audacious started with a playlist ready to go. It prints on the screen the filename of the song that it's currently on. If you don't like this then press escape to get away from this QB64 user program, then change the current track in Audacious and try again to run this program.
Each song is first played for its first five seconds, then a seek is performed to about 30 seconds before the end to play that portion. These values could be adjusted in the program. It's easier to seek from the beginning of a song, but to seek from the end, first the playback length of the media file must be acquired.
While the 30 seconds of playback go down, the user could press escape to leave the program, or spacebar or enter to advance to the next track in the playlist.
This program makes use of an utility called "audtool" that should have been installed with Audacious. At the moment it works with one instance of Audacious that was ever opened.
Press escape key at any time in the run to quit the program. This program expects Audacious started with a playlist ready to go. It prints on the screen the filename of the song that it's currently on. If you don't like this then press escape to get away from this QB64 user program, then change the current track in Audacious and try again to run this program.
Each song is first played for its first five seconds, then a seek is performed to about 30 seconds before the end to play that portion. These values could be adjusted in the program. It's easier to seek from the beginning of a song, but to seek from the end, first the playback length of the media file must be acquired.
While the 30 seconds of playback go down, the user could press escape to leave the program, or spacebar or enter to advance to the next track in the playlist.
This program makes use of an utility called "audtool" that should have been installed with Audacious. At the moment it works with one instance of Audacious that was ever opened.
Code: (Select All)
''by mnrvovrfc 2022-dec-28
option _explicit
dim as integer i, j, hm, hs, ff, coln
dim afile$, aname$, ke$, b$
afile$ = "audahelp-thistrak.txt"
_TITLE "Audacious App Helper"
do : loop until _screenexists
print "*** Make sure Audacious is running and with a playlist! ***"
print "Press escape to quit."
for i = 5 to 1 step -1
print "Starting in..."; i
_delay 1
ke$ = inkey$
if ke$ = chr$(27) then system
next
shell _hide "audtool -1 --playback-play"
for i = 1 to 20
shell _hide "audtool -1 --current-song-length > " + afile$
shell _hide "audtool -1 --current-song-filename >> " + afile$
ff = freefile
open afile$ for input as ff
line input #ff, b$
line input #ff, aname$
close ff
coln = instr(b$, ":")
hm = val(left$(b$, coln - 1))
hs = val(mid$(b$, coln + 1))
hs = hs - 32
if hs < 0 then
hm = hm - 1
hs = hs + 60
end if
hs = hs + hm * 60
print i; "name: "; aname$
print i; "for 5 seconds..."
for j = 1 to 5
_delay 1
ke$ = inkey$
if ke$ = chr$(27) then system
next
shell _hide "audtool -1 --playback-seek" + str$(hs)
print i; "final 30 seconds..."
for j = 1 to 30
_delay 1
ke$ = inkey$
if ke$ = chr$(27) then system
if ke$ = chr$(13) or ke$ = " " then exit for
next
if i = 20 then exit for
shell _hide "audtool -1 --playlist-advance"
next
shell _hide "audtool -1 --playback-stop"
print "OVER"
_delay 5
system