Jump to content

Pull text from flash?


Recommended Posts

I was making a web radio player that reads the tracks played, puts it into some variable and then saves it to the text file.

I already accomplished everything except pull text from the Flash Object.

Basically I want to take the artist name and track name and save it.

I've tried _FileReadToArray but it didn't work ;)

Here is the script

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:          Foxhound

 Script Function:
         Shoutcast player
#ce ----------------------------------------------------------------------------
dim $data
$url = "http://www.shoutcast.com/shoutcast-cdn/flash/popupPlayer_V19.swf?stationid=http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356&play_status=1"
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <File.au3>
SplashTextOn ("Shoutcast .977 player","By FOXHOUND",300,150,-1,-1,1,"Arial",30,300)
AutoItSetOption("GUICloseOnESC",1)
$ieObj = _IECreateEmbedded()
$Form1 = GUICreate("Shoutcast player v2.0",415, 130,-1,-1)
$AX  = GUICtrlCreateObj($ieObj,0,0,415,130)
;$button = GUICtrlCreateButton("Play",75,20,100,30)
_IENavigate($ieObj,$url)
GUISetState(@SW_SHOW)
SplashOff()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by Foxhound
Link to comment
Share on other sites

I'll take a look now. Hold on.

EDIT:

Hmm, I think I found the variables used to store the data. But I can't find out how to get this variable into autoit though.

I will search some.

EDIT:

Wow, I found a-lot things. Station files, playlist files. I just can't find the title and artist.

This is how the playlist looks like:

[playlist]
numberofentries=20
File1=http://scfire-ntc-aa05.stream.aol.com:80/stream/1074
Title1=(#1 - 92/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File2=http://scfire-dtc-aa06.stream.aol.com:80/stream/1074
Title2=(#2 - 94/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File3=http://scfire-mtc-aa05.stream.aol.com:80/stream/1074
Title3=(#3 - 95/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File4=http://scfire-mtc-aa01.stream.aol.com:80/stream/1074
Title4=(#4 - 96/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File5=http://scfire-mtc-aa06.stream.aol.com:80/stream/1074
Title5=(#5 - 97/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File6=http://scfire-ntc-aa07.stream.aol.com:80/stream/1074
Title6=(#6 - 100/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File7=http://scfire-dtc-aa03.stream.aol.com:80/stream/1074
Title7=(#7 - 104/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File8=http://scfire-mtc-aa03.stream.aol.com:80/stream/1074
Title8=(#8 - 105/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File9=http://scfire-ntc-aa08.stream.aol.com:80/stream/1074
Title9=(#9 - 106/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File10=http://scfire-dtc-aa01.stream.aol.com:80/stream/1074
Title10=(#10 - 107/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File11=http://scfire-ntc-aa03.stream.aol.com:80/stream/1074
Title11=(#11 - 116/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File12=http://scfire-dtc-aa02.stream.aol.com:80/stream/1074
Title12=(#12 - 117/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File13=http://scfire-mtc-aa02.stream.aol.com:80/stream/1074
Title13=(#13 - 118/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File14=http://scfire-ntc-aa04.stream.aol.com:80/stream/1074
Title14=(#14 - 119/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File15=http://scfire-ntc-aa06.stream.aol.com:80/stream/1074
Title15=(#15 - 143/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File16=http://scfire-dtc-aa05.stream.aol.com:80/stream/1074
Title16=(#16 - 143/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File17=http://scfire-dtc-aa04.stream.aol.com:80/stream/1074
Title17=(#17 - 188/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File18=http://scfire-mtc-aa04.stream.aol.com:80/stream/1074
Title18=(#18 - 253/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File19=http://scfire-ntc-aa02.stream.aol.com:80/stream/1074
Title19=(#19 - 899/11500) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
File20=http://205.188.215.230:8002
Title20=(#20 - 420/600) .977 The Hitz Channel - 977MUSIC.COM - The #1 Hit Music Internet Radio Channel
Length1=-1
Version=2

EDIT:

I did found this for the "hitz" channel.

http://www.977music.com/channels/hitz/nowplayingflash.html

But it doens't seem to be the correct song.

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

You could also use the flash instead of an ie object.

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
GUICreate ("Flash", 820, 700, -1, -1)
$GUIActiveX    = GUICtrlCreateObj( $oRP, 10, 10 , 800 , 580)
With $oRP
    .bgcolor = "#ffffff"
    .Movie = 'http://www.shoutcast.com/shoutcast-cdn/flash/popupPlayer_V19.swf?stationid=http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356&play_status=1'
    .ScaleMode = 2
    .Loop = False
    .wmode = "Opaque"
    .FlashVars = ""
EndWith

GUISetState ()

while 1
sleep(100)
wend

You could try something like: $lastsong=$oRP.GetVariable("LastSong"), but its more hacking at this point. You need to decompile the swf and look for the variable that displays the name and author of the song.

Maybe copy paste is the best.

Edited by cageman
Link to comment
Share on other sites

You could also use the flash instead of an ie object.

Global $oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
GUICreate ("Flash", 820, 700, -1, -1)
$GUIActiveX    = GUICtrlCreateObj( $oRP, 10, 10 , 800 , 580)
With $oRP
    .bgcolor = "#ffffff"
    .Movie = 'http://www.shoutcast.com/shoutcast-cdn/flash/popupPlayer_V19.swf?stationid=http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356&play_status=1'
    .ScaleMode = 2
    .Loop = False
    .wmode = "Opaque"
    .FlashVars = ""
EndWith

GUISetState ()

while 1
sleep(100)
wend

You could try something like: $lastsong=$oRP.GetVariable("LastSong"), but its more hacking at this point. You need to decompile the swf and look for the variable that displays the name and author of the song.

Maybe copy paste is the best.

I sorta already had the variable.

.getVariable is a really weird function. I never accomplished to made it work. :/

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Ok sorry for being so late to respond.

I found another way to pull text from shoutcast's website.

The problem is (as I explained here: http://www.autoitscript.com/forum/index.php?showtopic=118979) shoutcasts' website updates their now playing

list too slowly. The flash text, however, updates almost immediately. So I still need to find a way.

I've included the two functions I'm using now

Func getTitle()
    ;Fetch the title of the song playing embedded deep inside the html source code of Shoutcasts home page.
    ;The alternative was pulling this information from their Flash Object, but seeing as I can't figure out how to
    ;pull text from flash, this will have to do. This method also explains why the song info updates a lot slower.
    $source = _INetGetSource("http://www.shoutcast.com/")
    $tar = _StringBetween2($source,"<div>Site: <a href=""http://www.977music.com","<div class=""dirspacer""></div>")
    $tar2 = _StringBetween2($tar,"Played:","</div>")
    Return($tar2)

Func _StringBetween2($s, $from, $to)
    ;This helpful function taken from: http://www.autoitscript.com/forum/index.php?showtopic=89554
    $x = StringInStr($s, $from) + StringLen($from)
    $y = StringInStr(StringTrimLeft($s, $x), $to)
    Return StringMid($s, $x, $y)
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...