How to detect the url's availablility automatic?

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
jackhuang
New Cone
New Cone
Posts: 7
Joined: 02 Apr 2013 11:18

How to detect the url's availablility automatic?

Postby jackhuang » 02 Apr 2013 11:32

As subject. I have a long url list in a text file, I need verify the availability of the network url automatic. It should verify the network url and return the status of the url's availablility.
Does any solution can be provided?

Rémi Denis-Courmont
Developer
Developer
Posts: 15323
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to detect the url's availablility automatic?

Postby Rémi Denis-Courmont » 02 Apr 2013 17:07

In general, the only way to check that an URL works is to try to play it...
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

jackhuang
New Cone
New Cone
Posts: 7
Joined: 02 Apr 2013 11:18

Re: How to detect the url's availablility automatic?

Postby jackhuang » 03 Apr 2013 07:10

yes, I know the command for VLC to play a url, but not found which cmd can check the playback is ok.
Dose any api can help this?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to detect the url's availablility automatic?

Postby Jean-Baptiste Kempf » 03 Apr 2013 12:29

Depends on the interface you use.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

jackhuang
New Cone
New Cone
Posts: 7
Joined: 02 Apr 2013 11:18

Re: How to detect the url's availablility automatic?

Postby jackhuang » 08 Apr 2013 08:23

Bingo. I use the Python to finish the function. Python binding the libvlc.dll. I would improve the component and package it executable.
Actually, My initial purpose is automatic check the network channels and get available channels. Because I have a Android TV, it can play the
network channel stream, I get a channel list about 10000 channels url. So I could use the tool to get useful channel import my TV.
Dose anyone how to add it as a VLC extensions?

Code: Select all

import os import time import string import vlc ########################################################## #network channel source url source_url="c:\\tmp\\channel_source.txt" #processed channel url channel_url="c:\\tmp\\channel_result.txt" #interval time for channel checking check_time=10 ######################################################### #create vlc instance and media_player #ins=vlc.Instance() #mplay=ins.media_player_new() #Get result file file_obj=open(source_url,'r') channel_result=open(channel_url,'w') channel_num=0 ######################################################## print "Process steps: " print " 1.Open a channel url" print " 2.Wait 10 seconds for buffering" print " 3.Check playback status" print " 4.Release the media and go on next" print "Start process channel url..." try: for line_url in file_obj: #process network stream mplay=vlc.MediaPlayer(line_url.strip()) mplay.play() time.sleep(check_time) #check channel availability video_width=mplay.video_get_width() print "==================================================" channel_num=channel_num+1 print "Channel Num=" + str(channel_num) if(video_width>0): print "The available channel video width= " + str(video_width) print "channel_url= " + line_url #write available url to channel_result good_result="YES " + line_url channel_result.writelines(good_result) else: print "The channel is unavailablity!" print "channel_url= " + line_url #write unavailable url to channel_result bad_result="BAD " + line_url channel_result.writelines(bad_result) channel_result.flush() mplay.release() finally: file_obj.close() channel_result.close()


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 44 guests