make it easier to convert the audio-files

Discuss and share scripts and script files...
suslo
Posts: 178
Joined: 02 Feb 2015 05:02

make it easier to convert the audio-files

Post by suslo »

in march-2015 i began to create an absolutely essential (for me) script,
allowing to convert flac-files (since july-2019 - wav-files) from 'tracks' to 'images'
('images' means: 1 cue-file, and 1 wav-file containing all the tracks)

in the beginning, this script/approach was very raw, and it was much like semi-automatic (but honestly, it was mainly manual),
there were dozens of nuances which i cannot recollect/explain in details anymore, because a lot of time has passed
but as i vaguely remember: it contained as much as 32-33 tiny/small/medium steps, written by hand in the paper,

and now, in 2020-2023, it's something like 1-2-3-4 steps, depending on an approach for the calculation,
i mean, for instance, if we don't count a pair of important manual 'safety belts', then the quantity of steps is probably 1 or 2,
           and the whole task is done by several different scripts
           (including an ''auto it''-code, which i need to convert to ahk but don't know how),
           mainly by xyplorer's 2 special scripts: the 1st of them calls the 2nd, at some specific point
(so these few steps directly involve the xyplorer's possibilities:
in that way i use them since april-2018, and they really change for the better the whole scheme)

in the years 2015-2020: the script was constantly in the process of improvement/reconsidering/optimizing...

in the years 2020-2023: the script is (in fact) nearly completely ready, optimized, and at 99,9% reliable
(and yes, i try to fight with those 0,1%, from time to time, when some negative aspect emerges)

 
 
i lean towards a view that the script itself (which is mainly divided into 2 different parts, inside xyplorer's ''UDC'' section)
is not very interesting to all of you,
so here in this thread i just ask for the help in a quite modest aspect (directly related to the whole process of convertion):

1. for example, in 1 of my custom context menus, i have the following line:         <get "path">

2. (in the next line) is it possible to create a XY-script?:
a script that only displays 1 of 2 short texts (depending on the content of an active folder):         Ready      Not Ready

3. the note Ready should be present in a very specific cases only,
it's difficult to enumerate them all right away, but in this post i'll try to do it, at least mostly
(and i apologize in advance, in case i'll have to add some item later):

(inside the folder) there may be different situations:
easier (wav-files only), harder (1 or several textual files may be present too) (the txt or cue extensions only)

 
 
speaking about easier situations (it's circa 98% of cases):

- if there's 1 file, it must begin with 5 symbols (01 - )                      i mean: 0 1 space hyphen space

- if there are 2 files, the 1st must begin with 5 symbols (01 - )
and the 2nd must begin with 5 symbols (02 - )

- if there are 3 files, the 1st must begin with 5 symbols (01 - )
and the 2nd must begin with 5 symbols (02 - )
and the 3rd must begin with 5 symbols (03 - )

and so on (up until 99)

- the 3rd symbol is space (always)
- the 4th symbol is hyphen (always)
- the 5th symbol is space (always)
- the last 4 symbols are:       .wav       (always)

 
speaking about harder situations:
as i can understand right now, the txt-file/files should not be taken into consideration (by the script)
(in the majority of cases: there will be just 1 txt-file called 1.txt)

i'll try to answer any possible questions, i'll try to help you help me,
i also may try to write some easy parts of the script myself, but my coding skills are very-very limited,
while the main idea of this script is that it must be really reliable
(and it's worth noting that i don't even know where to start)

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: make it easier to convert the audio-files

Post by highend »

;TLDR

(and if I would: no clue what you actually want)...

And additionally: I have no clue why it should be difficult to write a script that converts <something> to <something else> (as long as ffmpeg is used)...
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: make it easier to convert the audio-files

Post by suslo »

TLDR
i hope that you'll find the right mood/time to actually read the lines (that took me more than 150 minutes to compose/prepare)
no clue what you actually want)...
that's probably because you didn't read (attentively) (or at all)

 
the very short (not complete) version is:
- a xy-script is needed (which, in my custom xy's context menu, only indicates 1 word: if conditions are right)    (or 2 words: if conditions are wrong)

- conditions are right if:          in active folder:
a) the first 5 symbols (in titles of wav-files) (from the first wav-file to the last) are:    "01 - ",    "02 - "    ...    "99 - "

b) the last 4 symbols (in each line/file) are:     .wav

           (there are more complicated cases, when a txt-files/file is present too
            but at first: let's focus on the easier part, the part when there are wav-files only)

 
I have no clue why it should be difficult to write a script that converts <something> to <something else>
- this topic is about completely different thing. please try to read it.
          i mean, the problems (related to a conversion itself) are only described here to give the reader a general understanding of what i speak about

- you have no idea about the huge quantity of important nuances/details... that were/are present:
   when you really do something seriously, and if you certainly know what's right and what's wrong, and what exactly should be done to make it right

 
as long as ffmpeg is used
it is not used            (foobar is used) (notepad2 is used) (a special auto-it script is used) (xy's scripting capabilities are used)

Horst
Posts: 1093
Joined: 24 Jan 2021 12:27
Location: Germany

Re: make it easier to convert the audio-files

Post by Horst »

I have the same problem as Highend with your postings.
They are very long and I still can't understand what a script should do ?
Something is wrong if you are not able to describe the real conversion in a few lines.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: make it easier to convert the audio-files

Post by highend »

Code: Select all

/*
2 folders

D:\Temp\test_wav_correct
01 - this is file one.wav
02 - this is file two.wav
99 - this is file ninetynine.wav

D:\Temp\test_wav_incorrect
01 - this is file one.wav
02 - this is file two.wav
97- this is file ninetyseven.wav
99 - this is file ninetynine.wav
*/

    // Mutually enable one of these two entries and in YOUR script, you'd probably just use <curpath>...
    $somePath = "D:\Temp\test_wav_correct";
    // $somePath = "D:\Temp\test_wav_incorrect";

    $files   = listfolder($somePath, "*.wav", 4, <crlf>);
    $matches = regexmatches($files, "^\d{2} - .+?(?=\r?\n|$)", <crlf>);
    $placeholder = "Incorrect, show these two words";
    if ($files == $matches) { $placeholder = "Correct, show this one word"; }
    text $placeholder;
And what would you do with this code?
Run it before displaying the menu (ofc without using text^^ and inside the menu string put that variable $placeholder into the necessary line...

And if this is the correct answer, the whole first post could have been reduced to one simple question: Is it possible to show a specific text (based on condition) in a popup menu?
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: make it easier to convert the audio-files

Post by suslo »

I still can't understand what a script should do ?
1) make it easier to begin the process of converting
by doing 3 checks automatically, instead of my constant tedious visual control:

check-1 is: all titles of wav-files must begin (sequentially) with 2 symbols:         01, 02, 03, 04 ... 99
check-2 is: symbol-3 is always the space, symbol-4 is always a hyphen, symbol-5 is always the space
check-3 is: the end is always the 4 symbols:     .wav

2) just display (in my custom context menu) either the Ready word, or the Not Ready words
so that i knew if it's safe to launch my script (that converts the files), or not

currently, this custom context menu has (among other numerous lines) the following 2 lines:

Code: Select all

"<date ddd      yyyy mm dd   hh nn ss>" run '"D:\Programs\Time.cpl"'
<get "path">
the plan is to add the third line/lines (near these 2 lines),
and this third line is the script from this thread (if/when it is ready)

 
And what would you do with this code?
i'll just add it to my already existing UDC/script (#1490), as described slightly above,
and at first, i erroneously tried to do it like this:

Code: Select all

$somePath = <curpath>;
    $files   = listfolder($somePath, "*.wav", 4, <crlf>);
    $matches = regexmatches($files, "^\d{2} - .+?(?=\r?\n|$)", <crlf>);
    $placeholder = "Not Ready";
    if ($files == $matches) { $placeholder = "Ready"; }
    text $placeholder;
but later i understood that the scripting command "text" should be substituted for something else
(because "Ready" or "Not Ready" must be displayed as 1 line inside the context menu)

 
Run it before displaying the menu
(in this case) the menu is only needed to actually display the "Ready" or "Not Ready" text (it's for the sake of speed/conveniency, -
after all, i don't even have to press any keyboard button, or click any mouse button, to invoke that custom context menu),

ideally, if i see the "Ready" text,
i only need to press 1 special keyboard button (MX10) that launches the process of converting
(i don't even have to close the context menu: it simply disappears itself, after i press the MX10 button)

so it seems that i can't (and also don't need to) "Run it before displaying the menu"

and the question is: what is the nuance that i need to understand/do to begin testing this code? (using the context menu)
(the command "text" is useless here)

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: make it easier to convert the audio-files

Post by highend »

Em...

Everything necessary was inside the script to implement the functionality^^

Code: Select all

    // Your script before this part...

    $placeholder = "Not Ready";
    $files       = listfolder(<curpath>, "*.wav", 4, <crlf>);
    if ($files) {
        $matches = regexmatches($files, "^\d{2} - .+?(?=\r?\n|$)", <crlf>);
        if ($files == $matches) { $placeholder = "Ready"; }
    }

    $menu = <<<>>>
Line 1
$placeholder
Line 3
Line ...
    >>>;

    $sel = popupmenu($menu, 6:=<crlf>, 7:="|");

    // Rest of your script...

One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: make it easier to convert the audio-files

Post by suslo »

highend,
1) this variant doesn't work:

Code: Select all

    $placeholder = "Not Ready";
    $files       = listfolder(<curpath>, "*.wav", 4, <crlf>);
    if ($files) {
        $matches = regexmatches($files, "^\d{2} - .+?(?=\r?\n|$)", <crlf>);
        if ($files == $matches) { $placeholder = "Ready"; }
    }
    $menu = <<<>>>
$placeholder
    >>>;
    $sel = popupmenu($menu, 6:=<crlf>, 7:="|");
2) thank you for your attention to this thread, but i give up

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: make it easier to convert the audio-files

Post by highend »

Aha. And what exactly doesn’t work?
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: make it easier to convert the audio-files

Post by suslo »

And what exactly doesn’t work?
if i change these 2 working lines (they are in the end of my custom context menu):

Code: Select all

"<date ddd      yyyy mm dd   hh nn ss>" run '"D:\Programs\Time.cpl"'
<get "path">
to this code:

Code: Select all

"<date ddd      yyyy mm dd   hh nn ss>" run '"D:\Programs\Time.cpl"'
    $placeholder = "Not Ready";
    $files       = listfolder(<curpath>, "*.wav", 4, <crlf>);
    if ($files) {
        $matches = regexmatches($files, "^\d{2} - .+?(?=\r?\n|$)", <crlf>);
        if ($files == $matches) { $placeholder = "Ready"; }
    }
    $menu = <<<>>>
$placeholder
    >>>;
    $sel = popupmenu($menu, 6:=<crlf>, 7:="|");
<get "path">
...then no changes are present in context menu

i certainly do something wrong but currently i don't know where is my mistake

i may only suppose that the code is either not ready, or is placed incorrectly, or its lines are in wrong order
(for example, if i understand correctly, the $sel is assigned to something strange, and moreover: it leads nowhere / it's not used further)

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: make it easier to convert the audio-files

Post by highend »

oOOo

You can only resolve xy native variables for captions in such a multiline script^^
The help file mentions this!

Convert your script into the format: caption|data|icon|state
and put it into the $menu = <<<>>> ... >>>; block
Takes 2 minutes (or even less)^^

E.g.:

Code: Select all

"<date ddd      yyyy mm dd   hh nn ss>" run '"D:\Programs\Time.cpl"'
<get "path">
=>

Code: Select all

<date ddd      yyyy mm dd   hh nn ss>|run '"D:\Programs\Time.cpl"'
<get "path">
Which would finally result in something like this:

Code: Select all

    $placeholder = "Not Ready";
    $files       = listfolder(<curpath>, "*.wav", 4, <crlf>);
    if ($files) {
        $matches = regexmatches($files, "^\d{2} - .+?(?=\r?\n|$)", <crlf>);
        if ($files == $matches) { $placeholder = "Ready"; }
    }

    $menu = <<<>>>
<date ddd      yyyy mm dd   hh nn ss>|run '"D:\Programs\Time.cpl"'
$placeholder
<get "path">
    >>>;
    $sel = popupmenu($menu, 6:=<crlf>, 7:="|");
    if ($sel) { load $sel, , "s"; }
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: make it easier to convert the audio-files

Post by suslo »

Convert your script into the format: caption|data|icon|state
i'll think about it slightly later

while now i just want to let you know that i did a tiny test of your script      (using the 'menu - scripting - run script')
and it turned out that even the main functionality isn't working

this is the script:

Code: Select all

$somePath = <curpath>;
    $files   = listfolder($somePath, "*.wav", 4, <crlf>);
    $matches = regexmatches($files, "^\d{2} - .+?(?=\r?\n|$)", <crlf>);
    $placeholder = "Not Ready";
    if ($files == $matches) { $placeholder = "Ready"; }
    text $placeholder;
example:
1) there are 11 wav-files (all of them are checked visually, they are all prepared, the script displays "Ready", so everything's ok)

2) in order to test, i renamed the last file so that its beginning became       "12 - "     (not "11 - ")
but the script displays "Ready" anyway
while the list of wav-files is obviously not ready anymore,

and this condition was mentioned earlier in the thread:
all titles of wav-files must begin (sequentially) with 2 symbols: 01, 02, 03, 04 ... 99

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: make it easier to convert the audio-files

Post by highend »

and this condition was mentioned earlier in the thread
You mean in that non-formatted wall of text?

Add a counting loop to that part that checks if each next value is the last one + 1?
One of my scripts helped you out? Please donate via Paypal

suslo
Posts: 178
Joined: 02 Feb 2015 05:02

Re: make it easier to convert the audio-files

Post by suslo »

You mean in that non-formatted wall of text?
i mean the short 3rd line in this post

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: make it easier to convert the audio-files

Post by highend »

Wow. It occurs in the middle of the full page of this whole thread (and not even in the initial post^^)...

I'm not your babysitter (and it seems you need one) and I've wasted enough time on this :blackstorm:
One of my scripts helped you out? Please donate via Paypal

Locked