Author Topic: Switch for macOS Catalina/Linux (former cr2hdr.app)  (Read 194980 times)

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #350 on: October 17, 2017, 05:12:08 PM »
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

  • Senior
  • ****
  • Posts: 473
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #351 on: October 17, 2017, 06:29:59 PM »
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

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #352 on: October 17, 2017, 08:24:19 PM »
Agreed Lars. Let's stick to those features and skip the rest. At least for now.

Wayne H

  • New to the forum
  • *
  • Posts: 45
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #353 on: October 18, 2017, 10:12:15 PM »
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

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #354 on: October 20, 2017, 01:01:03 AM »
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

  • Member
  • ***
  • Posts: 248
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #355 on: October 20, 2017, 06:56:52 PM »
thats really great. nice move
EOS M

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3411
  • 5D3 | M1 | 7D | 70D | SL1 | M2 | 50D
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #356 on: October 20, 2017, 07:56:56 PM »
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

  • New to the forum
  • *
  • Posts: 33
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #357 on: November 11, 2017, 01:26:07 PM »
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:

Code: [Select]
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:

Code: [Select]
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

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #358 on: November 11, 2017, 04:08:04 PM »
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

  • New to the forum
  • *
  • Posts: 33
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #359 on: November 11, 2017, 09:52:08 PM »
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):

Code: [Select]
/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

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #360 on: November 11, 2017, 10:15:13 PM »
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

  • New to the forum
  • *
  • Posts: 33
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #361 on: November 11, 2017, 11:50:29 PM »
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

  • Hero Member
  • *****
  • Posts: 3411
  • 5D3 | M1 | 7D | 70D | SL1 | M2 | 50D
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #362 on: December 04, 2017, 06:05:22 PM »
Thanks for the update, @Danne!  ;)
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #363 on: December 05, 2017, 04:09:59 PM »
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

  • Senior
  • ****
  • Posts: 473
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #364 on: December 08, 2017, 11:20:57 AM »
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


Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #365 on: December 08, 2017, 01:15:00 PM »
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:
Code: [Select]
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:
Code: [Select]
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

  • Senior
  • ****
  • Posts: 473
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #366 on: December 08, 2017, 01:28:18 PM »
Right now the input code is like this:

Code: [Select]
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

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #367 on: December 08, 2017, 01:43:36 PM »
Will this write path_1?


Code: [Select]
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?

Code: [Select]
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

  • Senior
  • ****
  • Posts: 473
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #368 on: December 08, 2017, 03:32:24 PM »
The quit command was not needed as it just quits the app  :o
I tried this :

Code: [Select]
    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

  • Senior
  • ****
  • Posts: 473
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #369 on: December 08, 2017, 03:35:32 PM »
Then I tried to put it in brackets and got this

Quote
Class 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.

Code: [Select]
    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

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #371 on: December 08, 2017, 05:34:52 PM »
Sounds good. Gonna be limited access this weekend but will check in from time to time. Good luck Lars.

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #372 on: December 11, 2017, 03:44:10 PM »
New version uploaded

- added a time estimation notifier along with the percentage counter.
https://bitbucket.org/Dannephoto/switch/commits/04f46bb1147f177155904208dbc8fc09525dfe9f


Lars Steenhoff

  • Senior
  • ****
  • Posts: 473
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #373 on: December 12, 2017, 11:07:29 AM »
Great to have estimates on percentage and time, It will be good to tap into those for the gui too

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7655
Re: Switch for macOS Sierra/Linux (former cr2hdr.app)
« Reply #374 on: December 12, 2017, 11:16:48 AM »
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