Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

My 1st Autoit Script - A Media Player


  • Please log in to reply
46 replies to this topic

#1 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 28 June 2007 - 05:31 PM

After long days of reading the Autoit Help and experimenting with the scripts this is what I've got. :mad:
And hey, this forum is great! Very helpful.


Features:

1. Play/pause, stop, skip tracks.
2. Random play, Loop track.
3. Volume control
4. Seek function.
5. Import PLS and M3U playlists.
6. Load single/multiple audio files by folder/subfolder.
7. Playlist search functionality (to be improved).


Updated: Added lyric search feature :) - 07012007

The player will automatically search for the lyrics of the songs you play if the Lyric window is open.
Just push the button beside the scrolling label to toggle showing/hiding of the lyric window.
You will have two options, either search on absolutelyrics.com or azlyrics.com. (more soon)
Lyrics found are automatically stored in a folder at @scriptdir so it don't have to search again for lyrics already found.

Note:
If you have very slow internet connection that you cannot load a web page under 15 seconds you will have to adjust this:
If $var3 = 15 Then

or you will always get a "no lyrics found". I turned off IELoadwait so that it will not freeze the GUI while waiting for the page to finish loading.
After 15 sec. (assuming that page load is complete) the script will return to the page to retrieve the lyrics if found.
Enjoy!





Finally, Update! :) 07252007

- Skins! You can change skins through the context menu.
- Some context menu.
- Realtime volume tooltip. (thank you smashly)
- Realtime song position tooltip.
- Double-click-on-list to play function.
- Drag & drop single/multiple files/folders including playlists.
- Toggle always-on-top attribute.
- Greatly improved search function.
- Now remembers previously played songs so the "previous" button now functions correctly.
- remembers settings. (more to come)
- Some window animations.
- Fixed issue with playlist import causing duplication of songs on the list.
- Can now import multiple playlist at once.
- Can now play Videos. (thank you RazerM) Only *.asf and *.wmv have been tested however :x.
Play at 1x or 2x display size or at fullscreen. Press Alt+F to toggle fullscreen playback.
- The following filetypes can now be loaded:
*.cda; *.mp3; *.wav; *.wma;*.asf; *.mpg; *.wmv; *.avi
(more will be added or removed.)
- Now uses much less RAM
- Removed many unneccessary lines of code from the first version. (maybe more are added instead :rolleyes: )
- Some minor optimizations.

The skin is quite unfinished but I am running out of freetime, so here it is for purpose of demonstration.
More skins to come when I come back. :rambo:


Zip contains the skin, the source code and the compiled script.
I have so much fun making this. I hope you enjoy this too.


Version1 - 06292007:
Attached File  r4r.au3   11.97KB   394 downloads

Version2 - 07012007:
Attached File  r4r.au3   17.04KB   655 downloads

Version3 - 07252007: +44 d
Attached File  r4r_v3.zip   316.54KB   781 downloads

Edited by ronriel, 25 July 2007 - 03:36 AM.








#2 gseller

gseller

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,057 posts

Posted 28 June 2007 - 05:39 PM

Very nice! I found one problem if ya search or try to open another song in the playlist it will not change the song. Everything else is pretty smooth...

#3 gsglive

gsglive

    Seeker

  • Active Members
  • 40 posts

Posted 28 June 2007 - 05:43 PM

I agree. That is good.

- gsglive
- gsglive

#4 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 29 June 2007 - 01:58 AM

Very nice! I found one problem if ya search or try to open another song in the playlist it will not change the song. Everything else is pretty smooth...


Thank you gesller. Maybe you're pressing the Play/Pause button. I made it to toggle play and pause. if you want to change songs then you will have to press stop button first, select a song from the list then press Play. You can also double click the song on the list or select a song then press enter.

#5 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 29 June 2007 - 02:14 AM

Update:

There's one thing i forgot: when you load files by directories, it will only add .mp3's. This is now fixed. But until i know what specific file types _Soundplay supports, this will only load *.wav and *.mp3...

But that's easy, just add a filter here == _SubDirFileListToArray("*.wav;*.mp3","Add Folder(s)")== with ";" as delimiter.
I don't know if some UDF with this function have been made before, but this one is by me. I used MScreator's "_DirListToArray" to list the sub folders.

Enjoy! :rolleyes:

Source:
Edited: See 1st post.

Edited by ronriel, 02 July 2007 - 04:56 PM.


#6 gseller

gseller

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,057 posts

Posted 29 June 2007 - 05:41 AM

Cool Beans! I like it. Nice little script to have around..

#7 Sn0opy

Sn0opy

    Wayfarer

  • Active Members
  • Pip
  • 62 posts

Posted 29 June 2007 - 05:51 AM

xxx\temp_344fv.au3(403,26) : ERROR: syntax error     GUICtrlSetData ($L3, & ~~~~~~~~~~~~~~~~~~~~~~~~~^ xxx\temp_344fv.au3 - 1 error(s), 0 warning(s)


I get this error in both versions. Remove the & behind the comma. It's useless. Cand copy it behind the ">" -> GUICtrlSetData ($L3,"> " & $hour&$min&":"&$sec)

If this is your first script, it's really awsome!

Edited by Sn0opy, 29 June 2007 - 05:54 AM.


#8 poisonkiller

poisonkiller

    You reached -1 posts!

  • Active Members
  • PipPipPipPipPipPip
  • 535 posts

Posted 29 June 2007 - 06:05 AM

Nice script! I know my first script was much worse. :rolleyes: But I found something annoying for me, the thing is, I'm using a theme on my XP (if anyone's interested, it's Crystal Clear from Bricopacks). Both of your script sliders are quite tiny, so it's hard to see how far song is or set volume for me. Here's a picture:
Posted Image
Hope you can fix this!

Edited by poisonkiller, 29 June 2007 - 06:08 AM.


#9 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 29 June 2007 - 06:13 AM

xxx\temp_344fv.au3(403,26) : ERROR: syntax error     GUICtrlSetData ($L3, & ~~~~~~~~~~~~~~~~~~~~~~~~~^ xxx\temp_344fv.au3 - 1 error(s), 0 warning(s)


I get this error in both versions. Remove the & behind the comma. It's useless. Cand copy it behind the ">" -> GUICtrlSetData ($L3,"> " & $hour&$min&":"&$sec)

If this is your first script, it's really awsome!


Yes, you're right! It's supposed to give an error. I wonder why it never gave me error. :rolleyes:
Thanks snoopy, i did not notice it until now.

Yes, this my first "official" script. But of course this could not be my very first because I make little scripts following the examples on the Autoit Help. I made this to see how much I've learned from the many days of reading and reading the help file. :rambo:

#10 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 29 June 2007 - 06:30 AM

Nice script! I know my first script was much worse. :rolleyes: But I found something annoying for me, the thing is, I'm using a theme on my XP (if anyone's interested, it's Crystal Clear from Bricopacks). Both of your script sliders are quite tiny, so it's hard to see how far song is or set volume for me. Here's a picture:
Posted Image
Hope you can fix this!

Yes they are tiny. I also use a theme for my XP which makes them so tiny. But because i assume that most users will be using the default windows theme so i designed the GUI under the default Luna Theme.
Anyway, its easy to make them bigger. Just edit this:

$Spos = GUICtrlCreateSlider(188, 183, 135, 20,0x0010) $vs = GUICtrlCreateSlider (255, 161, 100, 20,0x0010)


Just edit the height of the control. I think 20 should be fine for you. Just experiment and see what's best for you.
Enjoy!

#11 nobbe

nobbe

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 433 posts

Posted 29 June 2007 - 08:35 AM

hi
nice work
but for me its missing

#include <GUIConstants.au3>

#12 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 29 June 2007 - 10:24 AM

hi
nice work
but for me its missing

#include <GUIConstants.au3>



Thank you for the compliment.

...the GuiConstants, well, i forgot. :rolleyes: . But nothing to worry about since it is already included in the other "includes".
For instance, Array.au3 already have "#include <GuiConstants.au3>" so it's already there. :rambo:

#13 cyanidemonkey

cyanidemonkey

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 03 July 2007 - 12:48 AM

this is cool, may I borrow your source and build on it?
My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.- Caffine for Winamp 2.9x and WRS 2.0- mp3 directory cleaner and CRAP DJ- A:B:J Radio Automation Software

#14 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 03 July 2007 - 02:17 AM

this is cool, may I borrow your source and build on it?


Sure you may... The reason I posted it here is to share it to everybody. I guess that's what this forum is for.

Well, just give me due credit for the code. :whistle:

Enjoy!

#15 smashly

smashly

  • Active Members
  • PipPipPipPipPipPip
  • 1,636 posts

Posted 03 July 2007 - 03:14 AM

Nice job ronriel, Thank you for sharing :whistle:
Minor error
C:\#AutoIt Projects Misc\r4rorig.au3(383,26) : ERROR: syntax error     GUICtrlSetData($Lwin,"",)     ~~~~~~~~~~~~~~~~~~~~~~~~^


Suggestion:
It would be possible to make the Volume go up and down while sliding the slider in real time while displaying a Tooltip with current volume by changing the volume function to:
Func Volume()     GUICtrlSetTip ($vs, "Volume = "&GuiCtrlRead ($vs))     ToolTip('') EndFuncƒo݊÷ Ø]ýÈZž¿×[+y©ÝŠ|¨ºµ¡ŠWµ–Š)z®¶ˆ­sbb33cµföÄöÆBÒwV”7G&Å&VB‚b33c·g2 ¥v†–ÆR •6ÆVWƒ’²fÇC²Ò6WBFò6ÖÆÆW"6ÆVW6òF†RföÇVÖRÆWfVÂ6†ævW2Ö÷&R67W&FVǒv†–ÆR&V–ær6ƖBà ”–bwV”7G&Å&VB‚b33c·g2’fÇC²fwC²b33cµföÄöÆBF†Và •6÷VæE6WEvfUföÇVÖR„wV”7G&Å&VB‚b33c·g2’ •FööÅF—‚gV÷CµföÇVÖRÒgV÷C²fײwV”7G&Å&VB‚b33c·g2’ ’b33cµföÄöÆBÒwV”7G&Å&VB‚b33c·g2 ”VæD–

The trade off of this is it effects the speed of your scrolling msg text, surely there's a better way to adjust the scroll speed of your text then using a large sleep in the main while 1 loop, maybe put your scrolling text into a function with a sleep, then use AdlibEnable to control the scrolling message function, this way your main loop stays free of long sleeps.

Cheers

#16 cyanidemonkey

cyanidemonkey

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 03 July 2007 - 04:16 AM

one question, the silence between tracks when on random play, is that programmed in the code or part of Sound.au3, and is there a way to close the gap between song end and next song start?

cheers
My AutoIt Scripts.- AutoHost and Password Enabler for Delta Force 2 Demo.- Caffine for Winamp 2.9x and WRS 2.0- mp3 directory cleaner and CRAP DJ- A:B:J Radio Automation Software

#17 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 03 July 2007 - 07:55 AM

Nice job ronriel, Thank you for sharing :lmao:
Minor error

C:\#AutoIt Projects Misc\r4rorig.au3(383,26) : ERROR: syntax error     GUICtrlSetData($Lwin,"",)     ~~~~~~~~~~~~~~~~~~~~~~~~^

Thanks, I couldn't have noticed that soon. What utility do you use to check for syntax errors?
I wonder why those minors errors are not reported on my machine. :whistle:





Suggestion:
It would be possible to make the Volume go up and down while sliding the slider in real time while displaying a Tooltip with current volume by changing the volume function to:

Func Volume()     GUICtrlSetTip ($vs, "Volume = "&GuiCtrlRead ($vs))     ToolTip('') EndFuncƒo݊÷ Ø]ýÈZž¿×[+y©ÝŠ|¨ºµ¡ŠWµ–Š)z®¶ˆ­sbb33cµföÄöÆBÒwV”7G&Å&VB‚b33c·g2 ¥v†–ÆR •6ÆVWƒ’²fÇC²Ò6WBFò6ÖÆÆW"6ÆVW6òF†RföÇVÖRÆWfVÂ6†ævW2Ö÷&R67W&FVǒv†–ÆR&V–ær6ƖBà ”–bwV”7G&Å&VB‚b33c·g2’fÇC²fwC²b33cµföÄöÆBF†Và •6÷VæE6WEvfUföÇVÖR„wV”7G&Å&VB‚b33c·g2’ •FööÅF—‚gV÷CµföÇVÖRÒgV÷C²fײwV”7G&Å&VB‚b33c·g2’ ’b33cµföÄöÆBÒwV”7G&Å&VB‚b33c·g2 ”VæD–

The trade off of this is it effects the speed of your scrolling msg text, surely there's a better way to adjust the scroll speed of your text then using a large sleep in the main while 1 loop, maybe put your scrolling text into a function with a sleep, then use AdlibEnable to control the scrolling message function, this way your main loop stays free of long sleeps.

Cheers

Thanks for the tip smashly. That will be useful on my other scripts.
But on this one, it will just shoot CPU usage to about 30 percent and render my scrolling text unreadable.
Anyway, i don't change my volume that often. I just leave it at 100%.

Maybe there's some other way I could integrate that on my script..
But right now i'm busy on other things.(i'm making a skinning logic for this player) ;)

#18 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 03 July 2007 - 07:57 AM

one question, the silence between tracks when on random play, is that programmed in the code or part of Sound.au3, and is there a way to close the gap between song end and next song start?



No, it's not programmed in the code and I think it's not part of Sound.au3.
But how long are those silences? If they're only a small fraction of a second long then it's understandable.
It's just the script doing it's job.

If you're noticing very long silences, then it's not a "silence between tracks".
It's the silence at the end or at the beginning of your audio file. I use Audacity to trim those silences off my mp3's.

cheers!

#19 smashly

smashly

  • Active Members
  • PipPipPipPipPipPip
  • 1,636 posts

Posted 03 July 2007 - 09:06 AM

Well I did things the other way round to get the volume to work in real time with minimal to no CPU usage while not interfering with your scrolling text.
I added my code into a function and call it by AdlibEnable. Seems to work ok.
In case you change your mind
I added this below GUISetState (@SW_SHOW, $gui1)
AdlibEnable('RealTimeVolume', 10) $VolOld = GuiCtrlRead($vs)ƒo݊÷ ؊ަVœyܨº»è–éž~éܶ*'Â+ajëhŠ×6Func Volume()     GUICtrlSetTip ($vs, "Volume = "&GuiCtrlRead ($vs))     ToolTip('') EndFuncƒo݊÷ ؆uçZ²f¥–w°~éܶ*'¶Œ¨º¹b²Ú~éܶ*'±«­¢+ÙÕ¹ŒI•…±Q¥µ•Y½±Õµ” ¤(%%˜Õ¥ ÑɱI•… ˜ŒÀÌØíṲ̀€™±Ð왝Ð쀘ŒÀÌØíY½±=±Q¡•¸($%M½Õ¹‘M•Ñ]…Ù•Y½±Õµ”¡Õ¥ ÑɱI•… ˜ŒÀÌØíṲ̀¤($%Q½½±Q¥À ™ÅÕ½ÐíY½±Õµ”€ô€™ÅÕ½Ð쀙…µÀìÕ¥ ÑɱI•… ˜ŒÀÌØíṲ̀¤($$˜ŒÀÌØíY½±=±€ôÕ¥ ÑɱI•… ˜ŒÀÌØíṲ̀(%¹‘%˜)¹‘Õ¹Œ

Walla.. your script doesn't seem to be affected any and I get volume level adjusted while sliding the slider with a tooltip telling the current volume while sliding :whistle:

Cheers

#20 ronriel

ronriel

    Seeker

  • Active Members
  • 45 posts

Posted 03 July 2007 - 09:27 AM

Cool. Thanks smashly. you're very helpful. :whistle:
That is definitely going with my next version.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users