Radio Gui, parse display

Get help with using AutoHotkey and its commands and hotkeys
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Radio Gui, parse display

11 Feb 2020, 11:26

would it be possible to parse an xml file and have it do 4 things, the xml is structured like this

Code: Select all

		<track>
			<location>http opml.radiotime.com /Tune.ashx?id=s166793&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</location>  Broken Link for safety
			<title>Royal Teens - Believe Me</title>
			<creator>Addictive 50s (Canada)</creator>
			<info>http opml.radiotime.com /Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</info>  Broken Link for safety
			<image>file:///C:/Users/mark/AppData/Roaming/vlc/art/arturl/908ea30cc61053ee87e5a9bd24796493/art</image>
			<extension application="http www.videolan.org /vlc/playlist/0">  Broken Link for safety
				<vlc:id>0</vlc:id>
			</extension>
		</track>
what is needed is to copy the <creator></creator > info to clipboard
then open <location></location> with internet explorer and save the filename.m3u with the name from the clipboard (To folder m3u)
then open <image></image> with internet explorer and save the only image on-screen filename.png again with the data from the clipboard (To folder png)
the last item is the all the m3u files, to read and copy the last line of text to a single txt file with all entriess using these tags
ie new txt file would be structured
<name></name> this would be the info from the clipboard
<url></url> this would be the first line of text from the m3u file

the xml contains thousands of entries

sorry guys I know its a big ask... but read on the forums and can't seem to figure how I would do this

thank you for any help
Last edited by markc63 on 15 Feb 2020, 08:27, edited 1 time in total.
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Parse data and save data from xml

11 Feb 2020, 16:17

a short example for XML
only read the parts creator(RadioName) and location(URL) show in listview and can start radio
for test creates a short file with 2 radiostations %a_scriptdir%\filexml.txt , then reads <creator> and <location>

add filexml.txt , xmlfile from ahk user markc63
https://easyupload.io/mankzf

xml file shoul'd be updated, some radio's are double or not work

Code: Select all

;MODIFIED= 20200212/2   Internet Radio a test for XML read : creator(RadioName) and location(URL) 
;                       SEARCH added
;                       add filexml.txt https://easyupload.io/mankzf  xmlfile from ahk user markc63
;                       this file should be updated  / some adress are double 
;                       from user markc63 : to create the playlist I installed TuneIn plugin vlc player, 
;                        trial and error to install but once done goto playlist in view menu it should then show TuneIn on the left-hand side of vlc,
;                        select music, select genre (all need to be expanded for all channels, each list as more stations click this,
;                        once that's done right click on music folder and click add to playlist, then under media menu in vlc click save playlist to file    
;CREATED = 20200207

/*
;https://www.internet-radio.com/stations/50s/
;http://www.radio-browser.info/gui/#!/search
;http://www.radio-browser.info/backups/?C=M;O=D
;http://streamripper.sourceforge.net/tutorialconsole.php
;---------------------------------
;https://easyupload.io/mankzf  xmlfile from ahk user markc63 ( filexml.txt )
;https://cms.tunein.com/sitemap/
;https://tunein.com/radio/50s-g390/
;https://tunein.com/radio/Addictive-50s-s166793/
;http://opml.radiotime.com/Tune.ashx?id=s166793
;http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user
*/


#warn
#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
CoordMode, Mouse , Relative  ;- GUI
DetectHiddenWindows, On
;gosub,radiostations
filexml=%a_scriptdir%\filexml.txt
ifnotexist,%filexml%
  gosub,fortest
gosub,readxml

filename1=Internet Radio  ( use ESC for SOUND ON/OFF )
vlcx        =%A_programfiles%\VideoLAN\VLC\vlc.exe
title:=""

HK1=Esc
  Hotkey,%hk1%,mute1,ON


STREAMRIPPER=%A_scriptdir%\streamripper.exe
loop,%streamripper%,1
   STRP=%A_LoopFileShortPath%
R3S=%A_scriptDir%\_STREAM
ifnotexist,%R3S%
  FileCreateDir,%R3S%

Gui,3:default
Gui,3: -DPIScale
Gui,3:color,black,black

wa:=A_screenwidth
ha:=A_screenHeight
xx:=100

;- maybe change fontsize
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
if (wa=3840)
  Gui,3:Font,s12 cYellow,Lucida Console

;============ GUISIZEx DPIx FHD 1920*1080 is 100% ============
if (wa=1920)
 Gui,3:Font,s10 cYellow,Lucida Console
;=============================================================

x:=(wa*.2)/100,y:=(ha*1)/100,h:=(ha*40)/100,w:=(wa*50)/100
Gui,3:Add, ListView,x%x% y%y% w%w% h%h% +hscroll BackgroundTeal altsubmit vB1 gB2,Name|URL
T1:=(wa*40)/100
T2:=(wa*9 )/100
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
GoSub,FLVB1

x:=(wa*.2)/xx,y:=(ha*50)/xx,h:=(ha*2.5)/xx,w:=(wa*7)/xx
Gui,3:add,Button,x%x% y%y% h%h% w%w% gInternetRadio,InternetRadio
x:=(wa*8)/xx
Gui,3:add,Button,x%x% y%y% h%h% w%w% gRadioBrowser ,RadioBrowser
x:=(wa*16)/xx
Gui,3:add,Button,x%x% y%y% h%h% w%w% gCloseVLC     ,Close-Audio



x:=(wa*.1)/xx,y:=(ha*53)/xx,h:=(ha*2.5)/xx,w:=(wa*50)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED1 

y:=(ha*56)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED2

y:=(ha*59)/xx,w:=(wa*14)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED3
x:=(wa*15)/xx,w:=(wa*5)/xx
Gui,3: Add, Progress,x%x% y%y% h%h% w%w% Disabled BackgroundRed
Gui,3: Add, Text, xp yp wp hp BackgroundTrans 0x201 +Border gRecord,Record
x:=(wa*22)/xx,w:=(wa*4)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% right vED4  ; numbers i
x:=(wa*28)/xx,
Gui,3:Add,Text, x%x% y%y% , Search:
x:=(wa*32)/xx,w:=(wa*10)/xx
Gui,3:add,Edit, x%x% y%y% w%w% h%h% vSearchx gSearchA ; search
;---------
x:=(wa*.2)/100,y:=(ha*.2)/100,h:=(ha*64)/100,w:=(wa*51)/100
Gui,3:show,x%x% y%y% w%w% h%h%,%filename1%
Guicontrol,3:,ED4,%i%
GuiControl,3: Focus,searchx
settimer,aatimer,5000
gosub,aatimer
return
;-----------

searcha:
GuiControlGet, Searchx
GuiControl,3: -Redraw, B1
LV_Delete()
i:=0
For Each, Name In LVArray
{
   If (Searchx != "")
   {
      ;If (InStr(name.1, Searchx) = 1)  ; for matching at the start
      If InStr(name.1, Searchx)        ; for overall matching
         {
         LV_Add("",name.1, name.2)
         i++
         }
   }
   Else
   {
      LV_Add("", name.1,name.2)
   i++
   }
}
Guicontrol,3:,ED4,%i%
GuiControl,3: +Redraw, B1
GuiControl,3: Focus,searchx
return


mute1:
soundset,+1,master,mute
return

InternetRadio:
run,https://www.internet-radio.com/stations/50s/
return

RadioBrowser:
run,http://www.radio-browser.info/gui/#!/search
return

record:
Guicontrolget,ed3
stringtrimleft,edx,ed3,7
if edx contains :
{
;run,%COMSPEC% /K %strp% %ed3% -c -t -d "%R3S%"
ifexist,%strp%
 run,%COMSPEC% /K %strp% %ed3% --xs_padding=5000:5000 -c -t -d "%R3S%"
;run,%strp% %ed3% -c -t -d "%R3S%"
}
return
;----------------------------

FLVB1:
Gui, 3:ListView, B1
LV_Delete()
LVArray := {}
I:=0
Loop,parse,e1x,`n,`r
  {
  x:=a_loopfield
  if x=
     continue
  stringmid,xp1,x,1,1
  if (xp1=";")         ;- don't read beginning with ";"
     continue
  c1=
  c2=
  stringsplit,C,x,`;
  c1=%c1%
  c2=%c2%
  LV_Add("",c1,c2)
  LVArray.Push({1:c1,2:c2})
  i++
  }
;LV_ModifyCol(1, "Logical SortAsc")  ;- maybe sort column-1
return
;----------------------------

B2:
Gui,3:ListView, B1
GuiControlGet,B1
  RN:=LV_GetNext("C")
  RF:=LV_GetNext("F")
  GC:=LV_GetCount()

if A_GuiEvent = Normal
  {
  LV_GetText(C1,A_EventInfo,1)
  LV_GetText(C2,A_EventInfo,2)
  ifexist,%vlcx%
     {
     try
       {
       ;Process, Exist, vlc.exe
       ;If ErrorLevel
       ;      process,close,vlc.exe
       run,%vlcx% --one-instance --qt-start-minimized %c2%,,hide,
       }
  catch
     msgbox, 262208,ERROR ,CHECK PATH %vlcx%
     }
  Guicontrol,3:,ED1, %C1%
  Guicontrol,3:,ED2,
  Guicontrol,3:,ED3, %C2%
  settimer,aatimer,ON
  gosub,aatimer
  }
return
;----------------------------


aatimer:
;WinGetTitle, Title1, VLC media player ahk_exe vlc.exe
WinGetTitle, Title1,ahk_exe vlc.exe
title1=%title1%
stringreplace,title,title1,VLC media player,,
Guicontrol,3:,ED2,%title%
return
;----------------------------


closevlc:
Process, Exist, vlc.exe
If ErrorLevel
{
 process,close,vlc.exe
 Guicontrol,3:,ED1,
 Guicontrol,3:,ED2,
 settimer,aatimer,off
}
return
;----------------------------


3Guiclose:
settimer,aatimer,OFF
Process, Exist, vlc.exe
If ErrorLevel
   {
   msgbox, 262435,Radio-Close,Want you close also Audio ?
   ifmsgbox,NO
      exitapp
   ifmsgbox,Cancel
      return
   else
     {
     process,close,vlc.exe
     exitapp
     }
   }
else
  exitapp
return
;----------------------------
fortest:
e3x=
(Ltrim Join`r`n
		<track>
            <location>http://opml.radiotime.com/Tune.ashx?id=s166793&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</location>
			<title>Royal Teens - Believe Me</title>
            <creator>Addictive 50s (Canada)</creator>
			<info>http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</info>
			<image>file:///C:/Users/mark/AppData/Roaming/vlc/art/arturl/908ea30cc61053ee87e5a9bd24796493/art</image>
			<extension application="http://www.videolan.org/vlc/playlist/0">
				<vlc:id>0</vlc:id>
			</extension>
		</track>
		<track>
            <location>http://opml.radiotime.com/Tune.ashx?id=s65671&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</location>
			<title>Brian Hyland - Sealed With A Kiss</title>
            <creator>GotRadio</creator>
			<info>http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</info>
			<image>file:///C:/Users/mark/AppData/Roaming/vlc/art/arturl/908ea30cc61053ee87e5a9bd24796493/art</image>
			<extension application="http://opmlwww.videolan.org/vlc/playlist/0">
				<vlc:id>0</vlc:id>
			</extension>
		</track>
)
filexml=%a_scriptdir%\filexml.txt
ifnotexist,%filexml%
fileappend,%e3x%,%filexml%
return
;----------------------
READXML:
fileread,e4x,%filexml%
dl:=";"
aa=<location>
bb=<creator>
e1x:=""
e2:=""
s:=""
;-- add these first to the list
e1x=
(
ch_News DRS4;http://stream.srg-ssr.ch/drs4news/mp3_128.m3u
de_NEWS DLF;https://www.deutschlandradio.de/streaming/dlf.m3u
)
loop,parse,e4x,`n,`r
{
lr:= a_loopfield
if lr=
   continue
if lr contains <track>
  s=1
if lr contains </track>
  s=0
if (s=1)
 {
if lr contains %bb%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   stringreplace,lr,lr,`;,,all
   stringreplace,lr,lr,&#39,,all
   stringreplace,lr,lr,&amp,,all
   e1x .= lr . dl . e2
   e2=
   }
if lr contains %aa%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   StringSplit, c,lr,&
   e2 .= c1 . "`r`n"
   }
 }
}
;msgbox,%e1x%
return
;-----------------------------------------------

/*
radiostations:
e1x=
(Ltrim join`r`n
us_50 1-Canada;http://opml.radiotime.com/Tune.ashx?id=s166793
us_50 ABC 50s;http://144.217.253.136:8582
us_50 DreamBoat;http://146.71.124.10:8100
us_50 UK 1950s;http://91.121.134.23:8648
us_50 HD Radio;http://167.114.64.181:8360
us_Country HPR-1;http://188.165.192.5:8374
pt_Portugal Fado Radio Caprice-Fado;http://79.111.14.76:9189
pt_Portugal sounds of;http://91.121.78.191:8541
jp_Oldies Japan;http://66.70.187.44:9069
lt_World PMR LT;http://185.193.112.155:18638
sv_Folk Sverige Svensk Folkmusic;http://82.94.205.73:8107
ch_News DRS4;http://stream.srg-ssr.ch/drs4news/mp3_128.m3u
de_NEWS DLF;https://www.deutschlandradio.de/streaming/dlf.m3u
)
return
*/

;==============================================
Last edited by garry on 12 Feb 2020, 09:24, edited 2 times in total.
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Parse data and save data from xml

11 Feb 2020, 16:27

thanks garry, it works to an extent , but gives a couple of errors, heres a filexml for you to test https://easyupload.io/mankzf
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Parse data and save data from xml

12 Feb 2020, 07:46

thank you for the xml-file , in script removed commas in stationname , now works , found 6749 radio stations

Code: Select all

;MODIFIED= 20200212/2   Internet Radio a test for XML read : creator(RadioName) and location(URL) 
;                       SEARCH added
;                       add filexml.txt https://easyupload.io/mankzf  xmlfile from ahk user markc63
;                       this file should be updated  / some adress are double 
;                       from user markc63 : to create the playlist I installed TuneIn plugin vlc player, 
;                        trial and error to install but once done goto playlist in view menu it should then show TuneIn on the left-hand side of vlc,
;                        select music, select genre (all need to be expanded for all channels, each list as more stations click this,
;                        once that's done right click on music folder and click add to playlist, then under media menu in vlc click save playlist to file    
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Parse data and save data from xml

12 Feb 2020, 10:16

Thank you garry, that xml file isn't a complete list, I was thinking if I saved each genre as a filexml.txt would it be easy to adapt the script so a search can be made within the script rather than using the internet ie if you search in the running ahk for the 80s it would search within a subfolder for .\80s\filexml.txt

do you think images can be added, if they can be scraped via the URL great, if not maybe another small script that will read the XML , and save them and ill upload the lot of them

i still think using your script with a couple of additions it could probably be turned into a great gui version which include play controls , radio station logo, now playing info, now playing artist image, now playing artist/group info. of course im not to knowledgable what can be achieved regarding images and info, but im wondering if the enow playing info can detect when info changes the searches the internet to display this info

i have made a mock-up image to show what I mean

regarding your last comment, I cant see where you removed the comma
5e84087845ae99b3c07bf9d569589977.png
5e84087845ae99b3c07bf9d569589977.png (1.21 MiB) Viewed 1699 times
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Parse data and save data from xml

12 Feb 2020, 14:20

hello markc63
I have not good knowledge to make what you want, maybe I just can more parse the xml file to get wanted text/lines
in script above I removed comma and other unwanted words with stringreplace , like :

Code: Select all

   lr:=RegExReplace( lr, "<.*?>" )   ;- lr is the line and here remove brackets  <xx>
   stringreplace,lr,lr,`;,,all             ;- remove comma
   stringreplace,lr,lr,&#39,,all
   stringreplace,lr,lr,&amp,,all

Code: Select all

READXML:
fileread,e4x,%filexml%
dl:=";"
aa=<location>   ;- get this line
bb=<creator>     ;- get this line
e1x:=""
e2:=""
s:=""
;-- add these first to the list
e1x=
(
ch_News DRS4;http://stream.srg-ssr.ch/drs4news/mp3_128.m3u
de_NEWS DLF;https://www.deutschlandradio.de/streaming/dlf.m3u
)
loop,parse,e4x,`n,`r
{
lr:= a_loopfield
if lr=
   continue
if lr contains <track>
  s=1
if lr contains </track>
  s=0
if (s=1)
 {
if lr contains %bb%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   stringreplace,lr,lr,`;,,all
   stringreplace,lr,lr,&#39,,all
   stringreplace,lr,lr,&amp,,all
   e1x .= lr . dl . e2
   e2=
   }
if lr contains %aa%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   StringSplit, c,lr,&
   e2 .= c1 . "`r`n"
   }
 }
}
;msgbox,%e1x%    ;- all wanted lines ( name;url) , then show these in listview 
return
;-----------------------------------------------
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Parse data and save data from xml

12 Feb 2020, 14:36

Thank you garry, it works now, maybe someone else may be able to help, your script already gives all the info like artist and song plus the radio station, so i suppose it would be a matter of a small script so i can extract the images from my temp folder from the art files and then is suppose i need to find something that monitors the now playing info to displays the other images and info

do you think it would be possible to use several filexml.txt files with in genre folders
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Parse data and save data from xml

12 Feb 2020, 15:21

you can select different files with button / Menu / DropDownList( DDL) .... etc
define then filexml=%selectedfile% ( fullpath )
( my example only filtered radio-station and url )

most time I listen news , my favorites music and videos I found in youtube and downloaded with youtube-dl.exe as mp3 or mp4 , example as mp4 ( sp1 shortpath =youtube-dl.exe, fdmp4 is the folder )
https://youtube-dl.org/latest/youtube-dl.exe
RunWait, %comspec% /k %sp1% %url% --verbose --youtube-skip-dash-manifest --write-auto-sub --sub-lang de -o "%fdmp4%\`%(title)s$`%(uploader)s$`%(id)s.`%(ext)s"
Last edited by garry on 12 Feb 2020, 15:35, edited 2 times in total.
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Parse data and save data from xml

12 Feb 2020, 15:26

so it should work then by search if folders like this

50s (folder)
filexml.txt
60s (folder)
filexml.txt
70s (folder)
filexml.txt
rnb (folder)
filexml.txt
country (folder)
filexml.txt
...ect with the folder setting the genre, and each filexml.txt searchable for radio station name if wanted

im jsut carefully reading you code and googling parts

**edit** could your script be adapted to make simple x y w h, i keep reading on how to use the way you have it but cant get my head around it also could you remove the url listing so it just shows radio station

im thinking some kinda code like this would work for the bottom left part of the screen, in the mock up i made

Code: Select all

Gui Add, ActiveX, w840 h580 x-140 y-80 vWB,s.Explorer ;Whatever we give here instead 
Gui, +LastFound +0x300000 ; WS_VHSCROLL=0x200000
WB.Silent := True
WB.Navigate("https://en.wikipedia.org/wiki/%Title%") 
Gui, Show,,Browsers in AHK GUI
Return
GuiClose:
Exitapp
Return
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Parse data and save data from xml

14 Feb 2020, 13:04

ok i've had to change some of your script as i dont understand how to do the way did the x y w h, but this is for testing purposes and hope it could be put back at a later date, but for now im wondering if there is a way that

Code: Select all

WB.Navigate("https://en.wikipedia.org/wiki/") 
can add the artist name using the %title% this would need to keep checking rougly every 5 seconds to see if %title% changes, the 5-second delay is due to vlc showing next track befoer it is played

the gui itself would have an overlay to that split the elements and hides the edges
i also cant figure why when i use gui,add text with the center for the x it makes the text disspear


code i am working with

Code: Select all


#warn
#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
CoordMode, Mouse , Relative  ;- GUI
DetectHiddenWindows, On
;gosub,radiostations
filexml=%a_scriptdir%\filexml.txt
ifnotexist,%filexml%
  gosub,fortest
gosub,readxml

filename1=Internet Radio  ( use ESC for SOUND ON/OFF )
vlcx        =%A_programfiles%\VideoLAN\VLC\vlc.exe
title:=""

HK1=Esc
  Hotkey,%hk1%,mute1,ON


Gui,3:default
Gui,3: -DPIScale
Gui,3:color,black,black




Gui,3:Add, ListView,x880 y318 w350 h535 -vscroll E0x200 +hscroll BackgroundTeal altsubmit vB1 gB2,Name|URL
LV_ModifyCol(1, 350)
LV_ModifyCol(2, 1)
GoSub,FLVB1

Gui Add, ActiveX, w1040 h600 x-160 y250 -Border vWB,s.Explorer ;Whatever we give here instead
GUI, 1:+AlwaysOnTop -Border -SysMenu +Owner -Caption +ToolWindow 
WB.Silent := True
WB.Navigate("https://en.wikipedia.org/wiki/") 
Gui, Show,,Browsers in AHK GUI

Gui, Font, cFF0000 s15
Gui,3:add,text,x72 y100 h50 w400 vED1 ;RADIO STATION

Gui, Font, cFF0000 s20
Gui,3:add,text,x720 y0 h50 w1040 vED2 ;ARTIST - SONG


;---------
x:=30,y:=30,h:=800,w:=1200
Gui,3:show,x%x% y%y% w1200 h800,%filename1%
Guicontrol,3:,ED4,%i%
GuiControl,3: Focus,searchx
settimer,aatimer,5000
gosub,aatimer
return
;-----------



mute1:
soundset,+1,master,mute
return


record:
Guicontrolget,ed3
stringtrimleft,edx,ed3,7
if edx contains :
{
;run,%COMSPEC% /K %strp% %ed3% -c -t -d "%R3S%"
ifexist,%strp%
 run,%COMSPEC% /K %strp% %ed3% --xs_padding=5000:5000 -c -t -d "%R3S%"
;run,%strp% %ed3% -c -t -d "%R3S%"
}
return
;----------------------------

FLVB1:
Gui, 3:ListView, B1
LV_Delete()
LVArray := {}
I:=0
Loop,parse,e1x,`n,`r
  {
  x:=a_loopfield
  if x=
     continue
  stringmid,xp1,x,1,1
  if (xp1=";")         ;- don't read beginning with ";"
     continue
  c1=
  c2=
  stringsplit,C,x,`;
  c1=%c1%
  c2=%c2%
  LV_Add("",c1,c2)
  LVArray.Push({1:c1,2:c2})
  i++
  }
;LV_ModifyCol(1, "Logical SortAsc")  ;- maybe sort column-1
return
;----------------------------

B2:
Gui,3:ListView, B1
GuiControlGet,B1
  RN:=LV_GetNext("C")
  RF:=LV_GetNext("F")
  GC:=LV_GetCount()

if A_GuiEvent = Normal
  {
  LV_GetText(C1,A_EventInfo,1)
  LV_GetText(C2,A_EventInfo,2)
  ifexist,%vlcx%
     {
     try
       {
       ;Process, Exist, vlc.exe
       ;If ErrorLevel
       ;      process,close,vlc.exe
       run,%vlcx% --one-instance --qt-start-minimized %c2%,,hide,
       }
  catch
     msgbox, 262208,ERROR ,CHECK PATH %vlcx%
     }
  Guicontrol,3:,ED1, %C1%
  Guicontrol,3:,ED2,
  Guicontrol,3:,ED3, %C2%
  settimer,aatimer,ON
  gosub,aatimer
  }
return
;----------------------------


aatimer:
;WinGetTitle, Title1, VLC media player ahk_exe vlc.exe
WinGetTitle, Title1,ahk_exe vlc.exe
title1=%title1%
stringreplace,title,title1,- VLC media player,,
Guicontrol,3:,ED2,%title%
return
;----------------------------


closevlc:
Process, Exist, vlc.exe
If ErrorLevel
{
 process,close,vlc.exe
 Guicontrol,3:,ED1,
 Guicontrol,3:,ED2,
 settimer,aatimer,off
}
return
;----------------------------


3Guiclose:
settimer,aatimer,OFF
Process, Exist, vlc.exe
If ErrorLevel
   {
   msgbox, 262435,Radio-Close,Want you close also Audio ?
   ifmsgbox,NO
      exitapp
   ifmsgbox,Cancel
      return
   else
     {
     process,close,vlc.exe
     exitapp
     }
   }
else
  exitapp
return
;----------------------------
fortest:
e3x=
(Ltrim Join`r`n
		<track>
            <location>http://opml.radiotime.com/Tune.ashx?id=s166793&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</location>
			<title>Royal Teens - Believe Me</title>
            <creator>Addictive 50s (Canada)</creator>
			<info>http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</info>
			<image>file:///C:/Users/mark/AppData/Roaming/vlc/art/arturl/908ea30cc61053ee87e5a9bd24796493/art</image>
			<extension application="http://www.videolan.org/vlc/playlist/0">
				<vlc:id>0</vlc:id>
			</extension>
		</track>
		<track>
            <location>http://opml.radiotime.com/Tune.ashx?id=s65671&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</location>
			<title>Brian Hyland - Sealed With A Kiss</title>
            <creator>GotRadio</creator>
			<info>http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</info>
			<image>file:///C:/Users/mark/AppData/Roaming/vlc/art/arturl/908ea30cc61053ee87e5a9bd24796493/art</image>
			<extension application="http://opmlwww.videolan.org/vlc/playlist/0">
				<vlc:id>0</vlc:id>
			</extension>
		</track>
)
filexml=%a_scriptdir%\filexml.txt
ifnotexist,%filexml%
fileappend,%e3x%,%filexml%
return
;----------------------
READXML:
fileread,e4x,%filexml%
dl:=";"
aa=<location>   ;- get this line
bb=<creator>     ;- get this line
e1x:=""
e2:=""
s:=""
;-- add these first to the list
e1x=
(
ch_News DRS4;http://stream.srg-ssr.ch/drs4news/mp3_128.m3u
de_NEWS DLF;https://www.deutschlandradio.de/streaming/dlf.m3u
)
loop,parse,e4x,`n,`r
{
lr:= a_loopfield
if lr=
   continue
if lr contains <track>
  s=1
if lr contains </track>
  s=0
if (s=1)
 {
if lr contains %bb%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   stringreplace,lr,lr,`;,,all
   stringreplace,lr,lr,&#39,,all
   stringreplace,lr,lr,&amp,,all
   e1x .= lr . dl . e2
   e2=
   }
if lr contains %aa%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   StringSplit, c,lr,&
   e2 .= c1 . "`r`n"
   }
 }
}
;msgbox,%e1x%    ;- all wanted lines ( name;url) , then show these in listview 
return
;-----------------------------------------------
;-----------------------------------------------
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Radio Gui, parse display

15 Feb 2020, 08:30

for some reason i think im on the right track with the web browser bit, but i cant seem to add loop or get it to display what i believe should be myclip= %vED2% or %title%
if i just use an artist name it displays the page correctly

Code: Select all

Gui Add, ActiveX, w1040 h600 x-160 y250 -Border vWB,s.Explorer ;Whatever we give here instead
GUI, 1: -Border -SysMenu +Owner -Caption +ToolWindow 
xURL =https://en.wikipedia.org/wiki/
myClip =Elvis Presley
navURL := xURL . myClip
WB.Silent := True
WB.Navigate(navURL)
Gui, Show,,Browsers in AHK GUI
Untitled-1.png
Untitled-1.png (160.66 KiB) Viewed 1500 times
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Radio Gui, parse display

15 Feb 2020, 13:22

tried this , change url when title changed in VLC and show wiki in ActiveX
didn't checked what happens when page not found , how avoid errors
Maybe no error : wiki start with message : " Wikipedia does not here an article with this exact name "

Code: Select all

;MODIFIED= 20200215   ActiveX added and show wiki from artist when VLC title changed
;                       Internet Radio a test for XML read : creator(RadioName) and location(URL) 
;                       SEARCH added
;                       add filexml.txt https://easyupload.io/mankzf  xmlfile from ahk user markc63
;                       this file should be updated  / some adress are double 
;                       from user markc63 : to create the playlist I installed TuneIn plugin vlc player, 
;                        trial and error to install but once done goto playlist in view menu it should then show TuneIn on the left-hand side of vlc,
;                        select music, select genre (all need to be expanded for all channels, each list as more stations click this,
;                        once that's done right click on music folder and click add to playlist, then under media menu in vlc click save playlist to file    
;CREATED = 20200207

/*
;https://www.internet-radio.com/stations/50s/
;http://www.radio-browser.info/gui/#!/search
;http://www.radio-browser.info/backups/?C=M;O=D
;http://streamripper.sourceforge.net/tutorialconsole.php
;---------------------------------
;https://easyupload.io/mankzf  xmlfile from ahk user markc63 ( filexml.txt )
;https://cms.tunein.com/sitemap/
;https://tunein.com/radio/50s-g390/
;https://tunein.com/radio/Addictive-50s-s166793/
;http://opml.radiotime.com/Tune.ashx?id=s166793
;http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user
*/


#warn
#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
CoordMode, Mouse , Relative  ;- GUI
DetectHiddenWindows, On
;gosub,radiostations
filexml=%a_scriptdir%\filexml_test.txt
ifnotexist,%filexml%
  gosub,fortest
gosub,readxml

filename1=Internet Radio  ( use ESC for SOUND ON/OFF )
vlcx        =%A_programfiles%\VideoLAN\VLC\vlc.exe
title:=""
lasttitle:=""

HK1=Esc
  Hotkey,%hk1%,mute1,ON


STREAMRIPPER=%A_scriptdir%\streamripper.exe
loop,%streamripper%,1
   STRP=%A_LoopFileShortPath%
R3S=%A_scriptDir%\_STREAM
ifnotexist,%R3S%
  FileCreateDir,%R3S%

Gui,3:default
Gui,3: -DPIScale
Gui,3:color,black,black

wa:=A_screenwidth
ha:=A_screenHeight
xx:=100

;- maybe change fontsize
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
if (wa=3840)
  Gui,3:Font,s12 cYellow,Lucida Console

;============ GUISIZEx DPIx FHD 1920*1080 is 100% ============
if (wa=1920)
 Gui,3:Font,s10 cYellow,Lucida Console
;=============================================================


;xxa=Shell.Explorer    ;- IExplorer
xxa=Mozilla.Browser    ;- Mozilla Firefox

x:=(wa*.2)/100,y:=(ha*.2)/100,h:=(ha*48)/100,w:=(wa*53)/100
Gui,3: Add, ActiveX, w%w% h%h% x%x% y%y% -Border vWB,%xxa%
WB.Silent := True

;xURL =https://en.wikipedia.org/wiki/
;myClip =Elvis Presley
;navURL := xURL . myClip
;WB.Navigate(navURL)


x:=(wa*54)/100,y:=(ha*1)/100,h:=(ha*48)/100,w:=(wa*15)/100
Gui,3:Add, ListView,x%x% y%y% w%w% h%h% +hscroll BackgroundTeal altsubmit vB1 gB2,Name|URL
T1:=(wa*14)/100
T2:=(wa*0 )/100
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
GoSub,FLVB1

x:=(wa*.2)/xx,y:=(ha*50)/xx,h:=(ha*2.5)/xx,w:=(wa*7)/xx
Gui,3:add,Button,x%x% y%y% h%h% w%w% gInternetRadio,InternetRadio
x:=(wa*8)/xx
Gui,3:add,Button,x%x% y%y% h%h% w%w% gRadioBrowser ,RadioBrowser
x:=(wa*16)/xx
Gui,3:add,Button,x%x% y%y% h%h% w%w% gCloseVLC     ,Close-Audio



x:=(wa*.1)/xx,y:=(ha*53)/xx,h:=(ha*2.5)/xx,w:=(wa*50)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED1 

y:=(ha*56)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED2

y:=(ha*59)/xx,w:=(wa*14)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED3
x:=(wa*15)/xx,w:=(wa*5)/xx
Gui,3: Add, Progress,x%x% y%y% h%h% w%w% Disabled BackgroundRed
Gui,3: Add, Text, xp yp wp hp BackgroundTrans 0x201 +Border gRecord,Record
x:=(wa*22)/xx,w:=(wa*4)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% right vED4  ; numbers i
x:=(wa*28)/xx,
Gui,3:Add,Text, x%x% y%y% , Search:
x:=(wa*32)/xx,w:=(wa*10)/xx
Gui,3:add,Edit, x%x% y%y% w%w% h%h% vSearchx gSearchA ; search
;---------
x:=(wa*.2)/100,y:=(ha*.2)/100,h:=(ha*64)/100,w:=(wa*71)/100
Gui,3:show,x%x% y%y% w%w% h%h%,%filename1%
Guicontrol,3:,ED4,%i%
GuiControl,3: Focus,searchx
settimer,aatimer,5000
gosub,aatimer
return
;-----------

searcha:
Gui,3:ListView, B1
GuiControlGet, Searchx
GuiControl,3: -Redraw, B1
LV_Delete()
i:=0
For Each, Name In LVArray
{
   If (Searchx != "")
   {
      ;If (InStr(name.1, Searchx) = 1)  ; for matching at the start
      If InStr(name.1, Searchx)        ; for overall matching
         {
         LV_Add("",name.1, name.2)
         i++
         }
   }
   Else
   {
      LV_Add("", name.1,name.2)
   i++
   }
}
GuiControl,3: +Redraw, B1
Guicontrol,3:,ED4,%i%
GuiControl,3: Focus,searchx
return
;-----------------------------


mute1:
soundset,+1,master,mute
return

InternetRadio:
run,https://www.internet-radio.com/stations/50s/
return

RadioBrowser:
run,http://www.radio-browser.info/gui/#!/search
return

record:
Guicontrolget,ed3
stringtrimleft,edx,ed3,7
if edx contains :
{
;run,%COMSPEC% /K %strp% %ed3% -c -t -d "%R3S%"
ifexist,%strp%
 run,%COMSPEC% /K %strp% %ed3% --xs_padding=5000:5000 -c -t -d "%R3S%"
;run,%strp% %ed3% -c -t -d "%R3S%"
}
return
;----------------------------

FLVB1:
Gui, 3:ListView, B1
LV_Delete()
LVArray := {}
I:=0
Loop,parse,e1x,`n,`r
  {
  x:=a_loopfield
  if x=
     continue
  stringmid,xp1,x,1,1
  if (xp1=";")         ;- don't read beginning with ";"
     continue
  c1=
  c2=
  stringsplit,C,x,`;
  c1=%c1%
  c2=%c2%
  LV_Add("",c1,c2)
  LVArray.Push({1:c1,2:c2})
  i++
  }
;LV_ModifyCol(1, "Logical SortAsc")  ;- maybe sort column-1
return
;----------------------------

B2:
Gui,3:ListView, B1
GuiControlGet,B1
  RN:=LV_GetNext("C")
  RF:=LV_GetNext("F")
  GC:=LV_GetCount()

if A_GuiEvent = Normal
  {
  LV_GetText(C1,A_EventInfo,1)
  LV_GetText(C2,A_EventInfo,2)
  ifexist,%vlcx%
     {
     try
       {
       ;Process, Exist, vlc.exe
       ;If ErrorLevel
       ;      process,close,vlc.exe
       run,%vlcx% --one-instance --qt-start-minimized %c2%,,hide,
       }
  catch
     msgbox, 262208,ERROR ,CHECK PATH %vlcx%
     }
  Guicontrol,3:,ED1, %C1%
  Guicontrol,3:,ED2,
  Guicontrol,3:,ED3, %C2%
  settimer,aatimer,ON
  gosub,aatimer
  }
return
;----------------------------


;----------------------------
aatimer:
;WinGetTitle, Title1, VLC media player ahk_exe vlc.exe
WinGetTitle, Title1,ahk_exe vlc.exe
title1=%title1%
stringreplace,title,title1,VLC media player,,
Guicontrol,3:,ED2,%title%
if (title1 != lasttitle)
  {
  ;msgbox, 262208, , webpage changed!,1
  ;title1=Eartha kitt - Under the Bridges of Paris -  ;- this is in ED2 
  stringsplit,b,title1,-
  b1=%b1%
  StringUpper,b1,b1,T
  stringreplace,b1,b1,%a_space%,_,all
  url:="https://en.wikipedia.org/wiki/" . b1
  WB.Navigate(url)
  }
else
  {
  ;msgbox, 262208, , no change!,1
  }
lasttitle := title1
return
;----------------------------


closevlc:
Process, Exist, vlc.exe
If ErrorLevel
{
 process,close,vlc.exe
 Guicontrol,3:,ED1,
 Guicontrol,3:,ED2,
 settimer,aatimer,off
}
return
;----------------------------


3Guiclose:
settimer,aatimer,OFF
Process, Exist, vlc.exe
If ErrorLevel
   {
   msgbox, 262435,Radio-Close,Want you close also Audio ?
   ifmsgbox,NO
      exitapp
   ifmsgbox,Cancel
      return
   else
     {
     process,close,vlc.exe
     exitapp
     }
   }
else
  exitapp
return
;----------------------------
fortest:
e3x=
(Ltrim Join`r`n
		<track>
            <location>http://opml.radiotime.com/Tune.ashx?id=s166793&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</location>
			<title>Royal Teens - Believe Me</title>
            <creator>Addictive 50s (Canada)</creator>
			<info>http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</info>
			<image>file:///C:/Users/mark/AppData/Roaming/vlc/art/arturl/908ea30cc61053ee87e5a9bd24796493/art</image>
			<extension application="http://www.videolan.org/vlc/playlist/0">
				<vlc:id>0</vlc:id>
			</extension>
		</track>
		<track>
            <location>http://opml.radiotime.com/Tune.ashx?id=s65671&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</location>
			<title>Brian Hyland - Sealed With A Kiss</title>
            <creator>GotRadio</creator>
			<info>http://opml.radiotime.com/Browse.ashx?id=g390&amp;formats=aac,html,mp3,wma,wmpro,wmvideo,wmvoice&amp;partnerId=k2YHnXyS&amp;username=user</info>
			<image>file:///C:/Users/mark/AppData/Roaming/vlc/art/arturl/908ea30cc61053ee87e5a9bd24796493/art</image>
			<extension application="http://opmlwww.videolan.org/vlc/playlist/0">
				<vlc:id>0</vlc:id>
			</extension>
		</track>

)
filexml=%a_scriptdir%\filexml_test.txt
ifnotexist,%filexml%
fileappend,%e3x%,%filexml%
return
;----------------------
READXML:
fileread,e4x,%filexml%
dl:=";"
aa=<location>
bb=<creator>
e1x:=""
e2:=""
s:=""
;-- add these first to the list
/*
e1x=
(
ch_News DRS4;http://stream.srg-ssr.ch/drs4news/mp3_128.m3u
de_NEWS DLF;https://www.deutschlandradio.de/streaming/dlf.m3u
)
*/

loop,parse,e4x,`n,`r
{
lr:= a_loopfield
if lr=
   continue
if lr contains <track>
  s=1
if lr contains </track>
  s=0
if (s=1)
 {
if lr contains %bb%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   stringreplace,lr,lr,`;,,all
   stringreplace,lr,lr,&#39,,all
   stringreplace,lr,lr,&amp,,all
   e1x .= lr . dl . e2
   e2=
   }
if lr contains %aa%
   {
   lr:=RegExReplace( lr, "<.*?>" )
   StringSplit, c,lr,&
   e2 .= c1 . "`r`n"
   }
 }
}
;msgbox,%e1x%
return
;-----------------------------------------------

/*
radiostations:
e1x=
(Ltrim join`r`n
us_50 1-Canada;http://opml.radiotime.com/Tune.ashx?id=s166793
us_50 ABC 50s;http://144.217.253.136:8582
us_50 DreamBoat;http://146.71.124.10:8100
us_50 UK 1950s;http://91.121.134.23:8648
us_50 HD Radio;http://167.114.64.181:8360
us_Country HPR-1;http://188.165.192.5:8374
pt_Portugal Fado Radio Caprice-Fado;http://79.111.14.76:9189
pt_Portugal sounds of;http://91.121.78.191:8541
jp_Oldies Japan;http://66.70.187.44:9069
lt_World PMR LT;http://185.193.112.155:18638
sv_Folk Sverige Svensk Folkmusic;http://82.94.205.73:8107
ch_News DRS4;http://stream.srg-ssr.ch/drs4news/mp3_128.m3u
de_NEWS DLF;https://www.deutschlandradio.de/streaming/dlf.m3u
)
return
*/

;==============================================

Image
Last edited by garry on 15 Feb 2020, 13:33, edited 2 times in total.
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Radio Gui, parse display

15 Feb 2020, 13:29

ho wow how cool is that, im gonna inspect your code as i have been trying all day.
would this same principle be able to be used for station logo (Im still trying to find a way to rename the art files) so i can stor in one folder
and for 1 image from google images to diplay in the gui

mega chuffed you figured that out for me thank you very much :bravo:

**edit**

if you replace the wiki url with https://www.google.com/search?tbm=isch&q= it then shows images from google just a pity the white space cant be removed
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Radio Gui, parse display

15 Feb 2020, 17:20

there is something , add picture to listview
extract from url = http://opml.radiotime.com/Browse.ashx?id=g390
problem to read picture like logoq.jpg?t=157608

Code: Select all

;- http://opml.radiotime.com/Browse.ashx?id=g390
Addictive 50s (Canada) ; http://opml.radiotime.com/Tune.ashx?id=s166793 ; http://cdn-radiotime-logos.tunein.com/s166793q.png
GotRadio The 50s (US) ; http://opml.radiotime.com/Tune.ashx?id=s65671 ; http://cdn-radiotime-logos.tunein.com/s49666q.png
ABC 50s (Fifties) (Canada) ; http://opml.radiotime.com/Tune.ashx?id=s165879 ; http://cdn-radiotime-logos.tunein.com/s165879q.png
24-7 Dreamboats And Petticoats (UK) ; http://opml.radiotime.com/Tune.ashx?id=s193402 ; http://cdn-radiotime-logos.tunein.com/s193402q.png
1.FM - Back To The 50s  60s Radio (Switzerland) ; http://opml.radiotime.com/Tune.ashx?id=s47713 ; http://cdn-radiotime-logos.tunein.com/s47713q.png
1A Oldies (Germany) ; http://opml.radiotime.com/Tune.ashx?id=s307969 ; http://cdn-profiles.tunein.com/s307969/images/logoq.png?t=155672
The Doo-Wop Express (US) ; http://opml.radiotime.com/Tune.ashx?id=s111171 ; http://cdn-radiotime-logos.tunein.com/s111171q.png
Dagnys Jukebox (Sweden) ; http://opml.radiotime.com/Tune.ashx?id=s78271 ; http://cdn-radiotime-logos.tunein.com/s78271q.png
RPR1.Oldies (Germany) ; http://opml.radiotime.com/Tune.ashx?id=s281879 ; http://cdn-profiles.tunein.com/s281879/images/logoq.jpg?t=157608
La Tremenda Corte Radio (Trespatines) (Dominican Republic) ; http://opml.radiotime.com/Tune.ashx?id=s268168 ; http://cdn-radiotime-logos.tunein.com/s268168q.png
Puregold Oldies (US) ; http://opml.radiotime.com/Tune.ashx?id=s304517 ; http://cdn-profiles.tunein.com/s304517/images/logoq.jpg?t=155912
TopShelf Oldies (US) ; http://opml.radiotime.com/Tune.ashx?id=s127539 ; http://cdn-radiotime-logos.tunein.com/s127539q.png
The UK 1950s Radio Station (UK) ; http://opml.radiotime.com/Tune.ashx?id=s237607 ; http://cdn-profiles.tunein.com/s237607/images/logoq.png?t=154989
Country Gold FM (US) ; http://opml.radiotime.com/Tune.ashx?id=s234271 ; http://cdn-radiotime-logos.tunein.com/s234271q.png
Yes2day Radio (Copenhagen, Denmark) ; http://opml.radiotime.com/Tune.ashx?id=s9307 ; http://cdn-profiles.tunein.com/s9307/images/logoq.png?t=153969
Music Box Memories (Canada) ; http://opml.radiotime.com/Tune.ashx?id=s262902 ; http://cdn-radiotime-logos.tunein.com/s262902q.png
RCS Network Story (Campania, Italy) ; http://opml.radiotime.com/Tune.ashx?id=s276071 ; http://cdn-profiles.tunein.com/s276071/images/logoq.png
Cleansing 50s (US) ; http://opml.radiotime.com/Tune.ashx?id=s234015 ; http://cdn-profiles.tunein.com/s234015/images/logoq.png?t=156275
Sounds of Philly Radio (US) ; http://opml.radiotime.com/Tune.ashx?id=s121217 ; http://cdn-radiotime-logos.tunein.com/s121217q.png
Fun45s.com (US) ; http://opml.radiotime.com/Tune.ashx?id=s177735 ; http://cdn-radiotime-logos.tunein.com/s177735q.png
Trespatines Radio (Dominican Republic) ; http://opml.radiotime.com/Tune.ashx?id=s281938 ; http://cdn-profiles.tunein.com/s281938/images/logoq.png?t=151619
Mega1050 50s (UK) ; http://opml.radiotime.com/Tune.ashx?id=s306269 ; http://cdn-profiles.tunein.com/s306269/images/logoq.jpg
WRGG-LP (New Market, US) ; http://opml.radiotime.com/Tune.ashx?id=s272676 ; http://cdn-profiles.tunein.com/s272676/images/logoq.jpg
KTL Radio (Germany) ; http://opml.radiotime.com/Tune.ashx?id=s165824 ; http://cdn-radiotime-logos.tunein.com/s165824q.png
Radio RMF 50s (Poland) ; http://opml.radiotime.com/Tune.ashx?id=s119895 ; http://cdn-radiotime-logos.tunein.com/s119895q.png
Image
Last edited by garry on 16 Feb 2020, 05:43, edited 1 time in total.
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Radio Gui, parse display

15 Feb 2020, 17:29

cool the way i was going to do it was to save the files from them vlc temp directory, as soon as i save the playlists in vlc it stores the images on my harddrive
they all have there own folder and every file is called art, if you add.png to the end they become viewable images, i figured a way to rename them but it would take ages, obviously every art file would need changing to station name from the xml

not sure why logoq.jpg?t=157608 i can see it if i view it in my temp folder
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Radio Gui, parse display

15 Feb 2020, 18:35

now I had succes , xml file change , will replace the script in next 24 hours
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Radio Gui, parse display

16 Feb 2020, 05:26

cool i never even noticed before that the logo nu,ber is the same as the station number, due to the work you have done up to now, i keep evolving the radio idea in my head lol
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Radio Gui, parse display

16 Feb 2020, 05:49

now it works all pictures from radiostation ( see picture above ) , upload script later ... have to modify
not every station shows artist name , xml file changes , see automatically last actual xml-file ( here oldies ) , will add a menu to start different url's ...
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Radio Gui, parse display

16 Feb 2020, 05:56

Thank you so much, yea i noticed some stations don't show artists and songs, i will probably audit each genre removing some of the stations and cleaning up the doubles ect,

I'm just messing with some youtube code to see if i can integrate, although at the moment I can't seem to figure why some videos won't allow embed

i had an idea for a 3rd type GUI where vlc is silent but sends the songs as it plays them to an ini file which is read by the youtube part of the script playing the actual song video, the reason for the ini being that the youtube videos are probably longer or shorter...so the outcome of this type script would be a nonstop video player, playing the songs listed in the ini, in the sequence the radio plays them.
the ini would be destroyed on GUI close
garry
Posts: 2459
Joined: 22 Dec 2013, 12:50

Re: Radio Gui, parse display

16 Feb 2020, 15:21

hello markc63 , just radio-3 script according picture above

Code: Select all

#warn
#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
CoordMode, Mouse , Relative  ;- GUI
DetectHiddenWindows, On

filename1=Internet Radio-3  ( use ESC for SOUND ON/OFF )
vlcx        =%A_programfiles%\VideoLAN\VLC\vlc.exe
title:=""
lasttitle:=""
R3I =%a_scriptdir%\icons   ;- put icons here
ifnotexist,%r3i%
  filecreatedir,%r3i%

HK1=Esc
Hotkey,%hk1%,mute1,ON

Gui,3:default
Gui,3: -DPIScale
Gui,3:color,black,black
wa:=A_screenwidth
ha:=A_screenHeight
xx:=100

;- maybe change fontsize
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
if (wa=3840)
  Gui,3:Font,s12 cYellow,Lucida Console

;============ GUISIZEx DPIx FHD 1920*1080 is 100% ============
if (wa=1920)
 Gui,3:Font,s10 cYellow,Lucida Console
;=============================================================

e:=""
gosub,parsexml

;xxa=Shell.Explorer    ;- IExplorer
xxa=Mozilla.Browser    ;- Mozilla Firefox

x:=(wa*.2)/100,y:=(ha*.2)/100,h:=(ha*60)/100,w:=(wa*53)/100
Gui,3: Add, ActiveX, w%w% h%h% x%x% y%y% vWB,%xxa%
;Gui,3: Add, ActiveX, w%w% h%h% x%x% y%y% -Border vWB,%xxa%
WB.Silent := True

x:=(wa*54)/100,y:=(ha*.2)/100,h:=(ha*73)/100,w:=(wa*25)/100
Gui,3:Add, ListView,x%x% y%y% w%w% h%h% +hscroll BackgroundTeal altsubmit vB1 gB2,Name|URL
T1:=(wa*24)/100
T2:=(wa*0 )/100
;T3:=(wa*0 )/100
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
;LV_ModifyCol(3,T3)

GoSub,FILL

x:=(wa*.1)/xx,y:=(ha*63)/xx,h:=(ha*2.5)/xx,w:=(wa*50)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED1 
y:=(ha*66)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED2
y:=(ha*69)/xx,w:=(wa*14)/xx
Gui,3:add,Edit,x%x% y%y% h%h% w%w% vED3


x:=(wa*.2)/100,y:=(ha*.2)/100,h:=(ha*74)/100,w:=(wa*81)/100
Gui,3:show,x%x% y%y% w%w% h%h%,%filename1%
settimer,aatimer,5000
gosub,aatimer
return
;-----------
mute1:
soundset,+1,master,mute
return
;--------------
;esc::exitapp

;======================= FILL ==============
FILL:
Gui, 3:ListView, B1
LV_Delete()
  ;ILStatus := IL_Create(1,1,0)                ;small
   ILStatus := IL_Create(1,1,1)                ;bigger
   LV_SetImageList(ILStatus, 1)

i:=0
Loop,parse,e,`n,`r
  {
  x:=a_loopfield
  if x=
     continue
  c1=
  c2=
  c3=
  stringsplit,C,x,`;
  c1=%c1%
  c2=%c2%
  c3=%c3%
  SplitPath,c3, name, dir, ext, name_no_ext, drive
  h1=
  h2=
  m1=
  m2=
  i++
  stringsplit,h,ext,`?
  if h2<>
    {
    stringsplit,m,ext,`?
    xxa:= r3i . "\" . i . "." . m1
    ;urldownloadtofile,%c3%,%r3i%\%i%.%m1%
    }
  else
    xxa:= r3i . "\" . i . "." . ext
  ;msgbox,%xxa%
  ;SplitPath,c3, name, dir, ext, name_no_ext, drive
  ;xxa:= r3i . "\" . name
  IconNumber := IL_Add(ILSTATUS, "%pictxx05%" )      ;- clear with picture which not exist
  IconNumber := IL_Add(ILSTATUS,xxa)
  LV_Add("icon" . IconNumber ,c1,c2)
  }
;LV_ModifyCol(1, "Logical SortAsc")  ;- maybe sort column-1
return
;----------------------------------


PicturesOnce:
R3I =%a_scriptdir%\icons
ifnotexist,%r3i%
  filecreatedir,%r3i%
i=0
Loop,parse,e,`n,`r
  {
  x:=a_loopfield
  if x=
     continue
  c1=
  c2=
  c3=
  stringsplit,C,x,`;
  c1=%c1%
  c2=%c2%
  c3=%c3%
  SplitPath,c3, name, dir, ext, name_no_ext, drive
  h1=
  h2=
  m1=
  m2=
  i++
  stringsplit,h,ext,`?
  if h2<>
    {
    stringsplit,m,ext,`?
    urldownloadtofile,%c3%,%r3i%\%i%.%m1%
    }
  else
    urldownloadtofile,%c3%,%r3i%\%i%.%ext%
  }
return
;---------------------------------------------

B2:
Gui,3:ListView, B1
GuiControlGet,B1
  RN:=LV_GetNext("C")
  RF:=LV_GetNext("F")
  GC:=LV_GetCount()

if A_GuiEvent = Normal
  {
  LV_GetText(C1,A_EventInfo,1)
  LV_GetText(C2,A_EventInfo,2)
  ifexist,%vlcx%
     {
     try
       {
       ;Process, Exist, vlc.exe
       ;If ErrorLevel
       ;      process,close,vlc.exe
       run,%vlcx% --one-instance --qt-start-minimized %c2%,,hide,
       gosub,aatimer
       }
  catch
     msgbox, 262208,ERROR ,CHECK PATH %vlcx%
     }
  Guicontrol,3:,ED1, %C1%
  Guicontrol,3:,ED2,
  Guicontrol,3:,ED3, %C2%
  settimer,aatimer,ON
  gosub,aatimer
  }
return
;----------------------------

PARSEXML:
;-- PARSE oldies XML --------------------------------
url1:="http://opml.radiotime.com/Browse.ashx?id=g390"
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET",url1, true)
whr.Send()
whr.WaitForResponse()
e1 := whr.ResponseText
transform,r,chr,34   ;- "
transform,s,chr,32 
transform,k,chr,59 
x:= r . s
a=<outline type="audio"
b=/>
c1=text="           ;- radio name
c2=url="            ;- radio url
c3=image="          ;- radio image
c4=playing_image="  ;- playing image ( change )
p=1
loop,parse,e1,`n,`r
{
lr:= a_loopfield
   stringreplace,lr,lr,`;,,all
   stringreplace,lr,lr,&#39,,all
   stringreplace,lr,lr,&amp,,all
   stringreplace,lr,lr,&apos,,all
if lr contains %a%
  {
  nr=1
  }
if lr not contains %a%
  nr=0
if (nr=1)
 {
 stringreplace,lr,lr,%x%,$,all
 ;msgbox,%lr%
 loop,parse,lr,$
    {
    y:=a_loopfield
    if y contains subtext=
       continue
    if y contains %c1% 
      {
      stringreplace,y,y,%c1%,,all
      a1:= y . s . k . s
      }
    if y contains %c2%
      {
      stringreplace,y,y,%c2%,,all
      a2:= y . s . k . s
      }
    if y contains %c3%
      {
      stringreplace,y,y,%c3%,,all
      a3:= y
      }
    if y contains %b%   
      {
      p++
      e .= a1 . a2 . a3 . "`r`n"
      }
    }
 }
}
;msgbox,%e%
;return
;fileappend,%e%,test51.txt
gosub,picturesonce
sleep,100
gosub,fill
return


;----------------------------
aatimer:
;WinGetTitle, Title1, VLC media player ahk_exe vlc.exe
WinGetTitle, Title1,ahk_exe vlc.exe
title1=%title1%
stringreplace,title,title1,VLC media player,,
Guicontrol,3:,ED2,%title%
if (title1 != lasttitle)
  {
  ;msgbox, 262208, , webpage changed!,1
  ;title1=Eartha kitt - Under the Bridges of Paris -  ;- this is in ED2 
  stringsplit,b,title1,-
  b1=%b1%
  StringUpper,b1,b1,T
  stringreplace,b1,b1,%a_space%,_,all
  url:="https://en.wikipedia.org/wiki/" . b1
  WB.Navigate(url)
  }
else
  {
  ;msgbox, 262208, , no change!,1
  }
lasttitle := title1
return
;----------------------------


;------------------------------------------------- 
3Guiclose:
;settimer,aatimer,OFF
Process, Exist, vlc.exe
If ErrorLevel
   {
   msgbox, 262435,Radio-Close,Want you close also Audio ?
   ifmsgbox,NO
      exitapp
   ifmsgbox,Cancel
      return
   else
     {
     process,close,vlc.exe
     exitapp
     }
   }
else
  exitapp
return
;----------------------------
;============================== END SCRIPT ======================

/*
;- http://opml.radiotime.com/Browse.ashx?id=g390
Addictive 50s (Canada) ; http://opml.radiotime.com/Tune.ashx?id=s166793 ; http://cdn-radiotime-logos.tunein.com/s166793q.png
GotRadio The 50s (US) ; http://opml.radiotime.com/Tune.ashx?id=s65671 ; http://cdn-radiotime-logos.tunein.com/s49666q.png
ABC 50s (Fifties) (Canada) ; http://opml.radiotime.com/Tune.ashx?id=s165879 ; http://cdn-radiotime-logos.tunein.com/s165879q.png
24-7 Dreamboats And Petticoats (UK) ; http://opml.radiotime.com/Tune.ashx?id=s193402 ; http://cdn-radiotime-logos.tunein.com/s193402q.png
1.FM - Back To The 50s  60s Radio (Switzerland) ; http://opml.radiotime.com/Tune.ashx?id=s47713 ; http://cdn-radiotime-logos.tunein.com/s47713q.png
1A Oldies (Germany) ; http://opml.radiotime.com/Tune.ashx?id=s307969 ; http://cdn-profiles.tunein.com/s307969/images/logoq.png?t=155672
The Doo-Wop Express (US) ; http://opml.radiotime.com/Tune.ashx?id=s111171 ; http://cdn-radiotime-logos.tunein.com/s111171q.png
Dagnys Jukebox (Sweden) ; http://opml.radiotime.com/Tune.ashx?id=s78271 ; http://cdn-radiotime-logos.tunein.com/s78271q.png
RPR1.Oldies (Germany) ; http://opml.radiotime.com/Tune.ashx?id=s281879 ; http://cdn-profiles.tunein.com/s281879/images/logoq.jpg?t=157608
La Tremenda Corte Radio (Trespatines) (Dominican Republic) ; http://opml.radiotime.com/Tune.ashx?id=s268168 ; http://cdn-radiotime-logos.tunein.com/s268168q.png
Puregold Oldies (US) ; http://opml.radiotime.com/Tune.ashx?id=s304517 ; http://cdn-profiles.tunein.com/s304517/images/logoq.jpg?t=155912
TopShelf Oldies (US) ; http://opml.radiotime.com/Tune.ashx?id=s127539 ; http://cdn-radiotime-logos.tunein.com/s127539q.png
The UK 1950s Radio Station (UK) ; http://opml.radiotime.com/Tune.ashx?id=s237607 ; http://cdn-profiles.tunein.com/s237607/images/logoq.png?t=154989
Country Gold FM (US) ; http://opml.radiotime.com/Tune.ashx?id=s234271 ; http://cdn-radiotime-logos.tunein.com/s234271q.png
Yes2day Radio (Copenhagen, Denmark) ; http://opml.radiotime.com/Tune.ashx?id=s9307 ; http://cdn-profiles.tunein.com/s9307/images/logoq.png?t=153969
Music Box Memories (Canada) ; http://opml.radiotime.com/Tune.ashx?id=s262902 ; http://cdn-radiotime-logos.tunein.com/s262902q.png
RCS Network Story (Campania, Italy) ; http://opml.radiotime.com/Tune.ashx?id=s276071 ; http://cdn-profiles.tunein.com/s276071/images/logoq.png
Cleansing 50s (US) ; http://opml.radiotime.com/Tune.ashx?id=s234015 ; http://cdn-profiles.tunein.com/s234015/images/logoq.png?t=156275
Sounds of Philly Radio (US) ; http://opml.radiotime.com/Tune.ashx?id=s121217 ; http://cdn-radiotime-logos.tunein.com/s121217q.png
Fun45s.com (US) ; http://opml.radiotime.com/Tune.ashx?id=s177735 ; http://cdn-radiotime-logos.tunein.com/s177735q.png
Trespatines Radio (Dominican Republic) ; http://opml.radiotime.com/Tune.ashx?id=s281938 ; http://cdn-profiles.tunein.com/s281938/images/logoq.png?t=151619
Mega1050 50s (UK) ; http://opml.radiotime.com/Tune.ashx?id=s306269 ; http://cdn-profiles.tunein.com/s306269/images/logoq.jpg
WRGG-LP (New Market, US) ; http://opml.radiotime.com/Tune.ashx?id=s272676 ; http://cdn-profiles.tunein.com/s272676/images/logoq.jpg
KTL Radio (Germany) ; http://opml.radiotime.com/Tune.ashx?id=s165824 ; http://cdn-radiotime-logos.tunein.com/s165824q.png
Radio RMF 50s (Poland) ; http://opml.radiotime.com/Tune.ashx?id=s119895 ; http://cdn-radiotime-logos.tunein.com/s119895q.png
*/



Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, mikeyww, Rohwedder and 32 guests