PDA

View Full Version : DGIndex CLI suggestion


stax76
5th September 2009, 22:47
I thought about supporting file names containing commas and had three ideas how to add support:

1.) setting delimiter similar to -SD=

2.) After the commandline was parsed with the current parsing, loop through the arguments, check if the argument is a supported source file and add it as source file if so. The advantage of this method is shell support which is clearly important. Another argument for this method is it's common and good practice that input or output file arguments are passed without a switch.

3.) I wonder why semicolon isn't used as separator, the command shell documentation (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true) says, both comma and semicolon are used as separator for commands. It might be possible to support semicolon without breaking backward compatibility. It would check for semicolon, if there is non it's not clear if it's one file containing a comma or more than one file separated by comma. It's easy to find out which case is true, before splitting by comma making a file exist check.

I'm not a experienced C++ programmer but certainly experienced enough to make a patch so please let me know how I can help.

neuron2
5th September 2009, 23:08
It's all about backward compatibility.

My idea would be to implement a full proper UNIX-like syntax but signal it with an option:

DGIndex -u ...sensible UNIX-like syntax for remaining args...

If the -u is absent, old parsing is used. If it is present, the new sensible UNIX-like parsing is used.

Note that I did not design the current syntax!

stax76
6th September 2009, 00:40
Unix like would be a clear improvement, how can I help?

neuron2
6th September 2009, 00:48
Well if you'd like to start by recasting the CLI definition in a proposed UNIX syntax, that would get things going.

stax76
6th September 2009, 00:55
You mean the documentation?

neuron2
6th September 2009, 00:59
I mean specify the mapping of existing syntax to proposed UNIX syntax. That would certainly form the basis of the documentation. :)

The new syntax would obviously allow for commas in filenames, etc. Hopefully it would allow for use of a standard parsing package.

stax76
6th September 2009, 12:31
1:1 mapping not changing any switch would be:


Set Delimiter -SD=delimiter character obsolete
Input Files -IF=[file1,file2,...] -if file1 file2 ...
Auto-Input Files -AIF=[file1] -aif file1
Batch Files -BF=[filelist] -bf filelist
Project Range -RG=f1/off1/f2/off2 -rg f1/off1/f2/off2
Audio PID -AP=audioPID -ap audioPID
Video PID -VP=videoPID -vp videoPID
PCR PID -PP=pcrPID -pp pcrPID
iDCT Algorithm -IA=algorithm -ia algorithm
Field Operation -FO=field operation -fo field operation
YUV->RGB -YR=method -yr method
Track Number -TN=track(s) -tn track(s)
Output Method -OM=method -om method
Dynamic Range Control -DRC=amount -drc amount
Dolby Surround Downmix -DSD=on/off -dsd on/off
Downsample Audio -DSA=method -dsa method
Output File -OF=[project file] -of project file
Output File and Demux -OFD=[project file] -ofd project file
AVS Script Generation -AT=[AVS template file] -at "AVS template file"
Exit -EXIT -exit
Minimize -MINIMIZE -minimize
Hide -HIDE -hide
Preview -PREVIEW -preview



You prefer a short syntax so you probably want to shorten some switches. Many people prefer a verbose syntax however so supporting two versions could be considered, -i, -input for instance.

Would the new CLI give a error message for unrecognized switches? Currently integers are used as arguments to switches, what do you think about using strings instead? What is 'standard parsing package' btw.

neuron2
6th September 2009, 14:07
Would the new CLI give a error message for unrecognized switches? Of course.

Currently integers are used as arguments to switches, what do you think about using strings instead? Example?

What is 'standard parsing package' btw. See here:

http://www.gnu.org/s/libc/manual/html_node/Getopt.html

stax76
6th September 2009, 14:38
DRC for instance has the options off, light, normal, heavy so using strings here would look like:

-drc normal

It makes only sense using simple and short words so it's not suitable for switches with more complex options.

neuron2
6th September 2009, 15:20
OK. I'm looking for a usable getopt() implementation.

kemuri-_9
6th September 2009, 16:02
OK. I'm looking for a usable getopt() implementation.

check the extras folder in the x264 repository.

neuron2
8th September 2009, 23:57
I implemented my own parser so I can use it elsewhere without GPL concerns.

@stax76

I have it all ready to go. Just one question before I give it to you for testing. Do you need the AIF function? I prefer to omit it if possible in the UNIX-STYLE cli.

stax76
9th September 2009, 00:31
Awesome. I don't need AIF. Regarding how to decide if the old or new syntax is present, it should be easy to detect this with a simple function like this:


Function IsOldSyntax(ByVal commandLine As String) As Boolean
Dim oldSwitches = "-aa= -bb= -cc=".Split(" ")

For Each i In oldSwitches
If commandLine.ToLower.Contains(i.ToLower) Then
Return True
End If
Next
End Function


It simply checks if the command line contains one of the old switches.

neuron2
9th September 2009, 04:06
Here is DGIndex 1.5.6 beta 1. It adds the new optional CLI syntax and is now compiled with Visual Studio 8. The zip file contains a description of the new CLI syntax. Note that it is also fully compatible with the old syntax.

http://neuron2.net/dgmpgdec/dgindex156b1.zip

Test results and any suggestions will be appreciated.

stax76
9th September 2009, 05:39
Works fine :) , I noticed a log file I've not seen before, maybe you can add a switch to define it's location though it can easily be moved by an fronted (fronteds usually put every file they create in a temporary directory).

neuron2
9th September 2009, 05:43
The log file follows the output file location. Is that unsatisfactory?

stax76
9th September 2009, 06:04
It was in the source dir I think, output dir is perfect but frondends also create log files and use numerous applications and many create even more log files so confusion and conflicts can be avoided by using a file name containing the name of the application created the log file or the purpose of the log file, example: *_DGIndex.log.

neuron2
9th September 2009, 06:06
But nothing has changed viz-a-viz the log file. Why is it suddenly not acceptable? I've never heard one complaint of collisions or confusion. And don't forget normal invocation also makes log files, so if this was a real issue surely we'd have heard a report about it. Don't get me wrong, I appreciate suggestions, but they need to have some basis in actual experience, because I have limited time for coding.

BTW, -of is changing to -o, and -ofd to -od.

buzzqw
9th September 2009, 08:09
-AIF is still a useful options. Very handy for automatic loading of vobs (and used in many GUI using DGIndex)

i hope -AIF will be present in future update

BHH

The Scientist
9th September 2009, 09:37
i hope -AIF will be present in future updateI second that please....

stax76
9th September 2009, 13:00
I thought the log file creation is new, I've never seen such a log file before!

neuron2
9th September 2009, 14:39
-AIF is still a useful options. Very handy for automatic loading of vobs (and used in many GUI using DGIndex)

i hope -AIF will be present in future update
Added in beta 2:

http://neuron2.net/dgmpgdec/dgindex156b2.zip

stax76
9th September 2009, 15:01
Thanks for the new beta. I think I found some issue, I hope you can reproduce it. When I use DGIndex normally (not CLI) the log file is saved in the source dir (where the VOB file is) and not in the target dir (where the d2v/AC3 files are). When I use the CLI it don't create a log file now (log file and full paths are enabled in the menu). My cmdl:

"D:\Projekte\StaxMedia\trunk\StaxRip\bin\Applications\DGIndex\DGIndex.exe" -i "E:\Samples\DVD\Pulp Fiction\VTS_01_1.VOB" -ia 2 -fo 0 -yr 1 -tn 1 -om 2 -drc 2 -dsd 0 -dsa 0 -o "E:\Samples\DVD\Pulp Fiction\VTS_01_1 temp files\VTS_01_1" -minimize -exit

neuron2
9th September 2009, 15:40
Thanks for pointing that out. I fixed it and refreshed the beta 2 upload.

Kurtnoise
9th September 2009, 15:48
Still no way to have delimiters via command line ?

neuron2
9th September 2009, 15:50
You mean for the new syntax? If so, there is no need for delimiters anymore. That's one of the reasons for doing it.

If old syntax, you can already do it (-SD=).

Please clarify.

Kurtnoise
9th September 2009, 15:58
Sorry for confusion, I meant this:

http://uppix.net/c/2/0/94720a0c44c27679107d4685e47ee.png (http://uppix.net/c/2/0/94720a0c44c27679107d4685e47ee.html)

to be able to control the start/end points via command line...

neuron2
9th September 2009, 16:03
It's already there:

-rg

Kurtnoise
9th September 2009, 16:06
doh! didn't know that....

:thanks:

stax76
9th September 2009, 17:21
This could be used then to skip cells in the beginning not containing audio, does anybody know what's the easiest way to do this?

stax76
9th September 2009, 18:12
The log file follows the output file location. Is that unsatisfactory?

I tried the latest beta using the CLI and the log file was still saved in the source file location and not in the output file location.

neuron2
9th September 2009, 18:46
Yes, I misspoke. It stays with the source file.

stax76
9th September 2009, 20:19
I can move it, everything fine as far as my application is concerned, big thanks making everything possible.

neuron2
9th September 2009, 20:59
This could be used then to skip cells in the beginning not containing audio, does anybody know what's the easiest way to do this? I don't think there's an easy way. I added this option under protest, not understanding how it could be used. :)

stax76
9th September 2009, 21:07
Who has requested it?

neuron2
9th September 2009, 21:11
Oh gosh, it's in one of the development threads. Does it matter?

If it's the leading black gops that cause you a problem, I'd rather fix that automatically within DGIndex. But again, priorities, priorities...

stax76
9th September 2009, 21:45
The issue is some VOBs cause sync issues unless you cut some some stuff in the beginning, it happens with DVDs from certain studios putting some crap in the beginning. The most common way to fix it is cut it off using DVD Shrink, DVD Decrypter would also help but it's not useful any longer without AnyDVD. Trim it with DGIndex might cause problems with subtitles loosing sync but I'm not sure. I don't have a sample file but if you are interested I can upload one as soon as a have one.

neuron2
9th September 2009, 21:50
I'm well aware of the issue!

With DGIndex, you step in a few GOPs and then hit [.

stax76
9th September 2009, 22:07
I think this will cause subtitles loosing sync unless you are at the proper position but how would you know where the position is? Unfortunately I don't have much experience with the issue because I don't backup that many DVDs and NEVER use subtitles.

stax76
12th September 2009, 21:21
Yes, I misspoke. It stays with the source file.

What happens when the source location is write protected? ;)

Monamona
28th October 2009, 11:40
As I mentioned in another thread, with -RG option, please make easily specify the last position of movie
because it is hard to know its address in advance.
Ex. -RG 0,0,0,-1 -> process from the beginning to the end.

Also, it is very useful if -RG option can be used with the number of GOP instead of address.
Since, it is also pretty difficult to obtain the address of a certain GOP/frame.
Ex. -RG 0,5,0,7 -> process from 5th GOP(or frame) to 7th one.

I greatly appreciate your continuous effort to develop such a nice program.