Last active
December 12, 2019 03:25
-
-
Save drakeguan/019ee16917618d7e3cb6 to your computer and use it in GitHub Desktop.
poor man's MPD validator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim: set hls is ai et sw=4 sts=4 ts=8 nu ft=python: | |
# | |
# Copyright © 2014 drake <drake.guan@gmail.com> | |
# | |
# Distributed under terms of the MIT license. | |
# Built-in modules | |
import sys | |
# Additional modules | |
import requests | |
from bs4 import BeautifulSoup | |
# local modules | |
def main(argv=sys.argv[:]): | |
"""main entry.""" | |
if len(argv) < 2: | |
print 'Usage: %s testing.mpd' | |
return -1 | |
link = 'http://www-itec.uni-klu.ac.at/dash/?page_id=605' | |
data={'sendFile':'1'} | |
for filename in argv[1:]: | |
files={'File': open(filename, 'rb')} | |
r = requests.post(link, data=data, files=files) | |
soup = BeautifulSoup(r.text) | |
output = soup.findAll(id='Output')[0] | |
if 'DASH is valid' in output.text: | |
print 'DASH is valid!' | |
else: | |
print 'DASH is invalid!' | |
return 0 | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@drakeguan - is this deprecated?