forked from vdcrim/AvsP-macros
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip tags and sliders from the script before evaluating it
- Loading branch information
Showing
3 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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]> | ||
|
@@ -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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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]> | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]> | ||
|
@@ -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 | ||
|