[SCM] hydrogen-drumkits/master: Add Python script to parse the drumkist list available from: http://www.hydrogen-music.org/feeds/drumkit_list.php
alessio at users.alioth.debian.org
alessio at users.alioth.debian.org
Fri Mar 18 12:57:00 UTC 2011
The following commit has been merged in the master branch:
commit 6dca6279e01c5be1d57e3dfccf2ffb100bd82bfe
Author: Alessio Treglia <alessio at debian.org>
Date: Fri Mar 18 13:54:19 2011 +0100
Add Python script to parse the drumkist list available from:
http://www.hydrogen-music.org/feeds/drumkit_list.php
This simply returns the URLs from where grab the drumkits.
diff --git a/debian/update_drumkits_list.py b/debian/update_drumkits_list.py
new file mode 100644
index 0000000..3097788
--- /dev/null
+++ b/debian/update_drumkits_list.py
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+# update_drumkits_list.py
+#
+# Copyright © 2011 Alessio Treglia <alessio at debian.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import sys
+import urllib
+import xml.etree.ElementTree
+
+URL = 'http://www.hydrogen-music.org/feeds/drumkit_list.php'
+FIELDS = ('name', 'url')
+
+def objects_to_list(objs):
+ objs_list = []
+ for i in objs:
+ elem = dict()
+ for field in FIELDS:
+ elem[field] = i.find(field).text
+ objs_list.append(elem)
+ return objs_list
+
+def print_url_list(objs):
+ for elem in objs:
+ sys.stdout.write("%s\n" % elem['url'])
+
+def main():
+ filename = urllib.urlretrieve(URL)[0]
+ objs = xml.etree.ElementTree.parse(filename).findall('drumkit')
+ print_url_list(objects_to_list(objs))
+
+if __name__ == '__main__':
+ main()
--
hydrogen-drumkits packaging
More information about the pkg-multimedia-commits
mailing list