summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar enkore <public@enkore.de> 2013-03-26 13:41:36 +0100
committerGravatar enkore <public@enkore.de> 2013-03-26 13:41:36 +0100
commit703422d3e7ae56ff74c5ab95a5dd9f5f92a6bd83 (patch)
tree8dacab3ffe64a07fa00e8b7480081e49ec03da4e /module
parentYoutubeCom: Add support for time specification, if ffmpeg is installed and in... (diff)
downloadpyload-703422d3e7ae56ff74c5ab95a5dd9f5f92a6bd83.tar.xz
Move which function to YoutubeCom plugin
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hoster/YoutubeCom.py23
-rw-r--r--module/utils.py20
2 files changed, 22 insertions, 21 deletions
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 9f21ddf79..4bc608b05 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -4,11 +4,32 @@
import re
import subprocess
import os
+import os.path
from urllib import unquote
-from module.utils import html_unescape, which
+from module.utils import html_unescape
from module.plugins.Hoster import Hoster
+def which(program):
+ """Works exactly like the unix command which
+
+ Courtesy of http://stackoverflow.com/a/377028/675646"""
+ def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+ fpath, fname = os.path.split(program)
+ if fpath:
+ if is_exe(program):
+ return program
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ path = path.strip('"')
+ exe_file = os.path.join(path, program)
+ if is_exe(exe_file):
+ return exe_file
+
+ return None
+
class YoutubeCom(Hoster):
__name__ = "YoutubeCom"
__type__ = "hoster"
diff --git a/module/utils.py b/module/utils.py
index 895768cba..8748b7693 100644
--- a/module/utils.py
+++ b/module/utils.py
@@ -195,26 +195,6 @@ def html_unescape(text):
"""Removes HTML or XML character references and entities from a text string"""
return re.sub("&#?\w+;", fixup, text)
-def which(program):
- """Works exactly like the unix command which
-
- Courtesy of http://stackoverflow.com/a/377028/675646"""
- def is_exe(fpath):
- return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
-
- fpath, fname = os.path.split(program)
- if fpath:
- if is_exe(program):
- return program
- else:
- for path in os.environ["PATH"].split(os.pathsep):
- path = path.strip('"')
- exe_file = os.path.join(path, program)
- if is_exe(exe_file):
- return exe_file
-
- return None
-
if __name__ == "__main__":
print freeSpace(".")