|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Creating a publishing point automatically...
Seems like there should be a way to create a publishing point in Windows Media Services automatically using a script...but I haven't found anything googling around.
What I would ideally like to achieve is that we create a directory on the server that we can use to upload videos, and have a script run every 15 minutes or so that automatically "ingests" the file and makes a publishing point called whatever the filename is. Any ideas? |
|
#2
|
|||||
|
|||||
|
It would seem you can. Unfortunately, I don't have a machine running WMS to play with. However, I might be able to get you started. You can connect to WMS from VBScript using the WMSServer.Server ProgID. I'm not certain which methods and properties are actually exposed to VBS, but it would look something like this.
vb Code:
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#3
|
|||
|
|||
|
Oooh..niiice.
Thanks heaps for that. I'll start mucking around with it on our internal server and see if I can get something happening. ![]() |
|
#4
|
||||
|
||||
|
Quote:
|
|
#5
|
|||
|
|||
|
Quote:
Yeah will do. I like having it where I can get it from job to job... ![]() |
|
#6
|
|||
|
|||
|
The following code seemed to get things going, you'll notice there isn't all that much left! So if that works on our live server, I just need to add code to collect an uploaded file, move it to where we keep all the streamed files, create the publishing point and off we go.
Hopefully it works out to be as easy as that... Code:
Set objServer = CreateObject("WMSServer.Server")
Const WMS_PUBLISHING_POINT_ON_DEMAND = 1
Const WMS_PUBLISHING_POINT_BROADCAST = 2
set objPubPoint = objServer.PublishingPoints.Add("NewPubPoint", WMS_PUBLISHING_POINT_ON_DEMAND, _
"C:\wmpub\WMRoot\pinball.wmv")
objPubPoint.ExportXML("c:\wmpub\wmroot\pubpoint.xml")
|
|
#7
|
||||
|
||||
|
Very cool. I thought that would get you in the right direction.
|
|
#8
|
|||
|
|||
|
Ok, this seems to work on my test server, so I'll upload it to the live server, change some paths and hopefully that will be it:
Code:
On Error Resume Next
dim objFSObject, strFolder, strFileName, objRootDir, pubName, x, newFilePath
Set objFSObject = CreateObject("Scripting.FileSystemObject")
strFolder = "C:\wmpub\WMRoot"
Set objRootDir = objFSObject.GetFolder(strFolder)
For Each file in objRootDir.Files
'msgbox file.name
x=len(file.name)-4
pubName = left(file.name,x)
'msgbox pubName
if right(file.name, 3) = "wmv" then
newFilePath = (strFolder & "\a\" & file.name)
file.move newFilePath
call CreatePubPoint (pubName, newFilePath)
end if
next
set objRootDir = nothing
set objFSObject = nothing
sub CreatePubPoint(PubPoint, WMVFilePath)
Set objServer = CreateObject("WMSServer.Server")
Const WMS_PUBLISHING_POINT_ON_DEMAND = 1
Const WMS_PUBLISHING_POINT_BROADCAST = 2
set objPubPoint = objServer.PublishingPoints.Add(PubPoint, WMS_PUBLISHING_POINT_ON_DEMAND, _
WMVFilePath)
set objServer = nothing
End Sub
So basically what it will do is take all the files in a dump directory, run through them and create the publishing points. If you upload the a file with the same file name, it should replace the existing file, and because of on error resume next it will go past the error which I don't know how to handle when the publishing point is already there A bit of a dodge, but it seems to be working nicely at the moment. I'll see if I can dig up some proper documentation on the WMSServer object and see if I can't refine it a bit. |
|
#9
|
||||
|
||||
|
Again, I can't test this, however, the Add method that is used to create a publishing point actually adds a reference to the PublishingPoints collection. Theoretically, trying to add a new object with the same name as an existing object should not generate any errors--much like updating an existing valu |