mIRC Home    About    Download    Register    News    Help

Print Thread
Help with special MP3 script #175886 29/04/07 11:04 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
alias mp3sync {
  if $hget(mp3sync) { .hfree mp3sync }
  .hmake mp3sync 100
  var %b = $findfile(c:\,*.mp3;*.wav;*.wma,0)
  while %total.size <= 1040182784 {
    var %song = $r(1,%b)
    %song = $findfile(c:\,*.mp3;*.wav;*.wma,%song)
    if elvis presley !isin %song && $v1 !isin $sound(%song).artist {
      .hadd -m mp3sync $calc($hget(mp3sync,0).item + 1) %song
      inc %total.size $file(%song).size
    }
  }
  var %a = 1, %b = $hget(mp3sync,0).item
  while %a <= %b {
    ;copy $hget(mp3sync,%a).data Port_Mp3_Player
    inc %a
  }
}

The remarked line is the one I'm having trouble with, as I need to copy the files in the hash table to my portable mp3 player, and I'm not sure how to get mIRC to correctly identify the player when it's plugged in. Under Windows XP, it shows up as an Audio Player, not as a drive letter.

Re: Help with special MP3 script [Re: RusselB] #175921 30/04/07 03:31 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
hmmm, that's a strange one, can you explore the mp3 player from my computer to come up with a drive letter?

btk


billythekid
Re: Help with special MP3 script [Re: RusselB] #175923 30/04/07 04:09 PM
Joined: Jan 2007
Posts: 259
K
Kardafol Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
What type of audio player is it?


Those who can, cannot. Those who cannot, can.
Re: Help with special MP3 script [Re: billythekid] #175936 30/04/07 06:28 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
It shows up as Audio Player, no drive letter indicated, although I might be able to get a drive letter going through DOS..not sure, I'll try it tonight.

Re: Help with special MP3 script [Re: Kardafol] #175937 30/04/07 06:29 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Manufacturer is Curtis.
It's a 1M portable MP3/WMA player.

Re: Help with special MP3 script [Re: RusselB] #175942 30/04/07 10:51 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Update: MP3 player does not show up as a drive letter, in mIRC, Windows, or DOS.

Using //echo -a $disk(0) returns 7, no matter whether the MP3 player is connected or not.

Re: Help with special MP3 script [Re: RusselB] #175983 01/05/07 12:28 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
You might need to loop all audio players using a com object to check whether your player is plugged or not. Dunno which WMI class to check for... I'll have a look at it soon.

Re: Help with special MP3 script [Re: RusselB] #175992 01/05/07 02:04 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
How do you normally load files onto the device? It must have come with some sort of software. There may be an option within the software/drivers to force a drive letter onto the device, or the software may have command-line features that you could access through mIRC.

-genius_at_work

Re: Help with special MP3 script [Re: genius_at_work] #175993 01/05/07 03:11 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Normally I just drag & drop using Windows Explorer.
The software that came with the MP3 player is for usage with Windows 95.

Re: Help with special MP3 script [Re: RusselB] #175994 01/05/07 03:14 PM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Well. Used WMI class "Win32_PnPEntity"; maybe there's a better way I am not aware of - Please mind me beeing still beginners level at com stuff...

This alias will list all plugged devices to a @window - it did so on my system, at least smile . Its Purpose is to determine the "internal" name of your player...
Code:
alias win32.com.PNP.list {
  if (!@window(@PNPdevices)) { window -t3,25 @PNPdevices }
  if ($com(win32.Locator)) { .comclose win32.Locator }
  if ($com(win32.Services)) { .comclose win32.Services }
  if ($com(win32.Instances)) { .comclose win32.Instances }
  .comopen win32.Locator WbemScripting.SWbemLocator
  if ($comerr) { .comclose win32.Locator | return }
  .comclose win32.Locator $com(win32.Locator,ConnectServer,3,dispatch* win32.Services)
  if $com(win32.Services) { .comclose win32.Services $com(win32.Services, InstancesOf,3,string,Win32_PnPEntity,dispatch* win32.Instances) }
  if $com(win32.Instances) {
    var %instance = 1
    while ($comval(win32.Instances,%instance,name)) {
      aline @PNPdevices nr: %instance $chr(9) name: $ifmatch $chr(9) manufacturer: $comval(win32.Instances,%instance,manufacturer)
      inc %instance
    }
  }
  .comclose win32.Instances
}


Now, assuming your Audio Player is part of the list above, you can slightly modify this loop to return $true or $false depending on your players' plugged status...
Code:
alias win32.com.playerstatus {

  ; successfully tested with my USB-stick - fill in the name of your device
  var %devicename = SONY Storage Media USB Device

  if ($com(win32.Locator)) { .comclose win32.Locator }
  if ($com(win32.Services)) { .comclose win32.Services }
  if ($com(win32.Instances)) { .comclose win32.Instances }
  .comopen win32.Locator WbemScripting.SWbemLocator
  if ($comerr) { .comclose win32.Locator | return }
  .comclose win32.Locator $com(win32.Locator,ConnectServer,3,dispatch* win32.Services)
  if $com(win32.Services) { .comclose win32.Services $com(win32.Services, InstancesOf,3,string,Win32_PnPEntity,dispatch* win32.Instances) }
  if $com(win32.Instances) {
    var %instance = 1
    while ($comval(win32.Instances,%instance,name)) {
      if ($ifmatch ==  %devicename) { return $true }
      inc %instance
    }
    .comclose win32.Instances
  }
  return $false
}

Confirming your player is plugged was the first step, the second makes headaches... how to refer to it?? How to move the files? Maybe theres some way to "DeviceID" of the Player - its another property of Win32_PnPEntity.
e.g. (USBstick in my example) : "USBSTOR\DISK&VEN_SONY&PROD_STORAGE_MEDIA&REV_1.00\AH04062800009&0"
- any ideas?

Re: Help with special MP3 script [Re: RusselB] #176045 02/05/07 12:51 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Well where do you drag and drop the files to? Maybe a screen shot of how you normally transfer files to the device would help.

-genius_at_work

Re: Help with special MP3 script [Re: genius_at_work] #176048 02/05/07 02:20 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Screen shot per request


Re: Help with special MP3 script [Re: RusselB] #176053 02/05/07 03:19 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I don't think I've ever seen a device that acts like that.

What path is shown in the address bar of the audio player window? If you can't see the entire path in the address bar, go to Tools>Folder Options>View>check "display full path in the address bar"

How do you get to that audio player window (not autoplay when you plug it in)? If you navigate to it using explorer (My Computer), try installing this XP power toy ( http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe ). Once the power toy is installed, navigate one level above the folder where the songs are stored on the audio device, rightclick on the music folder and choose "Open Command Window Here". You should see the path to the audio device as the command prompt (ie C:\path\to\the\folder>).

-genius_at_work

Re: Help with special MP3 script [Re: genius_at_work] #176054 02/05/07 03:37 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Well, first off, the path that's returned in the address bar matches what's shown in the Title (for lack of a better term) in the screen shot.
Secondly, I tried the PowerToy, unfortunately, the "Open Command Window Here" option doesn't show when I point to the Audio Player.

At first I thought maybe I'd installed it incorrectly, so I double checked with a folder on a regular drive...so much for that theory.

Re: Help with special MP3 script [Re: RusselB] #176055 02/05/07 04:12 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The only references I could find on google talk about the audio device being set as "removable disk n".

Another possibility is that the device simply hasn't been assigned a drive letter. You could try assigning it one:

start>control panel>administrative tools>computer management>disk management

If the device is listed there, right click on it and choose "change drive letters and paths". If a drive letter is listed there you have your answer. If no drive letter is listed, click Add>Assign the following drive letter, and choose a letter.

Also, while you are replying, attach a screenshot of the My Computer window (showing the audio device). And if possible, post a screenshot of the properties window(s) of the device.

-genius_at_work

Re: Help with special MP3 script [Re: genius_at_work] #176056 02/05/07 04:34 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Not listed in disk management.

Here are the screen shots you requested.




There are two screen shots for the properties, as they have different information, and I wasn't sure which one was the one you wanted to see.

My apologies on the size of the last screen shot, I've run out of ideas to get it a decent viewable size.


Re: Help with special MP3 script [Re: RusselB] #176058 02/05/07 04:57 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Unfortunately, I'm out of ideas, and since I don't have a device that works like yours, I can't do any tests here.

-genius_at_work

Re: Help with special MP3 script [Re: genius_at_work] #176059 02/05/07 06:04 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
RusselB gets Scotty to beam his MP3 player to genius_at_work

Re: Help with special MP3 script [Re: RusselB] #176076 02/05/07 01:45 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
genius_at_work beams RusselB an MP3 player that registers itself with a drive letter.

:P

-genius_at_work