Wav2mp3 (using serversocket for app to app control)
Posted: Saturday 25th July 2020 7:03pm
This started off as a simple tool so i could right click a .wav audio file and convert it to mp3 using LAME.
It uses the wav folder name as album and parent folder as artist or can be set manually.
you can also select different bitrate settings.
It seemed to work fine, i can select files from a filechooser and add manually in the gui or pass arguments (wav file paths) to it at launch.
but if i selected more than one file on the desktop and right clicked to "Open with Wav2mp3" then it wouldn't launch as one program with multiple arguments it would launch multiple instances of the program with one argument each.
So i needed a way to check if the program was already running and send the arguments to that one instead.
I found a way using a ServerSocket control so the 1st instance of the app sets up a listening socket and any subsequent apps that load use a simple shell command to tell the 1st app to add the files to its queue and exit.
I'm sure the app could use some more error handling/debugging/refining but could provide some insights for some for resolving a similar issue.
So i guess it's beta , i've only just made it so may be some quirks.
I plan to add more options (quality, priority, etc)
attachment contains source and app (bugfixed 19:00 28 July 2020)
(non resizable version , see below for updated one)
It uses the wav folder name as album and parent folder as artist or can be set manually.
you can also select different bitrate settings.
It seemed to work fine, i can select files from a filechooser and add manually in the gui or pass arguments (wav file paths) to it at launch.
but if i selected more than one file on the desktop and right clicked to "Open with Wav2mp3" then it wouldn't launch as one program with multiple arguments it would launch multiple instances of the program with one argument each.
So i needed a way to check if the program was already running and send the arguments to that one instead.
I found a way using a ServerSocket control so the 1st instance of the app sets up a listening socket and any subsequent apps that load use a simple shell command to tell the 1st app to add the files to its queue and exit.
I'm sure the app could use some more error handling/debugging/refining but could provide some insights for some for resolving a similar issue.
So i guess it's beta , i've only just made it so may be some quirks.
I plan to add more options (quality, priority, etc)
attachment contains source and app (bugfixed 19:00 28 July 2020)
(non resizable version , see below for updated one)