mIRC Home    About    Download    Register    News    Help

Print Thread
gettok took me down #63732 11/12/03 10:53 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
ok basicly i fixed the problem i was having but NOW im having a slightly diffrent problem

if there is a space any where in the file location this doesnt work what i have is:

$gettok($remove($read($mircdirmp3\mp3list.txt, %mp3.songnum), "), 1, 32)

can any one point me in the right direction so it will like find .mp3 part and then start removing again after that or something?


Need amazing web design for low price: http://www.matrixn3t.net
Re: gettok took me down #63733 11/12/03 11:02 PM
Joined: Oct 2003
Posts: 80
R
RockHound Offline
Babel fish
Offline
Babel fish
R
Joined: Oct 2003
Posts: 80
$replace instead of $remove maybe
]
when i saw your post i did not quiet understand it and played with it a little $remove the _ and $replace the - with a space


RockHound
Re: gettok took me down #63734 11/12/03 11:07 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
if i try to do a replace on space then it would come out as one big chunk of text and all i need is the files url _-_;


Need amazing web design for low price: http://www.matrixn3t.net
Re: gettok took me down #63735 11/12/03 11:09 PM
Joined: Oct 2003
Posts: 80
R
RockHound Offline
Babel fish
Offline
Babel fish
R
Joined: Oct 2003
Posts: 80
did you use $chr(160) as a replacement?


RockHound
Re: gettok took me down #63736 11/12/03 11:13 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
no i didnt even do the replace ~_~ i am just saying if i were to replace (Space) with (_ or -) then it would be a chunk of text =/


Need amazing web design for low price: http://www.matrixn3t.net
Re: gettok took me down #63737 11/12/03 11:23 PM
Joined: Oct 2003
Posts: 80
R
RockHound Offline
Babel fish
Offline
Babel fish
R
Joined: Oct 2003
Posts: 80
Sorry im completely lost as to what your trying to do here.


RockHound
Re: gettok took me down #63738 11/12/03 11:28 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Code:
alias demo {
  var %f = "C:\Path\To\Song\Song_-_title.mp3" Blah
  /echo -s 
  /echo -s Parsed: $songFromFile(%f)
  /echo -s Dir: $songFromFile(%f).Dir
  /echo -s File: $songFromFile(%f).File
  /echo -s Artist: $songFromFile(%f).Artist
  /echo -s Song: $songFromFile(%f).Song
  /echo -s 
}
alias songFromFile {
  if ($prop == dir) return $nofile($gettok($1-, 1, $asc(")))
  else if ($prop == file) return $nopath($gettok($1-, 1, $asc(")))
  else if ($prop == artist) return $gettok($nopath($gettok($1-, 1, $asc("))), 1, $asc(-))
  else if ($prop == song) return $gettok($gettok($nopath($gettok($1-, 1, $asc("))), 2, $asc(-)), 1, 46)
  else return $gettok($1-, 1, $asc("))
}


-KingTomato
Re: gettok took me down #63739 11/12/03 11:35 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
ok ok here i get a line from a text file with this:

$read($mircdirmp3\mp3list.txt, %mp3.songnum)

k so far got me?! _-_;

now it will return a text of line that looks like this:
"C:\Anime\music\gunsmith_cats_-_hateshinai_toiki.mp3 Hateshinai Toiki" Unknown

k now let me break that down

"<location to mp3 and mp3file name> <song title>" <then this is the band name>

k get where i am going?

i think i might have to break the text down more like have it like this

"<dir to song> <filename> <song name>" <title>


Need amazing web design for low price: http://www.matrixn3t.net
Re: gettok took me down #63740 11/12/03 11:41 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
erm KT that didnt quiet help me if i have the title longer it doesnt work right

Last edited by ATMA; 12/12/03 12:03 AM.

Need amazing web design for low price: http://www.matrixn3t.net
Re: gettok took me down #63741 12/12/03 04:01 AM
Joined: Dec 2003
Posts: 33
M
Man Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2003
Posts: 33
Why didn't the two regular expession answers in the previous post not work?? They both work for me, Ill put the one not made by me (its slightl'y smaller) here.

Code:
alias mp3.play {  
  if ($dialog(topbar)) {
    if (!%mp3.songnum) { set %mp3.songnum 1 }
    var %songname $read($mircdirmp3\mp3list.txt, %songnum)
    if ($regex(file,%songname,/"(.+\.\w+)/)) {
      splay -p $+(",$regml(file,1),")
      startmp3
    }
    else echo -a Error Song not found in line %songnum
  }
}


Edit: Fixed so mIRC will play files with spaces correctly

Last edited by Man; 12/12/03 05:01 AM.
Re: gettok took me down #63742 12/12/03 04:21 AM
Joined: Dec 2003
Posts: 33
M
Man Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2003
Posts: 33
I'll explain what the regular expession here does, just incase you wanted to know.

Code:
$regex(file,%songname,/"(.+\.\w+)/)

Sets the name of 'file' to the regular expession so it can easily be called in a $regml later

Looks in the sting contained in the varible %songname

/"(.+\.\w+)/ This is the regular expression

the / at the start and end are used to set properties, but in this no properties are selected making the / and / useless

Then we have a ", this will look in the string for a "
The ( and ) marks what we want to be stored in the $regml.

After finding the the ", we want it to find anything, thats what the . does, we know SOMETHING is going to be after the " but we dont know what, and theres going to be more than 1 charector so we use a + to repeat the .

The \. states to look for the . charector (this will find the dot just before the mp3)

Then we look for any word charector with \w as many times as there are word charectors (a space isn't a word charector)

Hope this helps

Re: gettok took me down #63743 12/12/03 05:00 AM
Joined: Dec 2003
Posts: 33
M
Man Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2003
Posts: 33
Sorry for the many replies, but the way you have set your file up makes it very difficult to make something work 100% of the time.

The example above WONT work if you have a . in the stuff after the filename to fix this use

Code:
/"([^\.]+\.\w+)/

as the regular expression instead

But doing this means you CANT have . in your filename, this shouldnt matter as I dont think mIRC will play a file with more than one . in it anyway.

PS: It would be ALOT easier if the filename was covered in " and if the song name needs it own give it its own, and dont put them in the one.

ie
"Filename" "Song Title" "Artist Name"

Then use the regular expression
Code:
/("[^"]+"|\w+)/g

In your $regml you can use $regml(file,N) where N the like your token.

In "This will allow spaces" Dont_need_spaces "Space here"

1 = "This will allow spaces"
2 = Dont_need_spaces
3 = "Space here"

For 2 and 3 you would want to remove the " $remove(text,")
but for 1 just pass it through with the " mIRC will understand the spaces better that way.

atma i need a favor #63744 12/12/03 05:17 AM
Joined: Oct 2003
Posts: 306
J
jacksparrow2 Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Oct 2003
Posts: 306
i know you are the only one who knows mdx i need a add on
of status bar with mdx please helpme


mess with the best
Re: gettok took me down #63745 14/12/03 08:35 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Quote:
Edit: Fixed so mIRC will play files with spaces correctly

/splay C:\path to dir\song with spaces.ext <- works fine. wink

Re: gettok took me down #63746 15/12/03 03:15 PM
Joined: Dec 2003
Posts: 33
M
Man Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2003
Posts: 33
Its always best to put the " in