Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 5th, 2008, 02:31 AM
q97 q97 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: Brisvegas
Posts: 276 q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 41 m 49 sec
Reputation Power: 37
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?

Reply With Quote
  #2  
Old August 6th, 2008, 02:47 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
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:
Original - vb Code
  1. Set objServer = CreateObject("WMSServer.Server")
  2.  
  3. Const WMS_PUBLISHING_POINT_ON_DEMAND = 1
  4. Const WMS_PUBLISHING_POINT_BROADCAST = 2
  5. objPubPoint = objServer.PublishingPoints.Add("NewPubPoint", WMS_PUBLISHING_POINT_BROADCAST, _
  6.      "rtsp://server/pubpoint/movie.wmv")
  7.  
  8. ' Set the publishing point to start broadcasting when
  9. ' the first client connects.
  10. objPubPoint.AllowClientToStartAndStop = True
  11.  
  12. ' Set the publishing point to allow splitting the stream.
  13. objPubPoint.AllowStreamSplitting = True
  14.  
  15. objPubPoint.AnnouncementStreamFormats.Add("c:\wmpub\wmroot\content_clip1.wmv")
  16.  
  17. ' Retrieve an IWMSPlugins object containing
  18. ' broadcast data sink plug-in information.
  19. objPlugins = objPubPoint.BroadcastDataSinks
  20.  
  21. ' Prepare the publishing point for announcement and
  22. ' create an NSC file to be used for client connection.
  23. objPubPoint.Announce()
  24. objPubPoint.AnnounceToNSCFile("c:\wmpub\wmroot\pubpoint.nsc")
  25.  
  26. ' If the publishing point is currently stopped, start
  27. ' it and retrieve the shared playlist file.
  28. Const WMS_BROADCAST_PUBLISHING_POINT_STOPPED = &H0
  29. Const WMS_BROADCAST_PUBLISHING_POINT_STARTED_WITHOUT_DAT  A = &H1
  30. Const WMS_BROADCAST_PUBLISHING_POINT_STARTED = &H2
  31. Const WMS_BROADCAST_PUBLISHING_POINT_ARCHIVING = &H4
  32. Const WMS_BROADCAST_PUBLISHING_POINT_CHANGE_IN_PROGRESS = &H8
  33.  
  34. If objPubPoint.BroadcastStatus = WMS_BROADCAST_PUBLISHING_POINT_STOPPED Then
  35.     objPubPoint.Start()
  36.     Playlist = objPubPoint.SharedPlaylist
  37.  
  38. ' If the publishing point is currently running, retrieve the
  39. ' amount of time it has been broadcasting and then stop it.
  40. ElseIf objPubPoint.BroadcastStatus & WMS_BROADCAST_PUBLISHING_POINT_STARTED Then
  41.     lCount = objPubPoint.UpTime
  42.     objPubPoint.Stop()
  43. End If
  44.  
  45. ' Set the buffer setting to minimize propagation latency.
  46. Const WMS_BUFFER_SETTING_UNSPECIFIED = &H0
  47. Const WMS_BUFFER_SETTING_MINIMIZE_STARTUP_LATENCY = &H1
  48. Const WMS_BUFFER_SETTING_PROPOGATION_LATENCY = &H2
  49. Const WMS_NUM_BUFFER_SETTING = &H3
  50. objPubPoint.BufferSetting = WMS_BUFFER_SETTING_MINIMIZE_STARTUP_LATENCY
  51.  
  52. ' Export the publishing point configuration to an
  53. ' XML file.
  54. objPubPoint.ExportXML("c:\wmpub\wmroot\pubpoint.xml")
I'm basing this example on the .Net documentation. This is purely my own conversions so these methods may or may not be exposed to VBS. I have no way of examining the objects or testing the code since I'm not running WMS. Hope this gets you in the right direction.
Comments on this post
q97 agrees: Thanks for the info - a very good start
__________________
Click the image if at any point you don't like my decision.

Scripting problems? Windows questions? Ask the Windows Guru!


Reply With Quote
  #3  
Old August 6th, 2008, 08:07 PM
q97 q97 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: Brisvegas
Posts: 276 q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 41 m 49 sec
Reputation Power: 37
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.

Reply With Quote
  #4  
Old August 6th, 2008, 09:46 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by q97
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.
Awesome. Let me know how that pans out and be sure to post the code if you get it working.

Reply With Quote
  #5  
Old August 7th, 2008, 02:37 AM
q97 q97 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: Brisvegas
Posts: 276 q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 41 m 49 sec
Reputation Power: 37
Quote:
Originally Posted by Nilpo
Awesome. Let me know how that pans out and be sure to post the code if you get it working.


Yeah will do. I like having it where I can get it from job to job...

Reply With Quote
  #6  
Old August 7th, 2008, 02:56 AM
q97 q97 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: Brisvegas
Posts: 276 q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 41 m 49 sec
Reputation Power: 37
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")  

Reply With Quote
  #7  
Old August 7th, 2008, 07:34 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Very cool. I thought that would get you in the right direction.

Reply With Quote
  #8  
Old August 7th, 2008, 09:42 PM
q97 q97 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: Brisvegas
Posts: 276 q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level)q97 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 4 Days 10 h 41 m 49 sec
Reputation Power: 37
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.

Reply With Quote
  #9  
Old August 8th, 2008, 07:03 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
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