Permalink
Browse files

Flatten the bad characters for Windows' sake

  • Loading branch information...
1 parent 0fab842 commit e80ef7937d105988ce01863db4eb6f8383e753a2 @mvanderkolff committed Feb 24, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 scripts/sbs-downloader-ondemand
@@ -6,8 +6,10 @@ import SbsOnDemand.Feed
import signal
import subprocess
import urllib
+import re
bitrate = 1500
+filenameRE = re.compile(r'[\\/:*?"<>|]')
def choose(options, allow_multi):
global bitrate
@@ -42,7 +44,7 @@ def download_video(video):
possibleMedia = video.getMedia()['content']
possibleMedia.sort(key=lambda c: abs(c.bitrate - bitrate*1000))
media = possibleMedia[0]
- filename = "{0} ({1}K).flv".format(video.title,media.bitrate/1000)
+ filename = "{0} ({1}K).flv".format(filenameRE.sub("_",video.title),media.bitrate/1000)
if media.baseUrl.startswith("rtmp://"):
download_rtmp(filename, media)
else:

0 comments on commit e80ef79

Please sign in to comment.