Skip to content

Commit

Permalink
Strip tags and sliders from the script before evaluating it
Browse files Browse the repository at this point in the history
  • Loading branch information
vdcrim committed Nov 13, 2012
1 parent 2570ab4 commit 698cf20
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
8 changes: 6 additions & 2 deletions Divide script.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
assigned to a variable (doesn't set 'last').
Date: 2012-10-30
Date: 2012-11-13
Latest version: https://github.com/vdcrim/avsp-macros
Changelog:
Expand All @@ -31,6 +31,7 @@
- add 'using the last evaluated expression' option
- fix text evaluated when the cursor is on a multiline comment
- fix generated scripts not being correct in some cases
- strip tags and sliders from the script
Copyright (C) 2012 Diego Fernández Gosende <[email protected]>
Expand Down Expand Up @@ -172,7 +173,10 @@ def float_range_list(start, stop, step):

# Eval script
encoding = sys.getfilesystemencoding()
text = avsp.GetText()
if self.version > '2.3.1':
text = avsp.GetText(clean=True)
else:
text = self.getCleanText(avsp.GetText())
var = 'last'
assign = ''
if use_current_position:
Expand Down
12 changes: 9 additions & 3 deletions Images batch processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
the result afterwards.
Date: 2012-09-11
Date: 2012-11-13
Latest version: https://github.com/vdcrim/avsp-macros
Created originally for http://forum.doom9.org/showthread.php?p=1552739#post1552739
Expand All @@ -18,6 +18,7 @@
- move all the settings to the prompt
- fix Python 2.6 compatibility
- fix Unicode paths
- strip tags and sliders from the script before evaluating it
Copyright (C) 2012 Diego Fernández Gosende <[email protected]>
Expand Down Expand Up @@ -45,14 +46,16 @@
from os.path import splitext, basename, join
from glob import glob

self = avsp.GetWindow()

# Get defaults
in_dir = avsp.Options.get('in_dir', '')
input_list = avsp.Options.get('input_list', 'bmp;png;tif')
out_dir = avsp.Options.get('out_dir', '')
out_format = avsp.Options.get('out_format', _('Portable Network Graphics') + ' (*.png)')
suffix = avsp.Options.get('suffix', '_new')
quality = avsp.Options.get('quality', 90)
format_dict = dict([(name[0], ext) for ext, name in avsp.GetWindow().imageFormats.iteritems()])
format_dict = dict([(name[0], ext) for ext, name in self.imageFormats.iteritems()])

# Prompt for options
while True:
Expand Down Expand Up @@ -100,7 +103,10 @@
return

# Check if the script contains the path wildcard
script = avsp.GetText()
if self.version > '2.3.1':
script = avsp.GetText(clean=True)
else:
script = self.getCleanText(avsp.GetText())
if not '"input_path"' in script:
avsp.MsgBox(_('Not "input_path" in the script'), _('Error'))
return
Expand Down
9 changes: 7 additions & 2 deletions Pipe RGB to ImageMagick.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@
3) place it on the 'AvsPmod\tools' directory
Date: 2012-11-07
Date: 2012-11-13
Latest version: https://github.com/vdcrim/avsp-macros
Changelog:
- remember the last used output format
- strip tags and sliders from the script before evaluating it
Copyright (C) 2012 Diego Fernández Gosende <[email protected]>
Expand Down Expand Up @@ -312,7 +313,11 @@ def __del__(self):
avsp.Options['show_progress'] = show_progress

# Eval script
clip = Clip(avsp.GetText(), avs_path)
if self.version > '2.3.1':
text = avsp.GetText(clean=True)
else:
text = self.getCleanText(avsp.GetText())
clip = Clip(text, avs_path)
if clip.error is not None:
avsp.MsgBox('\n\n'.join((_('Error loading the script'), clip.error)), _('Error'))
return
Expand Down

0 comments on commit 698cf20

Please sign in to comment.