hmm, seems vb2py wont help yet, not current with vb.net yet.
here is that source on the launch ripper already out (in vb un-edited)
Quote:public class vbnetimport
implements meedio.imlimportplugin
public myitem as meedio.imlitem
public dummystring as string
public dummyinteger as integer
private counter as integer
private frmgenre as new frmgenre
private curbandwidth as long
private importgenre as string
private top100 as boolean = false
private newvideos as boolean = false
private exporturllist as boolean
private urllistdir as string
private videoid(20000) as string
private videoname(20000) as string
private videoartist(20000) as string
private videogenre(20000) as string
dim download as string
public sub new()
mybase.new()
end sub
public function editcustomproperty(byval window as integer, byval propname as string, byref value as string) as boolean implements
meedio.imlimportplugin.editcustomproperty
if propname = "importgenre" then
if value.indexof(",blues") <> -1 then
frmgenre.genrelist.setitemchecked(0, true)
end if
if value.indexof(",christian") <> -1 then
frmgenre.genrelist.setitemchecked(1, true)
end if
if value.indexof(",country") <> -1 then
frmgenre.genrelist.setitemchecked(2, true)
end if
if value.indexof(",electronica") <> -1 then
frmgenre.genrelist.setitemchecked(3, true)
end if
if value.indexof(",folk") <> -1 then
frmgenre.genrelist.setitemchecked(4, true)
end if
if value.indexof(",jazz") <> -1 then
frmgenre.genrelist.setitemchecked(5, true)
end if
if value.indexof(",latin") <> -1 then
frmgenre.genrelist.setitemchecked(6, true)
end if
if value.indexof(",new age") <> -1 then
frmgenre.genrelist.setitemchecked(7, true)
end if
if value.indexof(",pop") <> -1 then
frmgenre.genrelist.setitemchecked(8, true)
end if
if value.indexof(",r&b") <> -1 then
frmgenre.genrelist.setitemchecked(9, true)
end if
if value.indexof(",rap") <> -1 then
frmgenre.genrelist.setitemchecked(10, true)
end if
if value.indexof(",reggae") <> -1 then
frmgenre.genrelist.setitemchecked(11, true)
end if
if value.indexof(",rock") <> -1 then
frmgenre.genrelist.setitemchecked(12, true)
end if
if value.indexof(",shows & movies") <> -1 then
frmgenre.genrelist.setitemchecked(13, true)
end if
if value.indexof(",world") <> -1 then
frmgenre.genrelist.setitemchecked(14, true)
end if
if value.indexof(",new videos") <> -1 then
frmgenre.genrelist.setitemchecked(16, true)
end if
if value.indexof(",top 100") <> -1 then
frmgenre.genrelist.setitemchecked(17, true)
end if
dim i as integer
frmgenre.showdialog()
if frmgenre.dialogresult = windows.forms.dialogresult.ok then
value = "genre"
if frmgenre.genrelist.checkeditems.count <> 0 then
for i = 0 to frmgenre.genrelist.checkeditems.count - 1
value = value & "," & frmgenre.genrelist.checkeditems(i)
next
end if
end if
end if
editcustomproperty = true
end function
public function getproperty(byval index as integer, byval prop as meedio.imeediopluginproperty) as boolean implements
meedio.imlimportplugin.getproperty
dim choices(2) as string
if index = 1 then
prop.caption = "streaming bandwidth"
prop.name = "bandwidth"
prop.datatype = "string"
prop.helptext = "sets streaming bandwidth."
prop.defaultvalue = "768"
choices(0) = "768"
choices(1) = "300"
choices(2) = "56"
prop.choices = choices
getproperty = true
elseif index = 2 then
prop.caption = "select genre to import"
prop.name = "importgenre"
prop.datatype = "custom"
prop.helptext = "check the genres that you want to import."
prop.defaultvalue = "genre,country,rock"
getproperty = true
elseif index = 3 then
prop.caption = "export url list."
prop.name = "exporturllist"
prop.datatype = "bool"
prop.helptext = "for use with nettransport." & vblf & "url.lst = list of added videos" & vblf & "urlfull.lst = list of all
videos"
prop.defaultvalue = false
getproperty = true
elseif index = 4 then
prop.caption = "export url list to :"
prop.name = "urllist"
prop.datatype = "folder"
prop.helptext = "folder where url lists will be stored."
prop.defaultvalue = "c:\"
getproperty = true
else
getproperty = false
end if
end function
public function setproperties(byval properties as meedio.imeedioitem, byref errortext as string) as boolean implements
meedio.imlimportplugin.setproperties
curbandwidth = properties("bandwidth")
importgenre = properties("importgenre")
exporturllist = properties("exporturllist")
urllistdir = properties("urllist")
setproperties = true
end function
public function import(byval section as meedio.imlsection, byval progress as meedio.imlimportprogress) as boolean implements
meedio.imlimportplugin.import
dim i as integer
dim bar as integer
dim genre as string
dim addedcounter as integer
section.addnewtag("genre")
section.addnewtag("artist")
section.addnewtag("bw")
section.addnewtag("mmsfile")
' adding views
if section.viewcount = 0 then
section.addnewview("search by genre")
section.views(0).addnewstep("genre")
section.views(0).addnewstep("artist")
section.views(0).steps(1).groupfunction = "index"
section.views(0).addnewstep("artist")
section.views(0).addnewstep("")
section.views(0).steps(3).mode = "view"
section.addnewview("search all")
section.views(1).addnewstep("artist")
section.views(1).steps(0).groupfunction = "index"
section.views(1).addnewstep("artist")
section.views(1).addnewstep("")
section.views(1).steps(2).mode = "view"
end if
if not progress.progress(1, "starting...now") then return false
counter = 0
if importgenre.indexof(",blues") <> -1 then
getvideos("blues", progress)
if not progress.progress(10, "finished blues") then return false ' check cancel
end if
if importgenre.indexof(",christian") <> -1 then
getvideos("christian", progress)
if not progress.progress(10, "finished christian") then return false ' check cancel
end if
if importgenre.indexof(",country") <> -1 then
getvideos("country", progress)
if not progress.progress(10, "finished country") then return false ' check cancel
end if
if importgenre.indexof(",electronica") <> -1 then
getvideos("electronica", progress)
if not progress.progress(10, "finished electronica") then return false ' check cancel
end if
if importgenre.indexof(",jazz") <> -1 then
getvideos("jazz", progress)
if not progress.progress(10, "finished jazz") then return false ' check cancel
end if
if importgenre.indexof(",latin") <> -1 then
getvideos("latin", progress)
if not progress.progress(10, "finished latin") then return false ' check cancel
end if
if importgenre.indexof(",blues") <> -1 then
getvideos("new age", progress)
if not progress.progress(10, "finished new age") then return false ' check cancel
end if
if importgenre.indexof(",pop") <> -1 then
getvideos("pop", progress)
if not progress.progress(10, "finished pop") then return false ' check cancel
end if
if importgenre.indexof(",r&b") <> -1 then
getvideos("r&b", progress)
if not progress.progress(10, "finished r&b") then return false ' check cancel
end if
if importgenre.indexof(",blues") <> -1 then
getvideos("rap", progress)
if not progress.progress(10, "finished rap") then return false ' check cancel
end if
if importgenre.indexof(",reggae") <> -1 then
getvideos("reggae", progress)
if not progress.progress(10, "finished reggae") then return false ' check cancel
end if
if importgenre.indexof(",rock") <> -1 then
getvideos("rock", progress)
if not progress.progress(10, "finished rock") then return false ' check cancel
end if
if importgenre.indexof(",shows & movies") <> -1 then
getvideos("shows", progress)
if not progress.progress(10, "finished shows & movies") then return false ' check cancel
end if
if importgenre.indexof(",world") <> -1 then
getvideos("world", progress)
if not progress.progress(10, "finished world") then return false ' check cancel
end if
if importgenre.indexof(",new videos") <> -1 then
getvideos("new videos", progress)
newvideos = false
end if
if importgenre.indexof(",top 100") <> -1 then
getvideos("top 100", progress)
top100 = false
end if
addedcounter = 0
for i = 1 to counter
myitem = section.finditembyexternalid(videoid(i))
if myitem is nothing then
dummystring = getmms(videoid(i))
if dummystring <> "" then
myitem = section.addnewitem(videoname(i), dummystring)
myitem.externalid = videoid(i)
myitem.tags.values("mmsfile") = mid(dummystring, len(dummystring) - 10)
myitem.tags.values("genre") = videogenre(i)
myitem.tags.values("artist") = videoartist(i)
myitem.tags.values("bw") = curbandwidth
myitem.savetags()
addedcounter = addedcounter + 1
end if
end if
bar = 10 + int(i / counter * 80)
progress.progress(bar, "found : " & videoartist(i) & " - " & videoname(i))
next i
'********************************************************************************
if (exporturllist = true) and (dir(urllistdir, fileattribute.directory) <> "") then
fileopen(1, urllistdir & "\url.lst", openmode.output)
if not progress.progress(90, "exporting urlfull.lst") then
fileclose(1)
return false ' check cancel
end if
for i = 0 to section.itemcount - 1
printline(1, section.items(i).location)
next i
fileclose(1)
end if
progress.progress(100, "finished. found " & counter & "songs. added " & addedcounter & " to library.")
import = true
end function
private sub getvideos(byval genre as string, byref progress as meedio.imlimportprogress)
on error goto errhandler
dim uristring as string
dim mywebclient as new system.net.webclient
dim selectedgenre as integer
dim i as integer ' page numbers
dim x as long
dim y as long
dim t as string
select case genre
case "blues"
selectedgenre = 800
case "christian"
selectedgenre = 1500
case "country"
selectedgenre = 400
case "electronica"
selectedgenre = 900
case "folk"
selectedgenre = 1400
case "jazz"
selectedgenre = 300
case "latin"
selectedgenre = 1100
case "new age"
selectedgenre = 1300
case "pop"
selectedgenre = 100
case "r&b"
selectedgenre = 500
case "rap"
selectedgenre = 600
case "reggae"
selectedgenre = 1200
case "rock"
selectedgenre = 200
case "shows"
selectedgenre = 700
case "world"
selectedgenre = 1000
case "top 100"
top100 = true
case "new videos"
newvideos = true
end select
'counter = 0
i = 0
do
i = i + 1
'change below to allow cancel when getting page
if not progress.progress(10, "getting page " & i & " of genre " & genre) then exit sub
if top100 then
uristring = "http://launch.yahoo.com/musicvideos/lists/top.asp?p=" & i
elseif newvideos then
uristring = "http://launch.yahoo.com/musicvideos/lists/new.asp?p=" & i
else
uristring = "http://launch.yahoo.com/musicvideos/genrehub.asp?genreid=" & selectedgenre & "&p=" & i
end if
mywebclient.headers.add("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.2; .net clr 1.0.3705;)")
dim mydatabuffer as byte() = mywebclient.downloaddata(uristring)
dim download as string = system.text.encoding.ascii.getstring(mydatabuffer)
'fileopen(1, "d:\testfile" & i & ".html", openmode.output) ' open file for output.
'write(1, download) ' print text to file.
'fileclose(1)
for x = 1 to len(download)
' find artist
x = instr(x, download, "/artist/default.asp?artistid=", comparemethod.binary)
if x = 0 then
x = len(download)
exit for
end if
x = instr(x, download, ">", comparemethod.binary)
y = instr(x, download, "</a>", comparemethod.binary)
counter = counter + 1
t = mid(download, x + 1, y - x - 1)
t = replace(t, chr(34), "'")
t = replace(t, chr(9), "")
t = replace(t, chr(10), "")
t = replace(t, chr(13), "")
t = replace(t, "&", "&")
t = replace(t, ">", ">")
t = replace(t, "*", "-")
videoartist(counter) = t
' find video id
x = instr(y, download, "javascript:playvideos(", comparemethod.binary)
y = instr(x, download, ")", comparemethod.binary)
videoid(counter) = mid(download, x + 22, y - x - 22)
' find song name
x = instr(y, download, ">", comparemethod.binary)
y = instr(x, download, "</a>", comparemethod.binary)
t = mid(download, x + 1, y - x - 1)
t = replace(t, chr(34), "'")
t = replace(t, chr(9), "")
t = replace(t, chr(10), "")
t = replace(t, chr(13), "")
t = replace(t, "&", "&")
t = replace(t, ">", ">")
t = replace(t, "*", "-")
videoname(counter) = t
videogenre(counter) = genre
next x
dummyinteger = instr(y, download, "<b>next", comparemethod.binary)
loop until dummyinteger = 0
exit sub
errhandler:
msgbox("error " & err.number & ": " & err.description)
end sub
'***************************************************************************
'*********** get mms link ***********
'***************************************************************************
private function getmms(byval videoid as string) as string
on error goto errhandler2
'**************** state 1 **********************************************
dim uristring as string
dim mywebclient as new system.net.webclient
uristring = "http://today.launch.yahoo.com/player/medialog.asp?vid=" & videoid & "&bw=" & curbandwidth &
"&mf=1&pid=5&p1=&p2=&p3=2&rpid=35&pv=9&bp=windows%20nt&csid=396500551&uid=1419997738&pguid=03b32c1b604e43d6803bba948f2edc66&sk=7d0hi5106
m427406c7c34&fcv=&z=ms.asx"
mywebclient.headers.add("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.2; .net clr 1.0.3705;)")
dim mydatabuffer as byte() = mywebclient.downloaddata(uristring)
dim download as string = system.text.encoding.ascii.getstring(mydatabuffer)
'fileopen(1, "c:\state1.txt", openmode.output) ' open file for output.
'write(1, download) ' print text to file.
'fileclose(1)
if instr(lcase(download), "http://") = 0 then
getmms = ""
exit function
end if
'**************** state 2 **********************************************
uristring = download
mywebclient.headers.add("user-agent", "mozilla/4.0 (compatible; msie 6.0; windows nt 5.2; .net clr 1.0.3705;)")
mydatabuffer = mywebclient.downloaddata(uristring)
download = system.text.encoding.ascii.getstring(mydatabuffer)
'fileopen(1, "c:\state2.txt", openmode.output) ' open file for output.
'write(1, download) ' print text to file.
'fileclose(1)
if instr(lcase(download), "mms://") = 0 then
getmms = ""
exit function
end if
getmms = left(download, instr(download, "?") - 1)
exit function
errhandler2:
getmms = ""
end function
end class
so there's a bunch of stuff in here yet to be removed from the meedio plugin, but the parsing of the mmc:// links works near flawlessly. anyone know of something other than vb2py to get this ball rolling?
the vb i can handle, it's the python i am having difficulty wrapping my head around so far. also, in my research i found that i would need urllib2 in order to script the user-agent string. (damn yahoo and their ie preference
) i have yet to see anyone do such in anything i have dissected for xbmc as yet.
i notice this thread has gotten quite a few views, but not a lot of posts. i think i will send solealex my .strm pack i have been working on for the gueux project for use until i sort some code out here. (i have all of the current yahoo launch electronica section parsed into .strm's)