493: My Life is an Edge Case, with TJ Luoma

@tjluoma: As you point out Due comes with different abilities and a friskier attitude than Calendar. I use both.

Due is an app that I needed to live with to appreciate.

2 Likes

When I have a call scheduled, I usually put the phone number on my calendar, in the location or notes field so I can just tap and call. Often, I have conference calls, and I use the format XXX-XXX-XXXX,,YYYYY# where YYYY is the conference code.

I imagine you could do the same thing with a URL. Never tried.

However, putting it in Due has a couple of advantages: If the call is not actually an appointment, then if it’s in Due you don’t have time blocked out.

Also, coolness. :slight_smile:

Great news. I really enjoyed this episode and look forward to your write up on Downie.

$PATH

The biggest issue that I usually run into with Hazel, Keyboard Maestro, and TextBar is that they don’t get my usual PATH from my shell.

Unfortunately macOS no longer has a reliable way to set a PATH which is used by all GUI apps (it used to be possible in a number of different ways over the years, most recently in launchd.conf but that was removed a few years ago, and I don’t think there is a replacement.

I have a file ~/.path which is only one line:

PATH=/usr/local/sbin:/usr/local/di:/usr/local/scripts:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

That way, when I am writing a Hazel / Keyboard Maestro / TextBar script, I can include this line near the top:

source ~/.path

and know that my $PATH will be used, in the order that I want it. If I make any changes to my $PATH, I just need to change that one file, and it will be used everywhere (even my ~/.zshenv gets the $PATH from there, so I’m always sure I’m using the same PATH everywhere).

Of course the other alternative is to use the full path to things, so instead of jq use /usr/local/bin/jq but that gets tedious if you have longer scripts.

printenv

Another useful debugging tip for any of these programs is to use this line:

/usr/bin/printenv | /usr/bin/open -f

that will run the printenv command and send the output to your default text editor. Compare it in Terminal.app vs another app and see what might be missing.

In fact, the open -f “trick” is super-useful for other things as well. For example, try this in TextBar:

curl -s --header "Private-Token: ${GLTOKEN}" \
"http://git.someurl.com/api/v4/merge_requests?state=opened&scope=assigned_to_me" \
| open -f

That will show you what it is getting back. For that matter, you might also just try:

echo "$GLTOKEN"

and make sure that even that is being set properly.

When all else fails: verboseness and error-checking

Finally, if none of that works, well, then your best bet is to write a more elaborate shell script than you wanted to when you started, with more error checking. Something like this, perhaps:

(note that you may have to scroll this content box to see the whole script)

#!/usr/bin/env zsh

PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

URL="http://git.someurl.com/api/v4/merge_requests?state=opened&scope=assigned_to_me"

GLTOKEN='8675309jenny'

TEMPFILE="/tmp/textbar.$RANDOM.txt"

curl -s --header "Private-Token: $GLTOKEN" "$URL" > "$TEMPFILE"

EXIT="$?"

if [[ "$EXIT" != "0" ]]
then
	echo "curl exited badly: $EXIT"
	exit 1
fi

if [[ ! -s "$TEMPFILE" ]]
then
	echo "TEMPFILE is zero bytes!"
	exit 1
fi

	## I'm guessing at the proper syntax for `jq` here, as I'm not sure what 
	## the best way is to have it parse the `$TEMPFILE` we have created 
LENGTH=$(jq length < "$TEMPFILE")

echo "Open MR
Length is $LENGTH 
----
TEMPFILE is $TEMPFILE
"

exit 0

One advantage here is that you can go back and check $TEMPFILE to make sure you are getting the result you expected.

I hope this helps!

2 Likes

I’d really appreciate this as well - I’ve been having a play myself and am struggling to pass the url to Downie in a way that Downie likes :frowning:

1 Like

Here’s my iOS to Dropbox to Downie setup.

1 Like

@tjluoma,

Completely off topic, reading your “about me” on Rhymes with Diploma, I live in a house with two beagle and a basset hound. My wife planted the hound bug in me.

1 Like

I have a few comments about this episode. First, as the episode trails off, I heard you say that “shortcuts was good for spreadsheets ???”, if so, I’d love to know how. I also wanted to say that I agree wholeheartedly on your skepticism of iCloud Drive. It updates when it feels like it, and rarely when you need it to, creates duplicates left and right and as you said, I just don’t trust it…

This is absolutely a great episode! I’m listening to it for the third time.

5 Likes

I don’t remember saying that, so I’d have to go back and listen again to hear what I said and/or might have meant.

(Sorry for the slow response, I didn’t see it until just now.)

Thank you! That’s very nice to hear.

When I hear about some of the other guests and the super-impressive things they’re doing, it can be a bit intimidating because I’m just a guy with a Mac (well, several Macs). So I’m very pleased to hear people enjoyed it.

For some reason I’ve gotten a lot more feedback about this than previous appearances, which is great to know people are listening and enjoying it.

1 Like

I seem to recall you mentioned recording live podcasts, what is the workflow for that?

The easiest live podcast to record is ATP’s livestream, so I’ll use that one as an example.

There is a scheduler in Audio Hijack which can tell it to start a certain “Preset” at a certain time.

ATP usually starts the actual podcast recording around 9pm US/Eastern on Wednesdays. Sometimes (especially during the summer and sometimes around holidays like Christmas) they will record on a different day but they usually stick to the same time.

The other good thing about ATP is that Marco starts the live-stream about 30 minutes before the show (unfortunately he only plays Phish, but that’s another discussion for another day). Since the live-stream is on even before the “show” begins, I have Audio Hijack set to start it’s “ATP Preset” at 8:55pm US/Eastern each night.

The “ATP Preset” opens http://marco.org:8001/listen in VLC.

If the stream is not live, VLC will be launched, but no sound will come out (VLC will throw a harmless error), and no file will be created by Audio Hijack.

If the livestream is live, VLC will start playing the audio. The “ATP Preset” not only launches VLC, but it opens the URL too, and then immediately starts recording VLC’s audio output, and saving it to an mp3 file in a folder such as ~/Music/Audio Hijack/.

Audio Hijack is set to record for 4 hours (which is way longer than any episode of ATP actually runs, but I needed to set some limit on it). However, Audio Hijack is also set to create a new MP3 if there is more than 30 seconds of silence from the ATP livestream (which is how I actually determine when the livestream is over).

Hazel watches ~/Music/Audio Hijack/ for mp3 files which have not changed in 1 minute. Once it finds a file that matches that criteria, it will move the file. The MP3 file that I create from the “ATP Preset” is named such as “ATP 2019-08-16.mp3”. If Hazel finds a matching MP3 that starts with “ATP”, it moves it to $HOME/Dropbox/apps/justcast/ATP/.

JustCast is a service which allows you to create a podcast feed simply by dropping mp3s into a folder. They have paid plans, but their free plan allows for “3 Items in RSS feed” and I don’t really need more than the most recent 3 live episodes. (Especially since, once they are downloaded, episodes wouldn’t be deleted from your podcast app anyway, it’s just how many would be there when signing up to the feed when for the first time.) That said, I pay for an annual subscription, mostly in the hopes that the service won’t be shut down.

A recent addition to this system is that I now have a shell script that can upload to Overcast (I think this is the script that I adapted). As an Overcast subscriber, you can upload files to your own private feed. It’s very fast, and probably negates the need for Justcast. Hazel calls this shell script and uploads the file after moving it.

As for recording other podcasts…

Most of the Relay.fm shows that I listen to will post to Twitter when they are live, so I can launch Audio Hijack and then trigger the “Relay Preset”.

The Relay preset will open http://stream.relay.fm:8000/stream in VLC, save to an MP3, and output to speakers, so I can listen to the show as it is recording. Audio Hijack also has a feature where I can pause live audio which comes in handy if you are interrupted. The recording to MP3 continues, but the sound to the speakers is paused.

Unfortunately, it’s not as easy to “automatically” record those shows, because Audio Hijack version 3 (the current version) lost AppleScript support that was in Audio Hijack Pro version 2, which I used to start Audio Hijack Pro from scripts. Fortunately, my 2007 iMac running El Capitan can still run Audio Hijack Pro, so I use that as needed.

I hope that helps. Let me know if you have other questions!

1 Like

The comment was with 70 seconds left in the podcast. Talking about shortcuts and you say “It’s great for spreadsheets"

@cheekyjeremy I’m interested in that comment also

Ok, so I had to go back and re-listen to figure out what I was talking about.

Leading up to that comment, I shared my secret theory that Tim Cook must love Shortcuts. As I said, I have absolutely no proof of this and yet I believe it completely.

David then mentioned something about “Maybe the Shortcuts team is working on Numbers integration”

In response to that, I was imaging someone trying to convince Tim to try Shortcuts, and their “pitch” would be “It’s great for spreadsheets!” Because obviously Tim uses spreadsheets to track things like “Customer Sat”.

So that’s all it was, a little off-the-cuff joke, which may have made more sense to me than anyone else :wink:

Sounds good. The reason I had asked is that getting data into a spreadsheet (from other sources on the iPad) is my number one pitfall and really serves as an obstacle to allowing myself to be reliant on only the iPad. So, when you said that, I was thinking (hoping) that there was a workaround :slight_smile:

Thanks for the time :slight_smile:
J

1 Like

Just a note that apparently this might be more possible now?

2 Likes

That is super cool. I make shortcuts to add data to Apple Health and appending them to a second, more portable location at the same time will be useful.

Thanks. I’ll need to explore and see if it can be made helpful …