aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-04-18 11:36:42 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-04-18 11:36:42 +0200
commit592e97e8550389e22b716eb33c30584aa3a8d656 (patch)
tree1e05a05e64eeef73de4cf14f24ec0b1dbd68757b /test
parent53faa3ca5f62c46bb56c0a85d1ed87b911b7ffa4 (diff)
Postprocessors: use a list for the files that can be deleted
We could only know if we had to delete the original file, but this system allows to specify us more files (like subtitles).
Diffstat (limited to 'test')
-rw-r--r--test/test_YoutubeDL.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 652519831..820e55ec2 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -443,27 +443,36 @@ class TestYoutubeDL(unittest.TestCase):
def run(self, info):
with open(audiofile, 'wt') as f:
f.write('EXAMPLE')
- info['filepath']
- return False, info
+ return [info['filepath']], info
- def run_pp(params):
+ def run_pp(params, PP):
with open(filename, 'wt') as f:
f.write('EXAMPLE')
ydl = YoutubeDL(params)
- ydl.add_post_processor(SimplePP())
+ ydl.add_post_processor(PP())
ydl.post_process(filename, {'filepath': filename})
- run_pp({'keepvideo': True})
+ run_pp({'keepvideo': True}, SimplePP)
self.assertTrue(os.path.exists(filename), '%s doesn\'t exist' % filename)
self.assertTrue(os.path.exists(audiofile), '%s doesn\'t exist' % audiofile)
os.unlink(filename)
os.unlink(audiofile)
- run_pp({'keepvideo': False})
+ run_pp({'keepvideo': False}, SimplePP)
self.assertFalse(os.path.exists(filename), '%s exists' % filename)
self.assertTrue(os.path.exists(audiofile), '%s doesn\'t exist' % audiofile)
os.unlink(audiofile)
+ class ModifierPP(PostProcessor):
+ def run(self, info):
+ with open(info['filepath'], 'wt') as f:
+ f.write('MODIFIED')
+ return [], info
+
+ run_pp({'keepvideo': False}, ModifierPP)
+ self.assertTrue(os.path.exists(filename), '%s doesn\'t exist' % filename)
+ os.unlink(filename)
+
def test_match_filter(self):
class FilterYDL(YDL):
def __init__(self, *args, **kwargs):