AutoNap.pl - an interacting and non-interacting Napster/OpenNap client
AutoNap.pl [options]
-h
-R [-n]
[-f] [-p -u -m -S -n -P -r -x -l -b -d]
[-f] [-p -s -r -a]
AutoNap.pl is a program written in Perl which will connect to an OpenNap compatible network (Napster is one of those), search for given songs and download them.
It is intended either for interacting mode using a console color-interface or running unattendedly by following the directives given in a configfile. As for now, you will have to confine yourself to the interacting mode. Yet, I am doing my best to with implementing the non-interacting mode as well as making the interactive interface as smooth and comfortable as possible.
If you ever find a feature announced as being available and in fact it is not yet there, please take into account that this client isn't even one month old. Same applies to bugs of which AutoNap is probably particularly rich. Don't just wipe it off from your system: report the bugs instead to me and I'll fix it as soon as possible, often within less than 24h. Or: be an even better boy by fixing it yourself and send me the diff. ;-)
This will try to register you on a MusicCity server. It will prompt you for desired username and password:
AutoNap.pl -R -n MusicCity
Read options from /home/ethan/autonap.conf but only try MusicCity servers:
AutoNap.pl -f /home/ethan/autonap.conf -n MusicCity
Try to login to any server with user/pass foo/bar and set mp3player to mp3blaster:
AutoNap.pl -u foo -p bar -P mp3blaster
And so on, and so on. When you are smart, you should know yourself which options make sense with each other and which don't. ;-)
When using interactive mode (which is currently the only available one), you see yourself presented with the server's MOTD after login if there is any. You then can control AutoNap through the built-in commands which are listed to you when typing 'help'. Typing 'help <command>' gives you further advice on a particular command.
Some of the commands take arguments, some are without and some may take arguments. Commands without any further arguments are 'downs' and 'quit'. 'last' and 'help' can take arguments and for all other commands an argument must be supplied.
Prefixing a command with a '!' will invoke the following string to be interpreted as a system command. However, shell built-ins do not work, in order to execute these (things such as 'cd' etc.) you can do (for the bash):
!bash -c 'cd ..'
As this is clumsy and hardly a win over switching to another shell, you can just start a new shell by typing:
!bash
and then comfortably doing all your stuff there. exit will return you to AutoNap.
This mode is intended for those who want an mp3 leecher that can run as a cron-job for instance. Or those who want to fill their harddrive overnight without any own activity.
As AutoNap, once started with the -a option, can no longer be influenced (except by killing it), all options need to be passed to it in beforehand, preferably through the autonap.conf. For testing purpose, you can however trace what AutoNap is doing by invoking tail -f auto.log. This is useful if you doubt that AutoNap will find any songs relating to the search pattern you specified. In this case you could interrupt AutoNap and start it once more with modified parameters.
Basically, you have to keep in mind that not even AutoNap can perform black magic and that it follows certain hard-coded rules when running non-interactively. It is helpful for you to know what it does and it which order.
First of all it logs on a network just as it does in interactive mode. Afterwards it has a closer look at the config-file and will read out the options given in the [rnd] and [auto] section. If it cannot find satisfactory information it will either assign some in its opinion reasonable defaults...or in worst case it will break. This will probably happen if you specified no values at all.
AutoNap's next step is assigning each search pattern to an element of an array. Thus it can be assured that later search results retrieved on different search patterns will not be merged. It will now perform several searches, depending on what you told him in the configfile. Assuming you gave him three search patterns and a bitrange of 128 and 160 kbits, AutoNap will do 3 * 2 = 6 searches. For each search pattern it will look for songs with at least 128 kbits and at least 160 kbits. It will merge search results from different bitrates per pattern und filter out any song that either is not in the range of the bitrates or that is not within the range of song-length (for instance 2:00 minutes and 5:00 minutes).
If you set ping=yes in the conffile each song (better: its owner) is pinged and the roundtrip time together with the song put into a hash. After all pings have been done, all songs belonging to the respecitve search pattern are sorted by ping-reply. Pinging takes a lot of time, you should be aware of that. If you don't want AutoNap to ping the owners, that's also fine with it. Then it'll just try to get a song one after another till a download has been succesfully finished.
AutoNap will never download more than one song relating to one search pattern. So when you specify beatles +help::beach boys +surfin +usa it will at most get two songs and you do not have to worry that AutoNap pumps 'Help' by the Beatles a few times into your computer.
It behaves differently on random-searches. If you do not give it a limit (auto_max_download=3 for a maximum of three downloads) it will download as many songs as it will find and be able to download. Thus you can broaden your musical horizont by letting AutoNap run randomly while you sleep in the night. Next morning you should have a handful of probably new songs.
You'll find more detailed information in the autonap.conf(5).
When browsing other user's song archive or retrieving results from a search, AutoNap wont scroll through to the bottom without you even catching a glimpse of the song. It will pause after (currently) 25 songs and ask you to press a key to go on scrolling or hitting 'q' to quit the list prematurely. There are two more keys you can press, 'g' and 'x'.
'g' is useful when you just spied a song on the current page you badly need to have and you can't wait to scroll the list to the bottom or taking the pain on you to hit 'q' and then entering 'get <num>'. So it'll prompt you for this number, trying to initiate the download and return into paging mode. 'x' (short for execute and exit;-) does the same but wont return and instead fall back to the AutoNap shell.
Both 'g' and 'x' wont affect 'last' in any way and prematurely leaving the list with 'q' will still cache the result, so you can rebrowse that at a later time. In case you mistakenly hit 'x' or 'g' and you do not want to download any of the songs, just hit RETURN without any input and it'll savely make you leave the prompt without the need of downloading anything.
Tassilo von Parseval <Tassilo.Parseval@post.RWTH-Aachen.de>.
Copyright (c) 2001 Tassilo von Parseval. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL).