Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Commit

Permalink
Allow -xXI to be used without -me.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//depot/fIcy/main/": change = 955]
  • Loading branch information
wavemm committed May 3, 2005
1 parent f3fae55 commit 504c0bb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 37 deletions.
38 changes: 18 additions & 20 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ fIcy is an icecast/shoutcast stream grabber suite for use under shell
environment. Its goal is to cleanly and automatically rip a stream into user
customisable files. It will work with any ICY compatible stream, allowing you
to either to save the stream to disk or to pipe the output to a media player,
or even both.
or even both. fIcy, among other uses, is ideal for batch/unattended recording
of radio programs and stream debugging.

The fIcy package includes:

Expand Down Expand Up @@ -180,33 +181,28 @@ Examples

Use fIcy to display ICY titles while playing::

fIcy -t 123.123.123.123 8080 | mpg123 -
fPls http://example.com:8080/listen.pls -t | mpg123 -

Rip an .mp3 stream using metadata as filename, with server:port and /path::
Rip a station until stopped::

fIcy -s .mp3 -o ./ -md 123.123.123.123 8080 /path/to/stream

Rip an .mp3 stream and play it using mpg123, allowing mpg123 to be killed
anytime::
fPls -L-1 http://netradio.invalid/listen.pls -s.mp3 -o./ -cmrd

fIcy -s .mp3 -o ./ -mp 1.2.3.4 8080 /path/to/stream | mpg123 -
Connect directly to the stream with server:port and /path::

Same as above, but allows the player to be restarted later by using a named
fifo (note that you can later open "fifo" with any player)::
fIcy -s .mp3 -o ./ -md 123.123.123.123 8080 /path/to/stream

Rip an .mp3 stream while playing, but allows the player to be restarted later
by using a named fifo (note that you can re/open "fifo" with any player)::

$ mkfifo fifo
$ fIcy -p ... > fifo
$ mpg123 fifo

URL parsing examples. Only "http" is recognised as a valid protocol,
but can be omitted on the command line::

fIcy -t http://example.com/radio | mpg123 -
Record your favourite program "XYZ" usually on-air between 16:30-17:00::

Rip a station using a playlist instead of direct connection to the stream,
supporting failures and multiple fall-back streams::

fPls -L-1 http://netradio.invalid/listen.pls -s.mp3 -o./ -cmrd
at 16:30
fPls -M 30m http://example.com/listen.pls -o program.mp3 -x XYZ
^D

Cleanup a ripped and/or damaged mp3 file::

Expand Down Expand Up @@ -255,8 +251,10 @@ tools could also insert extra empty frames to silence the decoder!
The -M flag supported by both fIcy and fPls accepts a time specification in
seconds, `HH:MM` or `N minutes/hours/days`. Time starts just after the
connection has been established, but without counting further delays. Also
beware that -M specified in fPls means `cumulative recording time`, while -M
specified in fIcy means `single stream recording time`.
beware that -M specified in fPls means `cumulative recording time` (time
cumulates across retries/timeouts), while -M specified in fIcy means `single
stream recording time` (recording stops at the first error or when the
specified time has elapsed).

For bugs, support, documentation or simply suggestions contact the main
developer: wave++ <wavexx@users.sf.net>. Our "Concept Developer": SethX
Expand Down
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Internals

* OGG support isn't there yet.


* Split the ICY class into ICE/OGG subclasses, to support
seamless operation when using OGG streams.

Expand Down
31 changes: 16 additions & 15 deletions fIcy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ main(int argc, char* const argv[]) try
char* outFile = NULL;
char* suffix = NULL;
ofstream seq;
bool enuFiles = false;
bool useMeta = false;
bool enumFiles = false;
bool nameFiles = false;
bool showMeta = false;
bool clobber = true;
bool numEFiles = false;
Expand All @@ -233,11 +233,11 @@ main(int argc, char* const argv[]) try
break;

case 'e':
enuFiles = true;
enumFiles = true;
break;

case 'm':
useMeta = true;
nameFiles = true;
break;

case 'v':
Expand Down Expand Up @@ -341,11 +341,13 @@ main(int argc, char* const argv[]) try
}

// check for parameters consistency
// enuFiles and useMeta requires a prefix
bool reqMeta(enuFiles || useMeta || showMeta);
if((useMeta || enuFiles) && !outFile)
bool useMeta(enumFiles || nameFiles || !match.empty());
bool reqMeta(useMeta || showMeta);

// enumFiles and nameFiles requires a prefix
if(useMeta && !outFile)
{
err("a prefix is required (see -o) when writing multiple files");
err("a prefix is required (see -o) when writing files");
return Exit::args;
}

Expand All @@ -358,7 +360,7 @@ main(int argc, char* const argv[]) try

// install the signals
instSignal = (instSignal && dupStdout);
rmPartial = rmPartial && (enuFiles || useMeta);
rmPartial = (rmPartial && useMeta);
sigTermInst(!(instSignal || rewrite.get()));
if(instSignal)
sigPipeInst();
Expand Down Expand Up @@ -406,7 +408,7 @@ main(int argc, char* const argv[]) try

// initial file
auto_ptr<std::ostream> out;
if(outFile && !(enuFiles || useMeta))
if(outFile && !useMeta)
out.reset(newFWrap(outFile, clobber));
else
// the first filename is unknown as the metadata block will
Expand Down Expand Up @@ -459,18 +461,17 @@ main(int argc, char* const argv[]) try

// skip the first filename generation when discarding partials
// or when the title doesn't match
if((enuFiles || useMeta) && (enu || !rmPartial) &&
match(title.c_str()))
if(useMeta && (enu || !rmPartial) && match(title.c_str()))
{
newFName = outFile;

if(enuFiles)
if(enumFiles)
{
char buf[16];
snprintf(buf, sizeof(buf), (useMeta? "[%lu] ": "%lu"), enu);
snprintf(buf, sizeof(buf), (nameFiles? "[%lu] ": "%lu"), enu);
newFName += buf;
}
if(useMeta)
if(nameFiles)
newFName += sanitize_file(title);
if(suffix)
newFName += suffix;
Expand Down
9 changes: 8 additions & 1 deletion match.hh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* match - match/filter a string according regex rules
* Copyright(c) 2004 of wave++ (Yuri D'Elia)
* Copyright(c) 2004-2005 of wave++ (Yuri D'Elia)
* Distributed under GNU LGPL without ANY warranty.
*/

Expand Down Expand Up @@ -49,6 +49,13 @@ public:
}


bool
empty() const
{
return (incl.empty() && excl.empty());
}


// load/append expressions from file
void
load(const char* file);
Expand Down

0 comments on commit 504c0bb

Please sign in to comment.