# $Revision: 1.4 $, last changes made $Date: 2001/03/24 11:24:35 $

// AutoNap 0.1.3

BEFORE YOU DO ANYTHING!
-----------------------
Take into account that not all documented features are actually implemented 
ones. If you find a switch or so that doesn't seem to do anything, then wait
for the next revision. ;-)
By the way, try
   
   man 1 AutoNap.pl

and

   man 5 autonap.conf

for some nicely formatted manpages.

Be aware of the renaming of some of the commandline-switches!
Addtionaly you may have to want a look at the PAGING section of
the AutoNap.pl manpage. It explains how to use one nice little
feature when scrolling through lists.

Configuring AutoNap:
--------------------

From now on (0.1.3) AutoNap.pl doesn't necessarily need any command-line
switches. If you do not give any, it will assume you want to login to any
network and AutoNap will prompt you for a username and password. The easiest
way to login without having to fiddle around with the conffile will therefor 
be:

   AutoNa.pl -n Napster

This will give you minimal control over the network which AutoNap will try to
connect to. That's useful if you only have an account on a specific network. 
Default downloaddir will then be /tmp.

AutoNap has a config file called autonap.conf (actually, it can have any name)
which is passed to AutoNap with the -f switch, for instance:
   
   AutoNap.pl -f ~/autonap.conf

So, how does an autonap.conf look like? Here we go:

[account]

# We no longer have to specify a URL to retrieve
# the list from.
# AutoNap now makes a different approach as to that.
# Instead you may specify a network to connect to.
# This is particularly useful because some networks
# are actually hard to connect to and tend to disconnect
# quite often (especially DJNap). MusicCity is quite reliable.
acc_network=MusicCity

# Login with username foo
# acc_user=prompt_me if you want to be asked
acc_user=foo

# Login with password bar.
# When you set 
# acc_pass=prompt_me 
# you will be asked for a password
# each time you login.
acc_pass=bar

# Where to store downloads.
# Remember that you need write permissions
# for the specified directory.
acc_download_dir=/tmp

[misc]

# specify which mp3-player you want to use for streaming
misc_player=mpg123

# All of what come below isn't really doing anything
# as for yet. But some of these options can, however,
# be controlled inside AutoNap's interactive mode.
[download]
down_min_linespeed=DSL
down_min_bitrate=128
down_max_simultaneous=1
down_timeout=60
down_min_file_length=2:00

[search]
search_pattern=i'm a looser

[random]
rnd=yes
rnd_pattern=.mp3::.MP3
rnd_exclude_patterns=britney spears:backstreet boys

Using command-line switches:
----------------------------
You get a list of switches by making

    AutoNap.pl -h

In current 0.1.0a release you probably have to set up the configfile.
There is a sample one included, so just have a look at it
and change "acc_user=foo" and "acc_pass=bar" accordingly to your needs.
When you happen to have problems to login this may be due to one of
the following:
   + you have no account on this network
   + its servers aren't reachable or full
   + seldom but possible: napigator is down.
Try using the '-nw' switch to specify a network you explicitly want to 
connect to, like:

   AutpNap.pl -f ~/autonap.conf -n MusicCity
   
For me, the Napster and the MusicCity proved to be most reliable 
and, well, 'connectable'.

You can also register a new account of you do not yet have one on
a specific network. Simply launch

   AutoNap.pl -R -n MusicCity

to create one on the MusicCity network. You will then get prompted for
username and password you whish to use.
You cannot yet create an account on a meta-server which is perhaps the
reason why I couldn't create one on Napster. Will be fixed soon.
Also: Usually the server to be registered on should return an email address
in case all went fine. However, not all servers return one even though the
login-procedure seemed to be succesfull. Then you can never really say whether
your registration was successful. Well, try it.

Being inside AutoNap:
---------------------
A login sequence might look like that:

   Trying opennap2.musiccity.com on port 8888 (63.196.54.2:8888)...
   Couldn't connect to 63.196.54.2:8888: This server is full (950 connections)
   Trying opennap21.musiccity.com on port 8888 (63.196.54.21:8888)...
   Success: Logged in with nickname DJPluto (AutoNap)

In this case we had a failure on the first server we tried. Don't worry,
AutoNap will keep on trying with next available server in its list.

This now is followed by a greeting from the server you just connected to.
If there is no message of the day awaiting you this wont mean that you are
not connected. It just means there is no message. ;-)

To get acquainted with some of the commands, type 'help' and it might look 
like:
   
   help
   -----
   check   browse  ddown   downs
   get     help    last    ping
   quit    search  stream   
   -----

'last' will return the result from the last search (the equivalent for 'browse' is 'blast').
'last' <num> will return the <num>.search. So 'last 1' returns the first
search you made, 'last 2' the second etc. Simply 'last' or 'last 0' returns
the last one.

Since release 0.1.1. you have a few more commands, such as 'ping' and
'browse'. Use the 'help' command to make yourself acquainted with them.
Typing 'help <command>' gives you further information:

   help get
   -----
   get <song_num>  - tries to download given song
       <song_list> - tries to download song 'n-m' ('all' for all)
       <song_enum> - tries to download songs 'n,m,o...'
   -----

The first thing you probably want to do is searching for some files:

   search beach boys||T3
   No. |Song                                              |Size    |bit|len   |speed
   ----|--------------------------------------------------|--------|---|------|--------
   1   |Venga Boys - Sex On The Beach                     |3.4  mb |128|3:42  |T3
   2   |Beach Boys - Little Deuce Coupe                   |1.7  mb |128|1:52  |T3
   3   |Beach Boys - Barbara Ann                          |2.1  mb |128|2:18  |T3
   4   |Beach Boys - California Girls                     |2.5  mb |128|2:43  |T3
   5   |Beach Boys - Don't Worry Baby                     |2.6  mb |128|2:50  |T3

'search beach boys||T3' means: Search for all songs from the Beach Boys with 
a linespeed of at least T3. If you do not specify ||T3 it will find songs with 
(by default) DSL speed. Type 'search beach boys||UNKNOWN' to really get all.
Possible linespeeds are: 14K, 28K, 33K, 56K, 64K, 128K, Cable, DSL, T1, T3.

Being tricky on searches, you can include or exclude patterns from your result:
search beatles +michelle <=> search beatles -michelle

On request I made it possible to interrupt the scrolling of a search without 
first having to type 'q'. That becomes handy when you urgently feel like having
to download a song badly you just saw on the current page. Type 'g' or 'x' for 
that and you will get prompted for a number. If you didn't want to download 
anything at all, give no number and just hit enter and it wont download.

If you want more information on a certain item (e.g. if the song-name has been 
truncated), type 'check <number_of_song>':

   check 1
   -----
   Song:   Venga Boys - Sex On The Beach.mp3
   Owner:  jeffbuckleysucks
   Link:   LINK_T3
   Length: 3:42 min
   Size:   3.38 mb
   Freq:   44100 Hz
   Bitr:   128 kb/s
   MD5:    00000000000000000000000000000000 
   Addr:   128.91.41.108
   -----

This MD5 line is the checksum calculated by some servers of the first
300 or so kB of a song. 
Currently, only Napster-networks seem to have such a checksum. As there is no 
use of MD5 at this stage (resuming downloads had been disabled by Napster for 
legal issues), we can live without it.

With 'last' you can view again the result of your last search.

Download with 'get'. If you want the first two songs of your search, type:

   get 1
   get 2

   OR:
   get 1,2

   OR:
   get 1-2

'downs' shows the current running download job and progress. 
'ddown' removes a download job.

So, a sequence might look like:

   get 1,2
   ******
   Download: (from jeffbuckleysucks) Venga Boys - Sex On The Beach.mp3 started...
   ******
   ******
   Download: (from jpwilson) Beach Boys - Little Deuce Coupe.mp3 started...
   ******
   downs
   -----
   (1)  - (from jpwilson) Beach Boys - Little Deuce Coupe.mp3
   stats unkown
   (2)  - (from jeffbuckleysucks) Venga Boys - Sex On The Beach.mp3
   28916 / 3547624 = 0.82%
   -----
   ddown 2
   -----
   Download: (from jeffbuckleysucks) Venga Boys - Sex On The Beach.mp3 aborted.
   -----

Notes on 'pinging':
-------------------
An ordinary ping-statement looks like:
 
    ping somenick 4

where 4 specifies the time in seconds to wait for a reply.
If you do not give a number it will default to 3 secs timeout.
Sometimes this is too less for the other side to reply.
And: You do not yet get a reply as to how long the ping was.

That's it:
----------
The above should give you an idea of AutoNap and how to run it and how it 
looks. Have fun and send comments, bugs, proposals, money and stuff to 
<Tassilo.Parseval@post.rwth-aachen.de>


