GcalDaemon and Leopard

Discussion in 'Mac Apps and Mac App Store' started by jankees, Oct 29, 2007.

  1. jankees macrumors newbie

    Joined:
    Oct 28, 2007
    #1
    Dear MacRumors Forum users,

    I was wondering has anyone successfully setup GcalDaemon on Leopard?

    Leopard saves the ical files in a new way. (Different from Tiger)

    I hope to hear from someone!

    Kind regards,
    Jankees
     
  2. jankees thread starter macrumors newbie

    Joined:
    Oct 28, 2007
    #2
    Or does someone know a (free/opensource) alternative?
     
  3. NoSenseWorrying macrumors newbie

    Joined:
    Nov 27, 2007
    #3
    I've tried but failed...

    Not that this will be much help to you... but I've tried and failed as well. So at least you know you're not alone. I'll be sure to post again if I find an alternative.
     
  4. Sceneshifter macrumors 6502

    Sceneshifter

    Joined:
    Jun 14, 2007
    #4
    Having the same problem! In the mean time I just subscribed with iCal to my calendar, that way you can at least have an offline version of your calendar, but you can't edit in iCal...
    Solutions more then welcome here also (only free, not spanning sync)
     
  5. mortenbek macrumors newbie

    Joined:
    Dec 11, 2007
    #5
    Works like a charm - just needs adjustment of howto

    Hello there,
    I just downloaded GCALDaemon and it works like a charm on leopard.

    iCal in leopard stores each event in its own .ics file - and in a new location - but apparently GCALDaemon has no problems with wildcards!

    This is what I entered in gcal-daemon.cfg:
    file.ical.path=/Users/bek/Library/Calendars/5A55BA6F-651C-42CB-8176-757CBBF72211.calendar/Events/*.ics

    Try this (replacing username and calendar directory) and you're all set!

    Sincerely,
    /morten
     
  6. nonexpert macrumors newbie

    nonexpert

    Joined:
    Dec 14, 2007
    Location:
    Eugene, OR
    #6
    Missing iCal directories

    Hello,

    It seems that my OS 10.5 1 does not include these directories/file path:

    ~/Library/Application Support/iCal/Sources

    If it does not exist, I cannot "Put a colored label on all folders [located in Sources]" as directed by instructions on:

    http://gcaldaemon.sourceforge.net/usage13.html

    I created the mentioned directories/file path, but found no resolve

    1. Is it possible to work around this flagging procedure?
    2. Does the iCal "Sources" directory exist elsewhere in 10.5 1?

    Does this sound familiar to anyone? Can somebody provide a solution?

    Thank You,

    Drew
     
  7. ajarufe macrumors newbie

    Joined:
    Dec 18, 2007
    #7
    Did you have to change anything else? I see the google .ics files coming into the /Events/ directory, but nothing is showing up in iCal.
     
  8. Coriolanus macrumors newbie

    Joined:
    Dec 22, 2007
    #8
    This is the same thing I am seeing. It also appears that new events in iCal are not being sent to Google.
     
  9. mishamazor macrumors newbie

    Joined:
    Dec 23, 2007
    #9
    Google to iCal


    This works for iCal to Google, thanks! But not the other way around. Any ideas as to how to get Google entries into iCal? What is the new Leopard entry for file.private.ical.url=

    Thanks,
    Misha
     
  10. Ephialtes macrumors newbie

    Joined:
    Jan 17, 2008
    #10
    In regards to this I found a rather novel way around it. Using two rather simple Perl scripts I just pull each calender's events individually and reconstruct a corestorage.ics file, and then throw them back out again after gmail's done with the files.

    Downsides: You have to run them every sync (but they're fast).
    It deletes the Calendar Cache file to force iCal to notice the changes, so it spends a few moments updating it each time you start up
    You have to restart iCal to see the differences.

    Upsides: It works
    It's free

    If anyone's interested, drop me a line.
     
  11. Ephialtes macrumors newbie

    Joined:
    Jan 17, 2008
    #11
    Because I'm sure people'll want this:

    Instructions for those that know what they're doing:

    Save the perl files.
    Edit the $home variable in both scripts to point to your home dir (without trailing '/')
    Run coreimport.pl from wherever you saved it.
    Set up the GCALDaemon config file, linking to the corestorage.ics files that are found in ~/Library/Calendars/<blah>.calendar/
    Run sync-now.sh (the GCAL one)
    Run coreexport.pl
    Set up a shell script that runs coreimport.pl sync-now.sh coreexport.pl in that order, run it whenever you want to sync. Or some other clever thing, it's up to you.

    I haven't tested running this at the same time as having iCal open, but I don't think I'd like the results. Advised not to do it, which makes automating difficult.
    Okay, I've tested it and it's suprisingly resiliant. Nothing broke. However. If you run the scripts while iCal is open, and then change something, the change isn't saved when you restart.


    I'll write up instructions for those that don't know what they're doing later.


    If things break, don't blame me. This is provided 'as-is' as a work around.

    Oops, just caught a small code bug in coreexport.pl which meant iCal wasn't deleting items that had been added by google. Fixed now.

    coreimport.pl:

    Code:
    #!/usr/bin/perl
    # Sean Sabbage 2008
    # This script takes the individual events in iCal for Leopard and puts them 
    # in to a single corestorage.ics file in ~/Library/Calendars/*.calendar/
    # for each individual calendar.
    # RUN BEFORE coreimport.pl
    # Don't run when iCal is running. I haven't tested this, but it's likely to break something.
    # Won't work on anything before Leopard (10.5)
    # It only copies across VTODOs and VEVENTS. I haven't come across anything else, yet.
    # Free to use and work with as you will
    
    use strict;
    use warnings;
    
    my $home = ""; # Put the link to your home directory here. Likely to be /Users/<username>
    my @paths = <$home/Library/Calendars/*.calendar>;
    foreach(@paths){
    	
    	open (CORE, ">$_/corestorage.ics");
    
    	print CORE "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Apple Inc.//iCal 3.0//EN\nCALSCALE:GREGORIAN\n";
    	
    	my @files = <$_/Events/*.ics>;
    	foreach(@files){
    		open (ICS, "<$_");
    		my $bEvent = 0;
    		while(<ICS>){
    			$_ =~ s/\r//;
    			if ($_ =~ m/(BEGIN:VEVENT|BEGIN:VTODO)/){
    				$bEvent=1;
    				print CORE $_;
    			} elsif ($_ =~ m/(END:VEVENT|END:VTODO)/){
    				$bEvent=0;
    				print CORE $_;
    			} elsif ($bEvent==1){
    				print CORE $_;
    			}
    		}
    		close(ICS);
    	}
    	
    	print CORE "END:VCALENDAR";
    	close (CORE);
    }
    
    

    coreexport.pl:
    Code:
    #!/usr/bin/perl
    # Sean Sabbage 2008
    # This script breaks the home made corestorage.ics up into individual 
    # events and puts them in the necessary folders so iCal can read them. It 
    # deletes all events before it does that, and the Calendar Cache, to make 
    # sure that iCal updates. 
    # Back up iCal BEFORE use, I am not responsible if you lose all your calendars.
    # RUN AFTER coreimport.pl
    # Don't run when iCal is running. I haven't tested this, but it's likely to break something.
    # Won't work on anything before Leopard (10.5)
    # It only copies across VTODOs and VEVENTS. I haven't come across anything else, yet.
    # Free to use and work with as you will
    
    use strict;
    use warnings;
    
    my $home = ""; # Put the link to your home directory here. Likely to be /Users/<username>
    my @paths = <$home/Library/Calendars/*.calendar>;
    unlink("$home/Library/Calendars/Calendar Cache");
    foreach (@paths){
    	my $path = $_;
    	open (CORE, "<$_/corestorage.ics");
    
    	my $header = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//Apple Inc.//iCal 3.0//EN\nCALSCALE:GREGORIAN\n";
    
    	my $footer = "END:VCALENDAR";
    	
    	my @events = <$path/Events/*.ics>;
    	foreach(@events){
    		unlink($_);
    	}
    	
    		
    	my $lines;
    	my $uid;
    	while(<CORE>){
    	
    		$lines = $lines . $_;
    
    		if($_ =~ m/(BEGIN:VEVENT|BEGIN:VTODO)/){
    			$lines = $_;
    		} elsif($_ =~ m/UID:(.+)/){
    			$uid = "$1";	
    			$uid =~ s/\r//g;
    		} elsif($_ =~ m/(END:VEVENT|END:VTODO)/){
    			open (CAL, ">$path/Events/$uid.ics");
    			print CAL $header;
    			$lines =~ s/\r//g;
    			print CAL $lines;
    			print CAL $footer;
    			close(CAL);
    		}
    	}
    	close (CORE);
    }
    
    
    Another bug picked up and destroyed!
     
  12. Morraldor macrumors newbie

    Joined:
    Jan 21, 2008
    #12
    Great

    Great Thing! You made it work!

    For all out there, who want to have this stuff automated, can do as follows:

    1.) Create a new textfile called sync-now-workaround.sh in GCALDaemon/bin and enter the correct path to your GCALDaemon-Installation
    2.) Contents as below (assuming, that coreimport and coreexport are in the same directory, otherwise just change them)
    3.) Install Lingon. This Tool allows you to manage your launch-daemon within a smart GUI
    4.) Start Lingon
    5.) Click "New" on the upper left
    6.) Enter an apporpriate name (e.g. "GCALDaemon")
    7.) Choose the Path to the script below $yourdir/GCALDaemon/bin/sync-now-workaround.sh
    8.) Disable the Checkboxes as you belove to
    9.) Enter a time period at "Run it every ..." (e.g. 15 minutes)
    10.) Check the "Enabled"-Box on the upper right and save it by clicking the "Save"-Button on the upper left
    11.) You're done


    Code:
    #!/bin/sh
    #
    # Run coreimport.pl
    # Run GCALDaemon once
    # Run coreexport.pl
    
    path="/Users/***/GCALDaemon/bin"
    $path/coreimport.pl
    sh $path/sync-now.sh
    $path/coreexport.pl
     
  13. Morraldor macrumors newbie

    Joined:
    Jan 21, 2008
    #13
    I'm afraid it is not!

    Only changes in iCal are stored. Even if I change an Event within Google it is RESET to the original date/time, as soon as I sync!

    Do you have a bugfix for that?
     
  14. Ephialtes macrumors newbie

    Joined:
    Jan 17, 2008
    #14
    That's strange. Let me do a little poking....
     
  15. Ephialtes macrumors newbie

    Joined:
    Jan 17, 2008
    #15
    Fixed now, one that slipped through my unextensive testing. Use the updated coreexport.pl above.
     
  16. rideallday macrumors newbie

    Joined:
    Jan 21, 2008
    #16
    Easy solution

    I just messed with the conf file and it syncs both ways for me on Lepoard!

    I do need to restart iCal after syncing, though, and I have not tried the daemon.

    Just comment out ('#') the the blank config line in conf/gcal-daemon.cfg that the sync is barfing on- your other calendars have a number at the end of them- something like this (I left the context in there so you can find it in the conf file :

    ################################################
    # CONFIGURATION OF THE FILE-BASED SYNCHRONIZER #
    ################################################

    # Enable built-in HTTP server/synchronizer
    file.enabled=true

    # Full path of the local iCalendar file (don't include backslash characters!)
    #file.ical.path=/google1.ics

    # URL (without hostname) of the Google Calendar's private ical file
    #file.private.ical.url=

    # Full path of the local iCalendar file (don't include backslash characters!)
    file.ical.path2=/Users/me/Library/Calendars/4F6110FF-11C1-40C6-9610-C3F2A1E45E1C.calendar/Events/*.ics

    # URL (without hostname) of the Google Calendar's private ical file
    file.private.ical.url2=/calendar/ical/dfg8l45eec77bif0oatl9f3g88%40group.calendar.google.com/private/basic.ics

    # Gmail user (your full email address)
    file.google.username2=me@gmail.com


    Hope that works for you too!
     
  17. Morraldor macrumors newbie

    Joined:
    Jan 21, 2008
    #17
    After a first test it seems to work!
     
  18. Morraldor macrumors newbie

    Joined:
    Jan 21, 2008
    #18
    Hi,

    I have a bad news. I don't know if this problem is caused by GCALDaemon itself or your Script.

    The Sync goes well - firstly.

    At the time I sync, iCal is closed! I open it, and all Events are synced well. Events, that were deleted in Google Calendar have gone, the others are updated. Both Calendars seem to be up to date.

    I close iCal and open it again after 1 or 2 seconds. And - the deleted Events are again there. After the next sync, they also appear in Google Calendar again!

    The Calendar Cache ist definitley flushed when syncing AND the .ics-Files in the Events-Dir are also unlinked. Nevertheless after the restart of iCal they appear again - there must exist another calendar-Cache, but where? Any idea?
     
  19. Ephialtes macrumors newbie

    Joined:
    Jan 17, 2008
    #19
    This is.. very strange. I can't work out what's going on. From what I've seen it's recreating it from 'somewhere'. And I don't know where that somewhere is. The file isn't there on the first launch of iCal. And then when I quit it's still not there. The second launch it's suddenly back, even if I wipe the cache again between launches. That makes no sense at all.

    Further investigation is required, methinks.
     
  20. Ephialtes macrumors newbie

    Joined:
    Jan 17, 2008
    #20
    A little poking around showed me that the event that reappeared comes up with this, in an ls -l

    :
    rw-r--r--@ 1 <USER> <USER> 354 24 Jan 08:48 q86k8l1f1jklgjgv960v4gtmjg@google.com.ics

    Now, the @ signifies extended attribute.

    So...

    [<ME>@<COMP>:~/Library/Calendars/<CALENDAR>.calendar/Events] 9:01 > xattr -l q86k8l1f1jklgjgv960v4gtmjg@google.com.ics
    com.apple.quarantine: 0000;479850c3;iCal;|com.apple.iCal

    Still trying to ascertain where this is magically coming from.
     
  21. Morraldor macrumors newbie

    Joined:
    Jan 21, 2008
    #21
    Hi,

    I'm really not sure if GCALDaemon or your script are to blame. This issue also happens if I delete an Event FROM WITHIN iCal and restart iCal afterwards - even if there was NO sync in the meanwhile!

    Morraldor
     
  22. buldir macrumors newbie

    buldir

    Joined:
    Mar 23, 2008
    #22
    Permissions problem?

    This worked for me without the perl script, but I also had to make a few permissions changes. I noticed when I ran the sync-now.sh script in the terminal that there were several errors regarding permissions. What I had to do was assign recursive read/write permissions for my username to /Users/username/Library/Calendars. Before doing this, GCalDaemon was unable to read/write to the *.ics files in these directories.

    I also had to give read/write permissions to /usr/local/sbin/GCALDaemon/work/event-registry.txt. I hope this helps!
     
  23. msim20 macrumors member

    Joined:
    Feb 4, 2008
    #23
    I used the above solution. Also changed the permissions of ics files in the calendar using chmod 777 * as well as the event-registry.txt file referred to in the previous post.

    However, I still get this message in the log.

    WARN | Unable to update event (Updated: Lunch )!
    User does not have permission to perform this modification. [note that participant overrides not available on recurring events]


    Further, only a one way sync from ical to gcal has happened. if i make changes in gcal, they are not reflecting in ical. perhaps due to such warnings as above.

    Neither are changes in ical subsequent to the first sync, are refreshing in gcal.

    i am starting standalone-start.sh in a terminal window.

    any ideas?
     
  24. rmh macrumors regular

    Joined:
    Sep 12, 2007
    Location:
    Texas
    #24
    Ephialtes, just wondering if you've had time to look into the magically self-un-deleting events yet? Thank you for all your effort so far.
     
  25. Gentile macrumors regular

    Gentile

    Joined:
    Apr 29, 2007
    Location:
    Ohio
    #25
    Until you get this working you can try Plaxo Online. This allows syncing the Gmail calendar two way with iCal. It also allows syncing 1 way from Gmail contacts to your address book.

    This is the best solution I have found so far.
     

Share This Page