kaelri / enigma

A featured "suite" for the Windows system monitoring application, Rainmeter.
https://www.kaelri.com/project/enigma/
275 stars 94 forks source link

GCal reader no longer showing feed #84

Open lew101 opened 10 years ago

lew101 commented 10 years ago

I've had the Gcal reader installed and working for about half a year now but it's now showing Invalid Feed Format, Could not identify a valid feed format. I have tried giving the reader another XML address and it still isn't working.

jayzee2001 commented 8 years ago

@Gregory2001 : it appears to me that as soon as there is any annually repeating event in the ical feed, reader.lua trips on it with some math error and as a result will abandon the feed altogether.

Have you enabled logging & debug mode to see what errors you're getting?

Gregory2001 commented 8 years ago

No. All I know is the Holidays have disappeared and GCal doesn't work anymore.

------ Original Message ------ From: "jayzee2001" notifications@github.com To: "Kaelri/Enigma" Enigma@noreply.github.com Cc: "Gregory2001" gregl@bloomer.net Sent: 12/13/2015 12:15:40 PM Subject: Re: [Enigma] GCal reader no longer showing feed (#84)

@Gregory2001 : it appears to me that as soon as there is any annually repeating event in the ical feed, reader.lua trips on it with some math error and as a result will abandon the feed altogether.

Have you enabled logging & debug mode to see what errors you're getting?

— Reply to this email directly or view it on GitHub.

jayzee2001 commented 8 years ago

@Gregory2001 : So... are you using the new ical feed links? Are there any annually repeating events in any of your calendars? Did you update your reader.lua?

steventan11 commented 8 years ago

my GCal also not working, eventhough i use the reader.lua provided by @t0mmy9 , not sure what happen.... :(

Gregory2001 commented 8 years ago

I just re-installed Enigma. There must be a step I'm missing. Can anybody provide a step-by-step instruction for Google Calendar? Thanks in advance.

harryjamesuk commented 8 years ago

@t0mmy9 Thanks for that! Looks good to me, only issues are that I get "Untitled" as the title, rather than my Calendar's actual title, the recurring events don't display and GMail seems to break but hey, nice work there! Especially considering you don't know lua!

Gregory2001 commented 8 years ago

How can it be "nice work" when it doesn't work?

harryjamesuk commented 8 years ago

@Gregory2001 The calendar itself functions, it just conflicts with the other skins that use the same file (e.g: GMail, not Google Calendar). Anyhow, it is work in progress and things like this take time, especially when you don't know the language. t0mmy9 has actually managed to get the Calendar functioning, which is a major step forward to where we're at already and that's good work.

Gregory2001 commented 8 years ago

The calendar functions. Google Calendar does not.

Gregory2001 commented 8 years ago

I just re-installed Enigma. There must be a step I'm missing. Can anybody provide a step-by-step instruction for Google Calendar? Thanks in advance.

t0mmy9 commented 8 years ago

@jayzee2001 good work! I've merged your changes with mine.

Ok I have now made amends to hopefully check for annually recurring events and nth day of month, e.g. first Friday of month. Here's my whole file, I won't list what has been changed this time: http://pastebin.com/CWi62WqS

I don't have many annual events so you'll need to test and confirm that it works. @harryjamesuk maybe download and open your ics feed in a text editor and check that the description and summary lines are not blank. @Gregory2001 have your read this whole thread through and made the right changes?

Gregory2001 commented 8 years ago

Well, I thought I did. Pasting the new one changed my GCal from "Invalid Feed Format" to "Loading...".

Gregory2001 commented 8 years ago

So, what exactly, should we do?

t0mmy9 commented 8 years ago

More updates... I have changed the feed to add a month to recurring dates if they are in the past and try to correct timezone issues. Anyone want to test and confirm? Again the whole file: http://pastebin.com/MA1FxgED Everything is working for me again now, what a horrible format!

@Gregory2001 Looks like that error is caused by the feed coming back blank, could be a firewall issue. Or maybe try right click on the calendar and go to Rainmeter -> Logging -> Start logging then Refresh skin then Rainmeter -> Logging -> Show log file and check for errors.

Gregory2001 commented 8 years ago

NOTE (10:37:03.750) Enigma\Sidebar\Calendar\Calendar.ini: Refreshing skin NOTE (10:37:07.212) Enigma\Sidebar\Reader\Gcal\Gcal.ini: Refreshing skin ERRO (10:37:07.236) : Script: Reader.lua:1: '=' expected near 'Initialize' ERRO (10:37:07.236) Enigma\Sidebar\Reader\Gcal\Gcal.ini - [MeasureScriptReader]: Script: File not valid ERRO (10:37:07.273) Enigma\Sidebar\Reader\Gcal\Gcal.ini - [MeasureFeed2]: WebParser: (Fetch error) The URL does not use a recognized protocol (ErrorCode=12006) ERRO (10:37:07.274) Enigma\Sidebar\Reader\Gcal\Gcal.ini - [MeasureFeed3]: WebParser: (Fetch error) The URL does not use a recognized protocol (ErrorCode=12006)

Thanks.

BillFarquharson commented 8 years ago

Thanks to t0mmy9 and others for getting this working again. I have a wee problem in that a re-occuring event does not show up. I work shifts so each day is put in separately, however, two days are always the same and I use the repeating function for them. They show up on the calendar but not the feed. It would be great if you could work out how I could get them showing without typing out each day.

Gregory2001 commented 8 years ago

"Invalid Feed Format"

steventan11 commented 8 years ago

I got the same errors as @Gregory2001 ... no luck...

Gregory2001 commented 8 years ago

Would it really be that difficult to just update this? Jesus.

jayzee2001 commented 8 years ago

Great work again @t0mmy9 ! I'm very happy you got the timezone adjustments working. I had put in a "hard adjustment" for my timezone temporarily, but this is so much better.

My yearly recurring events still don't show up; I'm trying to look into that as well.

Added a few lines to get the feed title for the calendar to read out correctly from line 83:

-- GET NEW DATA

            if (t == 'GoogleCalendar') then

                Feeds[f].Title = Raw:match('X%-WR%-CALNAME:(.-)\n') or 'Untitled'

            else

                Feeds[f].Title = Raw:match('<title.->(.-)</title>') or 'Untitled'

            end

            Feeds[f].Link  = Raw:match(Type.MatchLink) or nil

            local Items = {}

jayzee2001 commented 8 years ago

@Gregory2001 @steventan11 :

Check code>C:\Users\USERNAME\Documents\Rainmeter\Skins\Enigma\@Resources\User\Options.inc</code to make sure the calendar URL(s) exactly match the ones that Google provides.

t0mmy9 commented 8 years ago

Yep looks like the URL is invalid. Are you copying the private ICS link? in the format: https://calendar.google.com/calendar/ical/[EMAIL HERE]/[PRIVATE KEY HERE]/basic.ics What happens if you go to the link from your Options.inc in your browser?

I have just had an idea to fix yearly occurring events, maybe replace with this around line 400:

-- Yearly recurring events
elseif s:match('FREQ=YEARLY') then
    -- Match and set to this year
    Date.year, Date.month, Date.day = s:match('DTSTART;VALUE=DATE:(%d%d%d%d)(%d%d)(%d%d)')
    Date.year = os.date('%Y')

    -- If date is in the past then add a year
    if os.time(Date) < os.time() then
        Date.year = Date.year + 1
    end

    return Date

@BillFarquharson I would need to see what the format of one of these events looks like in the ics file as there are way too many different date formats for this type of file.

jayzee2001 commented 8 years ago

@t0mmy9 : That did the trick! You Sir, are a genius! Thank you very much!

Gregory2001 commented 8 years ago

I'm so confused. I had it - it said "Untitled" and showed three events - and then after a refresh I'm back to "Invalid Feed Format". Help! Thanks.

BillFarquharson commented 8 years ago

Thanks jayzee2001. Titles of the calendars now show correctly. After including the lines from t0mmy9, yearly events now showing. Hoping weekly events can be over come

Gregory2001 commented 8 years ago

I am copying the private URL. How can it be invalid? In the browser - nothing happens. Can anybody help with this? Thanks.

steventan11 commented 8 years ago

@jayzee2001 and @t0mmy9 , i open the basic.ics in Chrome and it download the .ics file, i suppose this means it's a valid URL... i wonder should i reinstall Enigma or not...

Gregory2001 commented 8 years ago

Nothing?

t0mmy9 commented 8 years ago

@steventan11 are you using the latest version of the Reader.lua file we've been working on? Reinstalling Enigma alone will not fix the calendar. @Gregory2001 you've just shown this is a problem with you PC setup and not Enigma if going to the URL in a browser doesn't download the feed.

steventan11 commented 8 years ago

@t0mmy9 , yeah, i'm using the latest one that you guys working on, but strange thing happen last Friday, the Calendar events suddenly shown up but top there still showing "Invalid Feed Format"...... then I restart the PC, then events is not show up anymore...... :( desctop screenshot

Gregory2001 commented 8 years ago

Shouldn't the URL that Google has assigned open in a browser? How can the PC setup be wrong if I'm using the URL Google has provided? Thanks.

cearner commented 8 years ago

@Gregory2001 That URL should download the ICS file to your PC. It won't open a new webpage.

@t0mmy9 Thanks for the fix!

Gregory2001 commented 8 years ago

https://calendar.google.com/calendar/ical/g2fstlpnc5kotbsr57k1mv501g%40group calendar.google.com/private-b50f8b3112f57604a9dc142364c1feb5/basic.ics OK

-------Original Message-------

From: cearner Date: 1/11/2016 11:05:19 AM To: Kaelri/Enigma Cc: Gregory2001 Subject: Re: [Enigma] GCal reader no longer showing feed (#84)

@Gregory2001 That URL should download the ICS file to your PC. It won't open a new webpage. @t0mmy9 Thanks for the fix! — Reply to this email directly or view it on GitHub.

steventan11 commented 8 years ago

This is how my calendar show right now, shown something, but missing something... not sure what is going on... desctop screenshot

mdlark1966 commented 8 years ago

Thanks to all who have helped sort this out. I'm so thrilled to have my calendar back on my desktop!

I have updated my reader.lua file with the pastebin file that t0mmy9 provided, along with the changes to show the title and yearly events correctly. But I'm still having one odd problem - there are some events that are still acting strange. For example, I have a birthday listed as a recurring yearly event on September 23, but for some reason Enigma is showing it on January 23. Another is that I recently added an event, then edited the title of the event, and Enigma is showing the edited version and the original version as two separate events on the same day.

Not sure if these are Enigma problems, or something to do with Google. Any thoughts would be most appreciated. Thank you!

EDIT: Interesting. I deleted the birthday from Google Calendar, then created a new event for it and refreshed Enigma. It got the date right this time, but for some reason it is forcing the birthday onto the Enigma list of events, even though it is 9 months away and there are many other events before that. UGH! Why can't Google leave well enough alone????

mdlark1966 commented 8 years ago

Just checking in again to see if there has been any progress on this.

Regarding my post above - I have realized that the problem is with recurring events that are on some kind of weekly recurrence. For example, I have one event that recurs every two weeks, and only the first event is showing. I have another that recurs every six weeks, but I have changed the title on each event, and they are showing up fine, although the first one I created is showing up twice - once with the original title, and once with the changed title.

Very strange.

I hope someone is able to come up with a solution. I didn't realize that I had grown so dependent on seeing those events on my desktop!

Thanks to all who are working on this. What would we do without you? :)

steventan11 commented 8 years ago

surprisingly, the feed suddenly works on my GCal reader! The only thing i notice is, the "today's" event is missing, it shown up the next events onwards....

lew101 commented 8 years ago

I just wanted to say a massive thanks for the huge effort put in by everyone since I first started this thread (especially as I haven't actually done anything). It's always good to see people who are willing to keep trying to get the results they want.

Because I don't have much knowledge of lua and how the Reader.lua file that @t0mmy9 posted actually works, I wanted to pick the brains of those who did. My GCal seems to be working perfectly, even with today's events showing up correctly, I am however still getting the issue related to Untitled calendar names. Any ideas?

BillFarquharson commented 8 years ago

@lew101 If you look back to 29th Dec, @jayzee2001 wrote some lines to add round about 83 to fix the titles

t0mmy9 commented 8 years ago

No problem :) The best method to fix any of these problems is to go to the ics link in your browser and open the file that gets downloaded in a text editor and check what's in there.

For the main calendar title it's looking for the line begging with "X-WR-CALNAME" that should be near the top of the file. For events it is looking for the "SUMMARY" and "DESCRIPTION" lines. There are duplicates in the downloaded feed causing problems. There's also various checks trying to remove duplicates so if there are 2 events with the same details one may get removed.

You can see all the checks being done in the "DefineTypes" function in Reader.lua. At the moment it does yearly, monthly, day and nth day of month events. Every 2 weeks probably won't work. Compared to the previous format this is horrible, events don't repeat and nothing is in order or consistent. I would need to know what the "DTSTART" and "RRULE" lines look like for any broken events.

lew101 commented 8 years ago

Thanks for that @BillFarquharson, I probably should look harder next time and thanks @jayzee2001 for the fix.

Thank you @t0mmy9 for the run through for that too, it was very helpful. I'll see if I can get a crash course in lua and try to help out with the duplicates problem. And it may be horrible but it's a start and it's a pretty good start at that too.

Do you think you can incorporate the fix that @jayzee2001 and you wrote into the current lua file in pastebin?

mrshllstock commented 8 years ago

@t0mmy9 I am sorry but I was not able to follow what happened here, are you using the standard Enigma calendar here? What files do I need to replace? I'm somewhat illiterate in terms of Rainmeter but I really want to get a working calendar function. Could you make a simpler guide as to the steps neccesary for the default enigma calendar? Or lua calendar or something?

Gregory2001 commented 8 years ago

Good luck. I have been asking for this for a long time with no results.

lew101 commented 8 years ago

Hey @kirbyplz. So firstly this is for the GCal part of Enigma which can be found in Sidebar --> Reader --> Gcal, not the Calendar in Sidebar --> Calendar. If GCal is what your looking for then great, here's what to do in a basic form.

This is not an entire fix. The good people here have done a lot but are not magicians so there are still a few bugs.

GUIDE: 1. You firstly want to download the lua file that @t0mmy9 made which can be found here: http://pastebin.com/MA1FxgED

2. You next want to open it with a text editor and add in the following code from @jayzee2001 into line 83.

        -- GET NEW DATA

         if (t == 'GoogleCalendar') then

            Feeds[f].Title = Raw:match('X%-WR%-CALNAME:(.-)\n') or 'Untitled'

        else

            Feeds[f].Title = Raw:match('<title.->(.-)</title>') or 'Untitled'

        end

        Feeds[f].Link  = Raw:match(Type.MatchLink) or nil

        local Items = {}

This code will replace this bit:

            -- GET NEW DATA
            Feeds[f].Title = Raw:match('<title.->(.-)</title>') or 'Untitled'
            Feeds[f].Link  = Raw:match(Type.MatchLink)          or nil

            local Items = {}

And should end up looking like this: (This is taken from line 80 to 104)

           -- MAKE SYNTAX PRETTIER
            local Type = Types[t]

            -- GET NEW DATA

             if (t == 'GoogleCalendar') then

                Feeds[f].Title = Raw:match('X%-WR%-CALNAME:(.-)\n') or 'Untitled'

            else

                Feeds[f].Title = Raw:match('<title.->(.-)</title>') or 'Untitled'

            end

            Feeds[f].Link  = Raw:match(Type.MatchLink) or nil

            local Items = {}
            for RawItem in Raw:gmatch(Type.MatchItem) do
                    local Item  = {}

                    -- MATCH RAW DATA
                    Item.Unread = 1

                    if (t == 'GoogleCalendar') then

etc...

3. The next thing to do is take your newly modified lua file and rename it to "Reader" so the whole file is now "Reader.lua".

4. Following this you want to insert this file into Enigma. This is done by taking the new lua file and replacing the old one.

i. Start by finding your Rainmeter folder. (Mine is in my documents) ii. Go to "Rainmeter --> Skins --> Enigma --> @ Resources --> Measures." (NB. "@ Resources" does not have a space between the "@" and "Resources", Github just thought it was a person). iii. Rename the current Reader.lua file "Reader.old.lua" (backups are always good). iv. Take your new lua file and paste it in the old one's place.

5. Now the options changing. The old reader used an XML file which Google unfortunately dropped support for so now we're using ICAL instead.

i. Go to Google Calendar and then go to "My Calendars" on the right and click the little arrow that appears when you hover over the calendar you want. ii. Click on "Calendar Settings". iii. Right click on the "ICAL" button next to Private Address and copy the link. iv. Paste this link into the Options widget in Enigma in the section marked with a book. v. Repeat for your other calendars.

6. Sit back and enjoy a nearly working GCal :-)

I hope this is what you were looking for.

A massive thanks to everyone involved in this and if I have missed any one out let me know and I'll add them in.

mrshllstock commented 8 years ago

@lew101 thank you very much for the detailed repl, I tried everything and now the rainmeter Gcal portion is just perputually saying "Loading..."

mrshllstock commented 8 years ago

@lew101 would it be helpful if I uploaded what I now have as my reader.lua?

http://pastebin.com/HwRye6yr in case it is

lew101 commented 8 years ago

No problem @kirbyplz. And I think I've worked out what you've done wrong. You have these two lines missing from your file:

        for RawItem in Raw:gmatch(Type.MatchItem) do
                local Item  = {}

image (Courtesy of https://www.diffnow.com)

They should be between local Items = {} And -- MATCH RAW DATA So hopefully adding those back should fix it for you

mrshllstock commented 8 years ago

TYVM that fixed it! Unforunately I don't dig the reader format as well, but it works :) Was hoping to have it in the calendar format but nonetheless it now shows me my events :)

Also incase someone else stumbles upon this issue and wants an easy copy paste fix, here is what is contained in my version of the reader.lua file that lew101 guided me to making! http://pastebin.com/55rMHdqz

Lefky commented 8 years ago

mine still says 'could not identify a valid feed format' :( i tried the 2 last files (with changes applied on the first one)

Gregory2001 commented 8 years ago

This has been gone over numerous times. There is no cure.