Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: a perl, awstats and SHOUTCast history

by remiah (Hermit)
on Mar 28, 2012 at 02:11 UTC ( [id://962049]=note: print w/replies, xml ) Need Help??


in reply to a perl, awstats and SHOUTCast history

Hello alexolivan.

vlc%2F1%2E1%2E5

This is hexadecimal escaped character. '%' and two hex string indicates encoded character. if you replace this string with

perl -e 'my $s="vlc%2F1%2E1%2E5"; $s=~ s/%(..)/chr(hex($1))/eg; print +$s;';
It will show
vlc/1.1.5
here, %2F='/', %2E='.'

So, How about replacing $word[6] with this regex or using module like URI::Escape?

Replies are listed 'Best First'.
Re^2: a perl, awstats and SHOUTCast history
by alexolivan (Initiate) on Mar 28, 2012 at 07:39 UTC

    wow... this comunity really rocks

    Well, I actually was aware about hex format on the shoutcast log, but I simply considered the straightest way to get something useable, so, simply getting "VLC" "Winamp" "iTunes" and so would be revolutionary enough ;-)
    Obviously, if, at the same time we could reformat the log file in such a way to pass to AWSTATS the full string it would be great.
    Neverthless, in my first attempts, awstats refused to accept the unformated 7th string as valid data, so I also though to stick to documentation and give it a simple string, without any kind of symbols/characters that may lead it to ignore it.
    It should be noted that some players like iTunes appears as an incredibly long (and useless) string that among version includes Operating system info, OSX info and so...

    I think it would be interesting to have the 2 shots: one sc_parse.pl script that changes player string to simply "vlc" and another one with "vlc/1.1.5" so both could be tested against awstats.

    Anyways I'm still unable to rebuild the script with the proposed changes here, since I don't see the algorithm behind them, and I'm still investigating how should I put all pieces together in the now working parsing script

    Thank you all guys!!! :-D

      doh!
      some ours on it and I got no results, I dont know how to tell the script to replace the string with any of the proposed expressions while inside a loop. gave up again
      trashing everything, stick on the original script, and awaiting to a little more input from the comunity before investing more time on this.

      thanks but again!

        What? Community? How are you running awstats? What is the LogFormat?

        See Re: a perl, awstats and SHOUTCast history and use

        ... $player = 'VLC' if $player =~ /VLC/i; $player = 'iTunes' if $player =~ /iTunes/i; ## generic, remove everything after first non word char ## hopefully only leaving something like iTunes $player =~ s/\W.*//; $player = uc $player; # uppercase it ...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://962049]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-23 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found