Switch for macOS Catalina/Linux (former cr2hdr.app)

Started by Danne, May 05, 2015, 04:32:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Danne

We just managed to execute Switch main command from xcode gui. That doesn't mean it's ready by no means. But it works. When there is something useful I put it out. Meanwhile it would be interesting to know what is considered more useful in Switch? There is quite a lot of processes to choose from...

Lars Steenhoff

For me

1 Proxy workflow that cuts the black frames from the h264 is very useful. ( and adds WAV to the dng folder )
2 Getting the best mlv to dng conversion. ( black frame averaging etc)

Danne

Agreed Lars. Let's stick to those features and skip the rest. At least for now.

Wayne H

Really looking forward to this switch app with a GUI, Tried using the normal switch app, but could never really figure it out (user error) lol. Great work Danne and Co.

Danne

Switch now skips the intermediate step asking for crop_rec when running footage from cameras with focus pixels. That is, it must find the RAWC metadata or else you'll get the queries again.
Thanks to A1ex and g3gg0. RAWC has been in there for a while...

Teamsleepkid

EOS M

DeafEyeJedi

More like a great save by @Danne!

Kudos out to @a1ex & @g3gg0!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

smasry

I have a problem running Switch. I'm running it on macOS Sierra, installed by just moving it to /Applications as directed. As far as I can tell from the original post on the thread, there are no othe

Running it, I get the pop-up window asking for the source folder, as expected. then this:


ls: /tmp/DUALISO/crop_rec?: No such file or directory
ls: /tmp/DUALISO/RAW_demolish: No such file or directory
ls: /tmp/DUALISO/what_cam_lock: No such file or directory
/Applications/Switch.app/Contents/Menu.command: line 1976: syntax error near unexpected token `>'
/Applications/Switch.app/Contents/Menu.command: line 1976: `    exec &> >(tee -a "$(cat /tmp/DUALISO/samples | head -1 | cut -d "." -f1)"_samples/"$(cat /tmp/DUALISO/samples | head -1 | cut -d "." -f1)"_LOG.txt >&2 )'

[Process completed]


...as well as a forever-spinning gear icon in the menubar, displaying as 80% completed.

Needless to say, there is no crop_rec?, RAW_demolish, what_cam_lock or samples in /tmp/DUALISO/.

What there is, is:


ls -l /tmp/DUALISO
total 32
-rw-r--r--  1 sacha  wheel  26 11 Nov 12:21 DBG_path
-rw-r--r--  1 sacha  wheel   1 11 Nov 12:21 DUALISO
-rw-r--r--  1 sacha  wheel   0 11 Nov 12:21 MOD
-rw-r--r--  1 sacha  wheel   0 11 Nov 12:21 fpss
-rw-r--r--  1 sacha  wheel   0 11 Nov 12:21 image_size
-rw-r--r--  1 sacha  wheel  32 11 Nov 12:21 path_1
-rw-r--r--  1 sacha  wheel  35 11 Nov 12:21 path_2
-rw-r--r--  1 sacha  wheel   0 11 Nov 12:21 what_cam.txt


To be honest, I haven't tried to debug the Menu.command file, but I ask if anyone has had this problem, before I try to read through the file looking for where it fails.

Thanks.

Danne

Thanks for posting about your issue. Does the problem occur when double clicking Switch? What happens if you drag a folder onto Switch?
You can place Switch wherever. Not necessary to run it from applications folder. I should change that description part.


You can also try erasing the tee command which seems to be causing this issue. I think it can be fixed with another syntax. Had this issue when trying it in a gui project.
By the way. Is your terminal set working bash per default? Could be related to this as well. If erasing the tee command fixes it the issue will probably occur in two more places. We'll see.
The menu.command is located inside contents folder within Switch.

smasry

Hi Danne,

It's the exact same error if I drag into Switch.

Commenting out the line brings me to another error further down (another tee command):


/Applications/Switch.app/Contents/Menu.command ; exit;
ls: /tmp/DUALISO/crop_rec?: No such file or directory
ls: /tmp/DUALISO/RAW_demolish: No such file or directory
ls: /tmp/DUALISO/what_cam_lock: No such file or directory
/Applications/Switch.app/Contents/Menu.command: line 2751: syntax error near unexpected token `>'
/Applications/Switch.app/Contents/Menu.command: line 2751: `    exec &> >(tee -a "$(cat /tmp/DUALISO/samples | head -1 | cut -d "." -f1)"_samples/"$(cat /tmp/DUALISO/samples | head -1 | cut -d "." -f1)"_LOG.txt >&2 )'

[Process completed]


Commenting out line 2751 does actually take me to the menu, where everything appears to work - I'm testing to see if there are any obvious problems.

And, yes, very good question, I've changed my shell to zsh, I haven't tried it in Bash and expect that it will work since you've tested exclusively in Bash, right?

Thanks

Danne

Yes, it's most likely an issue with zsh and I havn't bothered to fullproof it but I'll check into some bash fix even if set to zsh.
Thanks for sharing info here.

smasry

Yes it must be (an issue with zsh). I can't see why without testing, since all of the commands on those lines work independently. Perhaps the problem is in the piping, routing or in character escaping. In either case, I'm not wedded to zsh, so it's a non-issue.

I've run a complete test on a Dual-ISO file (interlaced), and Switch works just fine, creating the expected .dng files, then going over them all, applying a1ex's algorithm and renaming them to .DNG files.

The only trouble I've run into is where the process fails, and it's whenever the camera is pointed at a very bright light source. Then the files are left untouched. I suspect this is no different to the camera going into panic when in 14-bit lossless, at ISO 100, and it's pointed at a very bright scene which it can't adequately compress.

Thanks again for the quick help, Danne.

DeafEyeJedi

5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Danne

Thanks deafeyejedi.

I updated Switch with the latest changes to cr2hdr from here:
http://www.magiclantern.fm/forum/index.php?topic=7139.msg194062#msg194062

If testing check for flicker(or the absence of it)


Lars Steenhoff

Hi small update to the GUI has been done,

now its possible to select input folder and output folder, I'm now going to investigate how to connect the buttons in the gui the to switch command for input and output.

https://bitbucket.org/Dannephoto/switch_gui/overview

https://vimeo.com/246417987

Danne

Looking good Lars. Since you managed to select both input and output folders it should be fairly easy to send the paths to a specific location like in Switch. Try following:

1 - After input folder is selected have xcode write a file with the actual input path and send the file accordingly:
mkdir -p /tmp/DUALISO #creates the path directory
echo $PWD > /tmp/DUALISO/path_1 #sends the current directory to a file called path_1


2 - do the same for the selected output path but send it accordingly:
echo $PWD > /tmp/output #sends output directory to a file named output

We now have both input and output set as in Switch. Both examples needs you to be inside the actual folder you selected(that´s what echo $PWD does, it gets the current directory path).
There is one more location that needs to be set in this application for it to be stand alone. We need to know where to find the binaries and subscripts. For that to work in automator there are a lot of roundtripping to be done so I´m thinking there are better ways for this in xcode. In Switch itself all scripts and binaries are located inside the Contents folder.

Question. Do you need the Select Input Folder button? Wouldn´t the buttons Input Folder and Output Folder be sufficient?

Lars Steenhoff

Right now the input code is like this:

on inputfolder_(sender)
       
        choose folder
        quit
       
    end inputfolder_



https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/PromptforaFileorFolder.html

If I look at the dev docs I see what is returned is for example
--> Result: alias "Macintosh HD:Users:yourUserName:Desktop:"

I think I need to add the result to a variable and then write the variable result to the switch folder right?



Danne

Will this write path_1?

Quote from: Lars Steenhoff on December 08, 2017, 01:28:18 PM

on inputfolder_(sender)
       
        choose folder
do shell script "/bin/bash -s <<'EOF'
mkdir -p /tmp/DUALISO
echo $PWD > /tmp/DUALISO/path_1
EOF"
        quit
       
    end inputfolder_


Or this?
Quote from: Lars Steenhoff on December 08, 2017, 01:28:18 PM

on inputfolder_(sender)
       
        choose folder

        quit
do shell script "/bin/bash -s <<'EOF'
mkdir -p /tmp/DUALISO
echo $PWD > /tmp/DUALISO/path_1
EOF" 
    end inputfolder_


What we´re doing is putting in shell scripts inside apple scripts inside xcode :P

Lars Steenhoff

The quit command was not needed as it just quits the app  :o
I tried this :

    on inputfolder_(sender)
       
        choose folder
        do shell script "/bin/bash -s <<'EOF'
        mkdir -p /tmp/DUALISO
        echo $PWD > /tmp/DUALISO/path_1
        EOF" 
    end inputfolder_


And got this:

Quote-[AppDelegate inputfolder:]: /bin/bash: line 3: EOF: command not found (error 127)

Lars Steenhoff

Then I tried to put it in brackets and got this

QuoteClass FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fff87bdfb68) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x114496cd8). One of the two will be used. Which one is undefined.

    on inputfolder_(sender)
       
        choose folder
        --do shell script ("/bin/bash -s <<'EOF'mkdir -p /tmp/DUALISO echo $PWD > /tmp/DUALISO/path_1 EOF")
       
    end inputfolder_


Danne

Sounds good. Gonna be limited access this weekend but will check in from time to time. Good luck Lars.

Danne


Lars Steenhoff

Great to have estimates on percentage and time, It will be good to tap into those for the gui too

Danne

I think so too. Just added some auto adjustments while processing to the code so that time estimation will stay closer to the truth.
https://bitbucket.org/Dannephoto/switch/commits/4a0093889fa0132f14e7eb7ec7d36a1bce9e10a6