-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI equivalent to GUI's "export tracks" #2310
Conversation
Thanks. FYI, #2258 -Tres |
|
Render is assumed, right? Perhaps just |
@tresf the usage for the flag is |
@@ -124,6 +124,15 @@ ProjectRenderer::ExportFileFormats ProjectRenderer::getFileFormatFromExtension( | |||
|
|||
|
|||
|
|||
QString ProjectRenderer::getFileExtensionFromFormat( | |||
ExportFileFormats _fmt ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all future code added to lmms, arguments should not be prefixed with _
- as I understand, that is an old convention that is being phased out.
Then perhaps we change it. What makes this different from |
In the GUI, loop and other modifiers are options within the export menu, while 'export tracks' is a totally different menu. However that doesn't have to define the CLI interface, I'd be fine with
Thoughts? |
@rcorre I believe your suggestion would require a more intelligent argument parser than what we have currently. The current system expects If it could behave like If anyone wants to do the work to support either the format you used above or the one where all render arguments are given as one |
No objections here either. 👍 |
I checked out your branch, did a The segfault was misleading - it looks like it's due to our rather poor separation between program core and gui - It turned out the actual issue was just that the Also, |
Oops, forgot to tag you @rcorre. |
@Wallacoloo, the trailing slash should definitely be optional, glad you caught that. On a related note, should -o create the output directory if it doesn't exist? It would be convenient and I can't think of a significant risk. |
@rcorre fair points. Maybe just present a syntax error if no As far as implicitly creating the directory goes, I think it would be a good idea to create the deepest node if its parent directory exists. I'm not sure about creating the entire tree (i.e. |
I think any order of options should be OK, as long as there is one non-option argument that refers to a project file. I.e. drop the parameter from the
Hell no. Maybe after dropping the -- part, i.e.
👍 For the exact wording of options my preference is |
@Wallacoloo: I haven't been able to repro the trailing slash issue. I'm using maybe something happened during the rebase? I'll try to get this branch back up to date |
@rcorre Interesting - the problem seems to occur only when the output directory contains a literal ".". For example:
fails with a segfault.
succeeds. The error could very well be in a part of the code not modified by you. My guess would be that the |
The plot thickens... I guess this is the first lmms option to work with a directory argument from the CLI, so I'll have to make sure all the cases are handled -- all the right stuff is probably in QDir/QFile -- I just need to find the right way of applying it. EDIT: |
Currently ProjectRenderer has a helper getFileFormatFromExtension, this adds a similar helper getFileExtensionFromFormat. This will, for example, return "ogg" for OggFile.
Much of the multi-track rendering logic was intermixed with GUI code in ExportProjectDialog. This creates the RenderManager class to provide rendering logic that could be shared between the CLI and GUI interfaces.
Remove the rendering logic from the gui code in ExportProjectDialog and let RenderManger handle it instead. This is part of an effort to allow the CLI and the GUI to share the same rendering logic, setting the state for a --render-tracks CLI option similiar to the "Export Tracks" GUI option.
This command allows rendering each track of a song to a different file. It should provide the same functionality as the "Export Tracks" GUI option. Usage could look like: lmms --render-tracks project.mmpz -f ogg -o output/
Remove the _ prefix from the parameters to the newly added ProjectRenderer::getFileExtensionFromFormat. This naming convention is being phased out.
Follow convention of avoiding '-' in command names.
Do not call baseName on the path passed to -o when using the --rendertracks option. This was mangling directories that contained a literal '.' if a '/' was not explicitly specified at the end. Still call baseName for --render as the argument to -o is a file and we need to set the extension (ogg/wav).
Turns out we were calling I've fixed this and rebased to master. As a side note, the current behavior of
will produce a file named |
// find all currently unnmuted tracks -- we want to render these. | ||
for( auto it = tl.begin(); it != tl.end(); ++it ) | ||
{ | ||
Track* tk = (*it); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, feel free to use range-based iterators, i.e. for (Track * tk : tl) { ... }
. Saves a bit of redundancy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, cool. I didn't even know those existed. I'm not normally a c++ programmer :)
Good call - that'd be best handled as a separate issue. I tested this pretty thoroughly & everything is working as expected on my machine. The code looks fine, so we're good to merge :) Nice work! |
Add CLI equivalent to GUI's "export tracks"
FYI - Next time, we should squash these into a single commit before merging to simplify our commit history. |
duly noted |
The GUI has an "export tracks" option that exports each track to a separate file.
This adds a
--render-tracks
CLI option to enable the same behavior from the command line.In order to do this, I moved much of the rendering logic out of the gui code in
ExportProjectDialog
and into its own class calledRenderManager
.Due to #588,
--render-tracks
will segfault just as--render
does, but the output seems intact.Resolves #2254.