tags 222784 + patch pending thanks * Anthony DeRobertis <[EMAIL PROTECTED]> [2003-12-03 04:59]: > It'd be neat to have an exec_no_err (or maybe a new one, like > exec_encode_done) that I could easily hook vorbisgain -a into.
This sounds like a good idea. I've now added some environment variables which can be used for this. I've also attached an example hook you can use. diff -urN jack-3.1.1~/jack jack-3.1.1/jack --- jack-3.1.1~/jack 2005-07-28 14:43:19.644166936 +0100 +++ jack-3.1.1/jack 2005-07-28 18:23:39.611426432 +0100 @@ -92,6 +92,8 @@ ### (1) search for a dir containing a toc-file or do the multi-mode toc_just_read = jack_prepare.find_workdir() +os.environ["JACK_CUR_DIR"] = os.getcwd() +os.environ["JACK_BASE_DIR"] = cf['_base_dir'] # now we are set to go as we know we are in the right dir ### (2) check toc (operation mode) @@ -234,6 +236,10 @@ warning("abnormal exit") traceback.print_exc() sys.exit(1) +# Set the files we have processed but this may still be overwritten by +# jack_tag.tag() called below. +os.environ["JACK_JUST_ENCODED"] = "\n".join([x[NAME] + ext for x in mp3s_todo]) +os.environ["JACK_JUST_RIPPED"] = "\n".join([x[NAME] + ".wav" for x in wavs_todo]) jack_term.disable() if cf['_query_when_ready']: diff -urN jack-3.1.1~/jack.man jack-3.1.1/jack.man --- jack-3.1.1~/jack.man 2005-07-28 14:43:19.644166936 +0100 +++ jack-3.1.1/jack.man 2005-07-28 18:43:49.320522696 +0100 @@ -500,6 +500,18 @@ jack -O --remove-files ; gnoise *wav ; jack -g *wav ; jack .RE Just replace gnoise by the operation you'd like to perform. +.SH ENVIRONMENT VARIABLES +There are several environment variables which can be used in jack's exec +hooks: +.IP JACK_BASE_DIR +lists jack's base directory in which files are stored. +.IP JACK_CUR_DIR +lists the current directory of jack in which files of the current album are +put. +.IP JACK_JUST_ENCODED +lists all track names which have just been encoded. +.IP JACK_JUST_RIPPED +lists all track names which have just been ripped. .SH FORMAT STRINGS .IP %n Track number diff -urN jack-3.1.1~/jack_tag.py jack-3.1.1/jack_tag.py --- jack-3.1.1~/jack_tag.py 2005-07-28 14:43:19.737152800 +0100 +++ jack-3.1.1/jack_tag.py 2005-07-28 18:24:57.642563896 +0100 @@ -225,5 +225,7 @@ else: print + os.environ["JACK_JUST_ENCODED"] = "\n".join(jack_m3u.m3u) + os.environ["JACK_JUST_RIPPED"] = "\n".join(jack_m3u.wavm3u) jack_m3u.write() -- Martin Michlmayr http://www.cyrius.com/
#!/bin/sh # Example script for exec hooks # Copyright (C) 2005 Martin Michlmayr <[EMAIL PROTECTED]> # This script may be distributed under the GPL v2 or higher. # Process tracks with vorbisgain to calculate their "ReplayGain" # so they can be played with a uniform sound level. # Usage: put the following in your ~/.jack3rc file (without any leading # hash symbols) # exec_when_done:yes # exec_no_err:"/usr/share/doc/jack/examples/exec_vorbisgain" # You have to set (and later restore) $IFS in since $JACK_JUST_ENCODED # contains a listing of tracks separated by newlines. OLDIFS="$IFS" IFS=" " # There are two alternatives: # 1. Process all files at once as an album: vorbisgain -a $JACK_JUST_ENCODED # 2. Process each file individually: #for i in $JACK_JUST_ENCODED; do # IFS="$OLDIFS"; # vorbisgain "$i" # IFS=" #" #done # In most real world cases, you will want option 1. However, option two # is included to show how you can process individual files. IFS="$OLDIFS"