Register
Results 1 to 9 of 9
  1. #1

    Auto-updating The Undermine Journal addon, OS X edition

    Hi!

    Having seen the threads about updating the undermine journal addon with Windows 7, I figured I'd share with you guys what I do on OS X. It's just a short shell script, with Automator, iCal, and (optional) growl notifications. All you're doing is setting iCal to have a repeating event with a script that runs at that time!

    A quick disclaimer.. it works for me! But seriously, it's not fancy, and it won't catch and correct errors. Please don't blame me if something explodes or the ghost of Steve Jobs materializes and punches you in the neck. Also, I'm using Lion / 10.7.4 and can't speak for Mountain Lion or other versions.


    Script

    This is the shell script that downloads and installs the addon. For anyone who might care why I used rsync, it's because mv doesn't overwrite existing directories, even with -f. rsync will overwrite the old files and delete any that aren't in the new version, all in one step for me. And rsync rules anyway!
    Code:
    #!/bin/bash
     
    ADDON_URL="http://your/addon/url"
    ADDON_DIR="/Applications/World of Warcraft/Interface/addons"                                                                                        
     
    echo "Updating ..."
    curl -o addon.zip ${ADDON_URL}
    unzip addon.zip
    rsync -a --delete ./TheUndermineJournal "${ADDON_DIR}"
    rm -rf ./TheUndermineJournal
    rm addon.zip
    echo "Done!"

    Steps


    1. Copy the script from above to a file. Replace the ADDON_URL value with the download url tied to your account, make sure the ADDON_DIR variable points to the right place, and save it somewhere (preferably with the .sh extension, but it doesn't really matter).

    2. Launch the Automator app
    and create a new iCal alarm.

    3. Under the library of actions in the left panel, select Utilities, and then drag 'Run Shell Script' to the workspace on the right.

    4. Replace the text
    with the following (screenshot after next optional step):
    Code:
    source /the/path/to/the/script.sh
    The path is a full path. The tilde in the screenshot is a shortcut to your home directory. If you're using normal OS X conventions, then your Documents folder would be ~/Documents, for example. And for the persnickety, I did choose source somewhat arbitrarily. The automator workflow is a shell script already, so why fork? Let's just pull that puppy in and run it in this shell. But you can invoke it with bash, or chmod +x it and execute it directly, or whateeeeever you prefer.

    5. (Optional): Growl notifications.
    Mountain Lion has a notification center (matching the one in iOS), but I haven't upgraded so I'm still using growl, which isn't free anymore, but Perry Metzger is maintaining the last open source version here (direct download).

    This is important
    : This step requires growlnotify. When you get growl, the .dmg has an Extras folder, which is where you can find and install growlnotify separately from the main app. It's a command line tool to conveniently pop up notifications from the shell without reinventing the wheel and AppleScripting it all yourself. You can also just use iCal's built-in messages, like event reminders, but I find those dialogs kind of annoying and the growl notifications fit in with other stuff I have going on.

    So, in the workflow, insert the following under the line that runs the update script:
    Code:
    /usr/local/bin/growlnotify -sm "TheUndermineJournal Addon Updated"
    You can change the message in quotes of course, and the -s option makes it sticky (it will stay until you click it). I like that because it gives me some confidence that the update worked if I'm not around when it happened, but you can drop it (leaving just -m).
    6. Save it. The file name you enter will be the name of the alarm, and iCal will automatically open with a new "Automator" calendar containing the event. If for some reason it doesn't, you should be able to add the alert to an event manually. Set the alert type to Open File, then you should be able to select the alert you just saved.

    7. Edit the event. It's a normal calendar event and you can do the normal stuff to it, but you'll at least want to set the time to run and how often to repeat. Try setting it to happen in a minute or two to test it out. It should look something like this (note 'TUJ Update' under alert, that's what we made in Automator):



    Finally

    You don't have to use Automator and iCal, even though it's awesome. You can just run the script to do one-off updates. If you're a showoff, you could also schedule it through launchd (launchctl) or good old crontab!

    So that's it. I hope someone finds it useful!

  2. #2

  3. #3
    Thanks a lot for such brilliant Mac OS solution.

    I've made it work with Mountain Lion Notification Center. I think it should be useful also. So, make these actions:

    1. Install ruby gem 'terminal-notifier' by running command in Terminal application:
    Code:
    $ sudo gem install terminal-notifier ⏎
    Fetching: terminal-notifier-1.4.2.gem (100%)
    Successfully installed terminal-notifier-1.4.2
    1 gem installed
    2. Test, if it works with:
    Code:
    terminal-notifier -title "The Undermine Journal Updated" -message "The Undermine Journal Addon was succesfully updated"
    It should show nice native Mountain Lion notification

    3. Update your Automator iCal by replacing
    Code:
    /usr/local/bin/growlnotify -sm "TheUndermineJournal Addon Updated"
    with
    Code:
    terminal-notifier -title "The Undermine Journal Updated" -message "The Undermine Journal Addon was succesfully updated"
    And that's it! Enjoy.

  4. #4
    Erorus's Avatar
    Posts
    1,358
    Reputation
    112
    Tagged in
    668 Posts
    Add to this user's reputation
    This is the script I use in Linux:

    Code:
    #!/bin/bash
    
    zpath=$HOME/warcraft/TheUndermineJournal.zip
    getzip=0
    
    if [ -e $zpath ]; then
    	if [ `date -d "20 hours ago" +%s` -gt `date -r "$zpath" +%s` ]; then
    		getzip=1
    		rm $zpath
    	fi
    else
    	getzip=1
    fi
    
    if [ $getzip -gt 0 ]; then
    	wget -O $zpath "https://theunderminejournal.com/TheUndermineJournal.zip?key=YOURKEYHERE&realms=YOURREALMSHERE"
    	unzip -o -d $HOME/warcraft/World\ of\ Warcraft/Interface/AddOns/ $zpath
    fi
    
    export WINEPREFIX=$HOME/warcraft/wine
    rm $HOME/warcraft/World\ of\ Warcraft/Cache/WDB/enUS/creaturecache.wdb
    wine "d:\\wow.exe"
    If you want to be my best friend forever, don't set your scripts to run on the hour. Everyone does that, and it makes the server cry. If you must schedule it, make it run at x:17 or x:24 or x:51 or some random minute.

    This script does not run on cron or some other timer, I run it every time I want to start WoW. I always keep the TUJ addon zip file in the same spot. If that zip file is 20 hours old or more, or if it's missing, then I get a new one and unzip it. I then remove creaturecache for NPCScan, then start WoW.

  5. #5
    @Erorus, after you advice i've adapted script for MacOS. So, if someone needs it - here it is:

    Code:
    #!/bin/bash
    
    
    zpath="$HOME/YOUR_TEMP_DIR/TheUndermineJournal.zip"
    ADDON_URL="https://theunderminejournal.com/TheUndermineJournal.zip?key=YOUR_KEY&realms=YOUR_REALM"
    ADDON_DIR="/Applications/World of Warcraft/Interface/addons"
    getzip=0
    
    
    if [ -e $zpath ]; then
        if [ `find $zpath -mmin +500` ]; then
          getzip=1
          rm $zpath
        fi
    else
        getzip=1
    fi
    
    
    if [ $getzip -gt 0 ]; then
      curl -o $zpath ${ADDON_URL}
      unzip $zpath
      rsync -a --delete ./TheUndermineJournal "${ADDON_DIR}"
      rm -rf ./TheUndermineJournal
    fi
    
    # Check path for your locale
    rm "/Applications/World of Warcraft/Cache/WDB/ruRU/creaturecache.wdb"
    open "/Applications/World of Warcraft/World of Warcraft.app"
    So, this script checks if current TheUndermineJournal.zip file older, than 500 minutes and updates it. Mac users have to make .command extension for this script file and run it instead of basic WoW alias

  6. #6
    Koko's Avatar
    Posts
    575
    Reputation
    49
    Tagged in
    248 Posts
    Add to this user's reputation
    Here is the code to get Wowuction data instead of TUJ

    Code:
    #!/bin/bash 
    ADDON_URL="ADDON_URL="http://your/addon/url"
    ADDON_DIR="/Applications/World of Warcraft/Interface/addons/TradeSkillMaster_WoWuction"                                                                                        
     
    echo "Updating ..."
    curl -o tsm_wowuction.lua ${ADDON_URL}
    rsync -a --delete ./tsm_wowuction.lua "${ADDON_DIR}"
    rm -rf ./tsm_wowuction.lua
    echo "Done!"
    Please tell me if this is ok, it seems to work, but I just fiddled around with your script.

  7. #7
    hm doesn't work for me. even if i run it via terminal "Permission denied" I'm a noob at this haha. someone could give me some advice?

  8. #8
    In OS X Mavericks I used the "Display Notification" action in automator instead of growl. Worked like a charm!

  9. #9
    -----
    Last edited by Rogozjin; January 12th, 2014 at 11:25 PM.

 

 

Similar Threads

  1. Replies: 35
    Last Post: June 23rd, 2014, 05:35 PM
  2. AuctionDB not auto updating
    By txbmc in forum Archive (Addons and Macros)
    Replies: 4
    Last Post: July 16th, 2012, 10:48 AM
  3. TUJ Realm Edition: question on updating in game
    By Gissa in forum Official Forum of The Undermine Journal
    Replies: 1
    Last Post: January 29th, 2012, 08:55 PM
  4. The Undermine Journal Addon
    By Kathroman in forum Archive (Addons and Macros)
    Replies: 7
    Last Post: February 14th, 2011, 02:59 PM