Request: Pre-editor editor
Request: Pre-editor editor
Hi @rednoah, I'm baaaaaaaaaaaaaaack! lol
I know I mentioned something like this before in one of my billion posts, but this is an official request, if it's possible to do.
Basically, an editor to allow adding or altering of values before the main line is parsed. I'm sure that's confusing, so to clear it up, when double clicking on a destination title (list on right side) to bring up the format editor, have a little button on the right (near the options to choose a recently format, etc) to open up an 'pre-format editor', where the user can define (or change) values that are used in the format string.
So, for example, I could change {n} to something else if I wanted, or add a new value of {newN} or {n2} etc. Benefit here would be that if the same thing is done multiple times in the format string, or if the user wants to simplify how the format string looks, they can do it easily.
Of course, the values should be available to the command line as well, or perhaps include an option to specify a file to include for processing before the format string is used.
Could even make it so that little button toggles an 'expert' mode that opens up another editing window in the format editor, so someone could do real-time editing in either window.
Oh and before you go looking for a gun to shoot me with, try drinking a glass of wine instead... That will do a better job of relaxing the nerves I just rattled.
I know I mentioned something like this before in one of my billion posts, but this is an official request, if it's possible to do.
Basically, an editor to allow adding or altering of values before the main line is parsed. I'm sure that's confusing, so to clear it up, when double clicking on a destination title (list on right side) to bring up the format editor, have a little button on the right (near the options to choose a recently format, etc) to open up an 'pre-format editor', where the user can define (or change) values that are used in the format string.
So, for example, I could change {n} to something else if I wanted, or add a new value of {newN} or {n2} etc. Benefit here would be that if the same thing is done multiple times in the format string, or if the user wants to simplify how the format string looks, they can do it easily.
Of course, the values should be available to the command line as well, or perhaps include an option to specify a file to include for processing before the format string is used.
Could even make it so that little button toggles an 'expert' mode that opens up another editing window in the format editor, so someone could do real-time editing in either window.
Oh and before you go looking for a gun to shoot me with, try drinking a glass of wine instead... That will do a better job of relaxing the nerves I just rattled.
Re: Request: Pre-editor editor
Kinda like C pre-processor instructions? Can you describe real-world examples and use-cases?
Why not use Presets if you need different formats for different situations?
Why not access environment variables if you want the same format do different things on different machines?
Why not use Presets if you need different formats for different situations?
Why not access environment variables if you want the same format do different things on different machines?
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
The idea would be to have a "pre-processor" that would do the dirty work, so that the main expression can look better.
Take, for example, the recent issue with TheTVDB, where the series start date isn't available due to a bug (for new shows). To counter the issue, using {n} and then getting the initial year from the first episode would seem simple enough. But if it's a remake of a show, then part of the {n} has the year in it, so then the year would be listed twice. So, making a folder with the name and year, then a folder with the season number, then the file with the name and year on it, that requires hacking at the name and year twice, at least without getting a little more complex. (More times for other reasons, just trust me on this one.)
Being able to remove any (yyyy) from {n} before hand, as well as making sure {y} is populated, would make it easier. Mind you, this is just a simple example.
How does one use env variables from inside filebot?
Edit: The pre-processor would only be prior to the expression, with all values already populated, with the ability to modify or define additional values.
Take, for example, the recent issue with TheTVDB, where the series start date isn't available due to a bug (for new shows). To counter the issue, using {n} and then getting the initial year from the first episode would seem simple enough. But if it's a remake of a show, then part of the {n} has the year in it, so then the year would be listed twice. So, making a folder with the name and year, then a folder with the season number, then the file with the name and year on it, that requires hacking at the name and year twice, at least without getting a little more complex. (More times for other reasons, just trust me on this one.)
Being able to remove any (yyyy) from {n} before hand, as well as making sure {y} is populated, would make it easier. Mind you, this is just a simple example.
How does one use env variables from inside filebot?
Edit: The pre-processor would only be prior to the expression, with all values already populated, with the ability to modify or define additional values.
Re: Request: Pre-editor editor
1.
You can use variables to avoid code duplication:
2.
You can access environment variables like so:
You can also access Java System Properties as well as FileBot --def name=value parameters.
You can use variables to avoid code duplication:
Code: Select all
{
// VARIABLES
def name = n.replaceTrailingBrackets()
def year = any{y}{episodelist[0].airdate.year}{'0000'}
def series = "$name ($year)"
def season = "Season $s"
def filename = "$series - $sxe - $t"
// MAIN
return series / season / filename
}
2.
You can access environment variables like so:
Code: Select all
System.env.HOME
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
Can you show me an actual example of that code being used?
When I try to do a { def something=something ; return something } (with and without the ; mark), it simple displays it but doesn't allow me to use the value another time.
Shows "123==" instead of "=123=" as desired.
When I try to do a { def something=something ; return something } (with and without the ; mark), it simple displays it but doesn't allow me to use the value another time.
Code: Select all
{ def name="123"; return name } ={name}=
Re: Request: Pre-editor editor
Note that I use a single {expression} to generate the entire file path. If you def a local variable in one {expression} then it still won't be available in another.
i.e. you cannot do this:
but you can do this:
i.e. you cannot do this:
Code: Select all
{ def name="123"; return name } ={name}=
Code: Select all
{ def name="123"; return name + ' =' + name + '=' }
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
Okay, so redoing my entire expression, and this is what I have so far (working so far, have a few more tweaks to add to it).
Any chance of the "Example" box becoming collapsible so that I can get more visible working room (and a button to auto maximize so I don't have to resize each time)?
Code: Select all
{
def root="P:"
def numb="35"
def path=file.path.match(/(?<=${root}\\(?:dev\\)?_)..(?=\\)/)
def wolf=any{file.path.match(/(?i)(\\WOLF\\)/)}{"/"}
def tv="TV"
year=any{y}{episodelist[0].airdate.year}{'0000'}
name=n.removeAll(/\s*\((00|19|20)\d\d\)/).colon(' - ').validateFileName()
show="${name} (${year})"
ep=s00e00.lower()
def season=(episode.special || episode.special == 0 ? '00':s.pad(2))
if (any{genres.toString().match(/(?i)Talk ?Shows?/)}{0}!=0)
{ season=airdate.toString().match(/^\d{4}/); show=name; ep=airdate; tv="TALKSHOWS" }
def folder=any{readLines('P:/collections.txt').find{ it =~ /^${info.id}\s/ }.after(/^\d+\s+/).before(/[:#\t*]/)}{show}
path="${root}/_${any{path.match(/^(0[123]|35|4[45]|ED)$/)}{numb}}/${wolf}/${tv}/${folder}/Season ${season}"
def filename="${show} - ${ep}"
def trim=fn.after(n.match(/(?:\s?\(\d{4}\)\s?)?$/)).after(/(s\d{1,3}e\d{1,3}(-?(s\d{1,3})?e?\d{1,3})|\d{4}[-.]\d{2}[-.]\d{2})([ .-]+)?/).removeAll(/\.\[?[\da-f]{8}\]?\.?/)
def post=" - "+trim
def tail=allOf{".[${crc32}]"}{fn.find(/(?<=[. -])(cd|part)\d/).upper()}{subt}.toString().match(/(?<=^\[).*(?=\]$)/).replaceAll(/, /,'.')
filename=(filename+post+tail).colon(' - ').validateFileName()
return "${path}/${filename}"
}
Re: Request: Pre-editor editor
Would it make that much of a difference? If you write lots of code, you probably wanna edit in Sublime (or any other editor that has Groovy highlighting) and copy & paste once in a while for testing.
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
I like to see the results real-time whenever possible. If making it possible to hide the example box isn't easy, then it's not worth it.
Trying to do something but can't seem to figure out how to get the desired results. Trying to make an array using labels, then join, but without the labels showing. Any ideas?
Trying to do something but can't seem to figure out how to get the desired results. Trying to make an array using labels, then join, but without the labels showing. Any ideas?
Re: Request: Pre-editor editor
Yeah, unfortunately those components aren't collapsible.
Do you mean a Map?
Code: Select all
{
['key1': 'value1', 'key2': 'value2'].values().join(', ')
}
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
.values() is what I needed, thanks!
Gonna toy with the idea of using an array (or map) for the main structure, then update in the following lines (as needed). Might not be much of a benefit, but could be fun.
Gonna toy with the idea of using an array (or map) for the main structure, then update in the following lines (as needed). Might not be much of a benefit, but could be fun.
Re: Request: Pre-editor editor
Okay, a tweak to the request. Option to have an editor window that doesn't contain the examples window, sort of like an 'expert mode' toggle. Possible?
Re: Request: Pre-editor editor
Well, it does somewhat make sense, and with a Java System Property it'd be quite trivial to add an advanced option for that. But is it really too small? How big is your screen? The large format you posted the other day fits into my 24" screen with plenty of room the spare.
EDIT:
I've added a keyboard shortcut F1 to toggle the help panel on and off. Maybe a bit of a hidden feature that only you know about though.
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
I RDP into a VM running WS2012R2 Datacenter (legit copy that I got free) and so I don't get the full height due to double task bars.
Since you brought it up (thank you!), what do you think of that expression?
(Btw, thank you. I'm sure others will discover the F1 feature and start making use of it too.)
Since you brought it up (thank you!), what do you think of that expression?
(Btw, thank you. I'm sure others will discover the F1 feature and start making use of it too.)
Re: Request: Pre-editor editor
Looking at it from far away, looks like a painting. I like the new syntax highlighting. I'd probably be 10x more lines if I formatted it to my liking though.
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
Don't suppose I could get any hints on how to try it out, could I? I downloaded the changes.tar.xz file and 'replaced' the file (renamed it before extracting the file inside) and it says 4.8.4, but F1 isn't working. Or was it not done before the nightly build was done?
I'm guessing the F1 toggle is only in effect while the window is open, and resets when the dialog box is opened again? If so, even though it will be annoying, I think it's a good idea, in case someone toggles it by accident (then they can close and reopen to 'fix' it).
I'm guessing the F1 toggle is only in effect while the window is open, and resets when the dialog box is opened again? If so, even though it will be annoying, I think it's a good idea, in case someone toggles it by accident (then they can close and reopen to 'fix' it).
Re: Request: Pre-editor editor
Sorry, I haven't uploaded a new build for that one, and I won't upload builds in the foreseeable future since everything is broken right now. You'll have to wait for the next major release.
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
:O
How dare you make me wait! lol
Okay that's cool, at least I know it's not a bug or anything like that.
How dare you make me wait! lol
Okay that's cool, at least I know it's not a bug or anything like that.
Re: Request: Pre-editor editor
Next release is in BETA and release packages are available now:
https://get.filebot.net/filebot/FileBot_4.8.5/
https://get.filebot.net/filebot/FileBot_4.8.5/
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
There's a bug in the editor where you can't move up or down if there is a blank line. You have to use the left/right keys to get past it (end of line, right arrow when trying to move down, or start of line, left arrow, to move up).
Edit: Oh and, loving the F1 feature.
Edit: Oh and, loving the F1 feature.
Re: Request: Pre-editor editor
Fck... what strange a bug / behavior... this is gonna take forever...
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
If it helps any, it's almost like it sees the blank line as being the top (or bottom) of the entire expression, thus discarding the up/down arrow input.
Re: Request: Pre-editor editor
Oddly enough, L and R work. It's probably something strange internally in the syntax parser / document model / syntax editor.
Please read the FAQ and How to Request Help.
Re: Request: Pre-editor editor
Yeah I know. Only the up and down arrows are getting discarded/ignored when encountering a blank line.
Still love the F1 feature though.
I'm wondering, is there a way of changing the 'examples' show? Reason I ask is because it would be helpful to be able to put in my own 'examples' to view (when it's toggled on). Like seeing what certain values should be producing, in case I need to view the values without having to go to bindings or add them in to test.
Oh and have fun figuring this bug out, I'm sure you'll be be foaming at the mouth later on like, "WHY IS IT DOING THIS?!?" I know that feeling all too well when trying to figure out why something isn't working right.
Still love the F1 feature though.
I'm wondering, is there a way of changing the 'examples' show? Reason I ask is because it would be helpful to be able to put in my own 'examples' to view (when it's toggled on). Like seeing what certain values should be producing, in case I need to view the values without having to go to bindings or add them in to test.
Oh and have fun figuring this bug out, I'm sure you'll be be foaming at the mouth later on like, "WHY IS IT DOING THIS?!?" I know that feeling all too well when trying to figure out why something isn't working right.
Re: Request: Pre-editor editor
Possibly fixed with r5956.
Please read the FAQ and How to Request Help.