Skip to content

Commit

Permalink
[cleanup] Misc
Browse files Browse the repository at this point in the history
Closes yt-dlp#7030, closes yt-dlp#6967
  • Loading branch information
pukkandan authored and stanoarn committed May 26, 2023
1 parent 7b44fc3 commit 773847d
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 404 deletions.
4 changes: 2 additions & 2 deletions test/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ def sanitize_got_info_dict(got_dict):
'formats', 'thumbnails', 'subtitles', 'automatic_captions', 'comments', 'entries',

# Auto-generated
'autonumber', 'playlist', 'format_index', 'video_ext', 'audio_ext', 'duration_string', 'epoch',
'fulltitle', 'extractor', 'extractor_key', 'filepath', 'infojson_filename', 'original_url', 'n_entries',
'autonumber', 'playlist', 'format_index', 'video_ext', 'audio_ext', 'duration_string', 'epoch', 'n_entries',
'fulltitle', 'extractor', 'extractor_key', 'filename', 'filepath', 'infojson_filename', 'original_url',

# Only live_status needs to be checked
'is_live', 'was_live',
Expand Down
8 changes: 4 additions & 4 deletions test/test_YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ def expect_same_infodict(out):
test('%(id)r %(height)r', "'1234' 1080")
test('%(ext)s-%(ext|def)d', 'mp4-def')
test('%(width|0)04d', '0000')
test('a%(width|)d', 'a', outtmpl_na_placeholder='none')
test('a%(width|b)d', 'ab', outtmpl_na_placeholder='none')

FORMATS = self.outtmpl_info['formats']
sanitize = lambda x: x.replace(':', ':').replace('"', """).replace('\n', ' ')
Expand Down Expand Up @@ -871,12 +871,12 @@ def test_postprocessors(self):

class SimplePP(PostProcessor):
def run(self, info):
with open(audiofile, 'wt') as f:
with open(audiofile, 'w') as f:
f.write('EXAMPLE')
return [info['filepath']], info

def run_pp(params, PP):
with open(filename, 'wt') as f:
with open(filename, 'w') as f:
f.write('EXAMPLE')
ydl = YoutubeDL(params)
ydl.add_post_processor(PP())
Expand All @@ -895,7 +895,7 @@ def run_pp(params, PP):

class ModifierPP(PostProcessor):
def run(self, info):
with open(info['filepath'], 'wt') as f:
with open(info['filepath'], 'w') as f:
f.write('MODIFIED')
return [], info

Expand Down
Loading

0 comments on commit 773847d

Please sign in to comment.