From: achbed Date: Sat, 24 Jan 2015 18:14:13 +0000 (-0600) Subject: Fix for #51 (M3U input does not support relative paths) X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f53dfef8644c25b5896243b0149d838ec280e175;p=deefuzzer.git Fix for #51 (M3U input does not support relative paths) Signed-off-by: achbed --- diff --git a/deefuzzer/station.py b/deefuzzer/station.py index f558e4e..8f67229 100644 --- a/deefuzzer/station.py +++ b/deefuzzer/station.py @@ -288,6 +288,9 @@ class Station(Thread): def _path_add_base(self, a): return os.path.join(self.base_directory, a) + def _path_m3u_rel(self, a): + return os.path.join(os.path.dirname(self.source), a) + def _log(self, level, msg): try: obj = {} @@ -419,8 +422,9 @@ class Station(Thread): f = open(self.media_source, 'r') try: for path in f.readlines(): + path = path.strip() if '#' != path[0]: - fp = self._path_add_base(path.strip()) + fp = self._path_m3u_rel(path) if os.path.isfile(fp): file_list.append(fp) except: diff --git a/example/deefuzzer_doc.xml b/example/deefuzzer_doc.xml index e24c8ea..20b68d0 100644 --- a/example/deefuzzer_doc.xml +++ b/example/deefuzzer_doc.xml @@ -48,7 +48,6 @@ - media/source (except for stations created using the stationfolder method) - record/dir - feeds/dir - - All paths read from the file specified by media/m3u or media/source If the parameter path begins with a slash, it is assumed to be an absolute path and prepending does not occur (see https://docs.python.org/2/library/os.path.html#os.path.join )