Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Mindre oppdatering av nrkdownload.py.

* Ta med nrkdownload.py i pakking.
  • Loading branch information...
commit 573b37e8b3d74269fc4d9241020e52780c2fc47f 1 parent c2bcea7
@klakegg klakegg authored
Showing with 13 additions and 8 deletions.
  1. +1 −0  debian/nrkfs.install
  2. +1 −0  nrk.py
  3. +10 −7 nrkdownload.py
  4. +1 −1  setup.py
View
1  debian/nrkfs.install
@@ -1 +1,2 @@
nrkfs.py /usr/bin/
+nrkdownload.py /usr/bin/
View
1  nrk.py
@@ -186,4 +186,5 @@ def getDirect():
p = p.find("h3").find("a")
if p:
ret.append((fixName(p["title"]), "http://www.nrk.no" + p["href"]))
+ # ul = request("http://nrk.no/tjenester/lyd/")
return ret
View
17 nrkdownload.py 100644 → 100755
@@ -24,9 +24,9 @@
print "Library 'nrk' not found."
exit()
-import os, sys
+import os, os.path, sys
-playlist = u"""<?xml version="1.0" encoding="UTF-8"?>
+playlist = """<?xml version="1.0" encoding="UTF-8"?>
<asx version="3.0">
<title>NRK Nett-TV</title>
<author>NRK - Norsk Rikskringkasting</author>
@@ -41,15 +41,18 @@ def read(node, name):
if node.isFile():
if len(name) > 255:
name = name[0:250] + ".asx"
- try:
+ if not os.path.exists(name) or os.path.getsize(name) == 0:
f = open(name, "w")
- f.write(playlist % (node.title, str(node.getCut()).encode("utf8")))
+ try:
+ output = playlist % (node.title, str(node.getCut().encode("utf-8")))
+ f.write(output)
+ except Exception, e:
+ print name, e
f.close()
- except Exception, e:
- print e
else:
print name
- os.mkdir(name)
+ if not os.path.exists(name):
+ os.mkdir(name)
children = node.getChildren()
for n in children:
read(children[n], name + "/" + n)
View
2  setup.py
@@ -3,6 +3,6 @@
from distutils.core import setup
setup(name='nrk',
- version='0.3.2',
+ version='0.4.0',
py_modules=['nrk'],
)
Please sign in to comment.
Something went wrong with that request. Please try again.