>
Gftracks - Perl extention for manipulation of gramofiles .tracks files
Usually the interactive shell will be used. The variable TRACKS shall point to the .tracks file to be edited
export TRACKS=/home/myhome/myrecord.wav.tracks
perl -MGftracks -e shell;
Within the shell, press h for help.
The .tracks file is read into an array, where the 0th element holds the metadata for the file, and each of the other elements holds the information for the actual track.
For all the subroutines the variable $tracks indicates an array build up in the module.
Those subroutines with a name starting with _ are not exported.
instime inserts a track at a given timestamp
instime($tracks,$timestamp[,$duration]);
If duration is not defined, the end of the track is set to the current end of the track in which the insertion is performed
$tracks=_spliceback($tracks,$delno); $tracks=_splicefwd($tracks,$delno);
_spliceback and _splicefwd splices the rest of the array when a track has been deleted. They should only be used internally. In both cases the arguments are a pointer to the tracks array and the index that is to be deleted
deltrack (\@tracks,$index,$back)
Deltrack removes a track by default using spliceback (unless the last track is deleted).
$filename=trackfile()
trackfile returns the filename as given by $ENV{TRACKS} and does some simple sanity checking on it
$tracks=init($filename)
init reads the file as specified by filename and returns the array holding all the information in the .tracks-file
$timestamp=tidytime(timestamp)
Does some sanitychecking of the time stamp and tidies up a bit so that the returned timestamp is on the form hh:mm:ss.sss
Prints out some basic help for the shell commands
shelladjusttime ($tracks,$command,$end)
adjusts the time for start or end of a track. End is either set to 'start' or 'end'.
shelladd($tracks,$timestamp)
Adds a track at a given time
shelldelete($tracks,$trackno)
uses deltrack()
to delete the indicated track
shellprint($tracks)
prints out the number of tracks
shellsave($tracks,$filename)
saves the information to $filename
shellprinttracks($tracks)
prints out the beginning and end time of all the tracks
shell($file)
shell will fetch the filename from _trackfile if not given.
shell opens up a quite simple interactive shell for editing.
The following commands are valid:
h : help a <t> : add a track at given time d <n> : delete the given track n : print number of tracks p : print start and end times for all tracks b <n> <t> : alter beginning of track e <n> <t> : alter end of track s : save file q : quit --------------------------------------------------------- <t> time, must be given as h:mm:ss.ss <n> tracknumber
printtracks($tracks)
returns the information in $tracks. Suitable for saving.
(c) Morten Sickel (cpan\@sickel.net) April 2005 The last version should be available at http://sickel.net Licenced under the artistic licence