Skip to content

Instantly share code, notes, and snippets.

@drakeguan
Last active December 12, 2019 03:25
Show Gist options
  • Save drakeguan/019ee16917618d7e3cb6 to your computer and use it in GitHub Desktop.
Save drakeguan/019ee16917618d7e3cb6 to your computer and use it in GitHub Desktop.
poor man's MPD validator
#!/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())
Copy link

ghost commented Dec 12, 2019

@drakeguan - is this deprecated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment