Some users may use a CLI application infrequently and find it troublesome to remember the start-up command, the range of available switches, proper command structure etc. Of course, one can usually invoke the application's help function, but this relies on remembering the command to run the application itself and whether the switch uses a single or double hyphen etc. If one gets this far it can then be a case of searching through a surfeit of unwanted information to obtain the required details.
The following idea may help to counteract some of these hinderences. In four short steps and without repackaging the underlying CLI app it:
- Provides an entry in a start menu/wbar
- Opens a terminal to run the CLI application
- Displays a user created text file (help info of the user's choosing)
- Leaves the terminal ready to run a command
Step 1
Create an executable script named custominfo.sh to display the text file
#!/bin/sh
# custominfo.sh is started from a TC .desktop file that starts aterm and includes
# a path to a text file as the first parameter. The text file contains user created
# text which this script displays and leaves the aterm window open at a command prompt.
cat $1 # Display the text from the file referenced in the .desktop file
echo ; echo ; echo # Separate the text from the command prompt
sh # Start a new shell
This acts as a hub, taking as input the first parameter, $1, from any .desktop file that starts a terminal for a CLI application. It then displays the text from any text file it is pointed to (specified in the .desktop file). Typically it provides a way to display user created help text from a file prior to starting the CLI application.
Step 2
Make an extension of the script
Create package/usr/local/bin/custominfo.sh.
mksquashfs package custominfo.tcz
No dependencies are required.
The following steps are illustrated using normalize-audio.tcz from the TC 3.x repository.
Step 3
Create the icon and custom text files, and also an entry for a start menu
Icon
Choose an icon (48x48) and name it normalize-mp3-clix.png
Create package/usr/local/share/pixmaps/normalize-mp3-clix.png
Text File
Create the text file to display and name it normalize-mp3-clix.txt
This method decodes mp3 to wav, normalizes, re-encodes to mp3. It normalizes using RMS amplitudes.
Using --peak switches to peak normalization. Variables and quoting the command are required.
VARIABLES
%w => wav file name (automatically created by Normalize-Audio)
%m => mp3 file name (automatically defaults to input file name)
LAME SWITCHES
Constant average bitrate re-encoding (ABR)
-b 32, 40, 48, 56, 64, 80, 96, 112, 128 (default), 160, 192, 224, 256, 320 (kbps)
Analogies for constant ABR mode:
16kbps => Telephone 24kbps => Radio LW/MW/SW 112kbps => Radio FM/Cassette Tape
160kbps => HiFi 192kbps => CD 256kbps => Studio
Variable bitrate re-encoding (VBR via preset)
--preset standard, medium, extreme
medium => This provides near transparency to most people on most music.
standard => This is generally transparent and is quite high in quality.
extreme => If you have extremely good hearing and similar equipment, this provides
slightly higher quality than the "standard" mode.
EXAMPLE: Normalize a single mp3.
Use a constant average bitrate to re-encode.
normalize-mp3 --mp3encode="lame -b bitrate %w %m" "input-filename.mp3"
EXAMPLE: Normalize each mp3 in the current directory independently
of each other using peak normalization.
Use a variable bitrate preset to re-encode.
normalize-mp3 --peak --mp3encode="lame --preset type %w %m" *.mp3
EXAMPLE: Normalize each mp3 in the current directory as an associated group
with tracks retaining the same level relative to each other.
Use a variable bitrate preset to re-encode.
normalize-mp3 --batch --mp3encode="lame --preset type %w %m" *.mp3
Create package/usr/local/share/info/normalize-mp3-clix.txt
Menu Entry
Create a .desktop file and name it normalize-mp3-clix.desktop
[Desktop Entry]
Type=Application
Name=Normalize-MP3
Exec=aterm -geometry 125x40+5+5 -title Normalize-MP3 -fg 10 -ib 10 -sr -sl 1000 +tr -e custominfo.sh /usr/local/share/info/normalize-mp3-clix.txt
Icon=normalize-mp3-clix.png
X-FullPathIcon=/usr/local/share/pixmaps/normalize-mp3-clix.png
Categories=Audio;AudioVideo;AudioVideoEditing;
Note: Exec=...to...normalize-mp3-clix.txt is on one lineCreate package/usr/local/share/applications/normalize-mp3-clix.desktop
Explanatory note:Key to parameters on line Exec=
-geometry 125=width, 40=hieght, 5x5=top left corner of aterm window
-title text displayed in title bar
-fg 10=bright green text
-ib 10=space between text and internal border of aterm window
-sr scroll bar on right-hand side of window
-sl 1000=number of lines to scroll
+tr turn off transparency
-e command to run and text file to read
Step 4
Create an extension
mksquashfs package normalize-mp3-clix.tcz
List dependencies
Create normalize-mp3-clix.tcz.dep
custominfo.tcz
normalize-audio.tcz
Finished.
To make it work with your choice of CLI application:
In steps 3 and 4 replace
- Anything beginning normalize-mp3... with your selection
In the .desktop file replace
- Each reference to normalize-mp3... and Normalize-MP3 with your selection
- The "Categories" list
If anyone else finds it useful perhaps a scripter might automate the process...