MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. STH
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    S
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 5
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: Calendar shows "no entries" after MM Update

      @tgeimer
      Thanks for your solution! Saved my day ;)

      posted in Troubleshooting
      S
      STH
    • RE: Owncloud integration - Birthday Calendar

      Here is the carefree package :)
      The python script will open the Birthday.ics file directly from your Owncloud, change the year automaticly and safe the output file at a fixed location. Python “Requests” library is used to connect to your Owncloud.
      This script works in linux. The script above was only working in MS Windows.
      The script can be run by cron e.g. every 30min so you will see updates and you don’t have to worry about the next year ;)

      #!/usr/bin/env python
      # -*- coding: utf-8 -*-
      
      # Time functions for current year 
      import time
      from time import localtime, strftime
      
      # Use Requests lib to download Owncloud Birthday calendar .ics file
      import requests #http://docs.python-requests.org/en/master/
      
      year = strftime("%Y", localtime()) #Get the current year
      
      try: #Catch errors
      	url = 'https://YOUR_URL/remote.php/dav/calendars/USER/BIRTHDAYCALENDAR?export' # Url to your Owncloud Birthday caldender .ics file. Replace parts written in capitals
      	download = requests.get(url, auth=('USER', 'PASS')) #Replace parts written in capitals
      	fobj_in= download.text.split("\n") #Split file
      	fobj_out = open("/home/pi/MagicMirror/modules/Birthdays/geburtstage.ics","w") #Output file
      
      	for line in fobj_in:
      		if line.find("DTSTART") > -1 or line.find("DTEND") > -1: #Change year of DTSTART oder DTEND lines
      			#Format of the string: DTSTART;VALUE=DATE:19650521	#DTEND;VALUE=DATE:19650522
      			split=line.split(":")
      			helpline=split[0]+":"+year+split[1][4:]
      			fobj_out.write(helpline.encode('utf-8')+"\n")		
      		else: #Change nothing, just copy the line
      			fobj_out.write(line.encode('utf-8')+"\n")
      	fobj_out.close() 
      	download.close() 
      	
      except requests.exceptions.RequestException as e:  # This is the correct syntax
          print(e)
      
      posted in General Discussion
      S
      STH
    • RE: Owncloud integration - Birthday Calendar

      Hi Mykle1,

      that is a good idea, thank you! I have a workaround now, but I need to change the files every year :(.
      You can download the Birthday .ics from Owncloud and save it localy.
      In the config.js file I changed the calendar url to work with local .ics file:
      url: ‘webcal://localhost:8080/modules/Birthdays/geburtstage_2017.ics’, //Use a local file

      Then I wrote a small python script (for Windows) to change the year of the .ics file, as you proposed above, and it worked.

      If anyone is interessted you can use my python script below. It will open the “geburtstage.ics” file which needs to be located in the same folder as the python script. The script will ask for the year you want to change to and will create a new ics file containing the changed birthday years.

      //your code here

      **Birthday_ICS.py**
      #Ask for the year you want to change to
      year = input("Please enter the year you want to change to: ")
      
      fobj_in = open("geburtstage.ics", "r") #Source file
      fobj_out = open("geburtstage_" + year + ".ics","w") #Output file
      
      for line in fobj_in:
      	if line.find("DTSTART") > -1 or line.find("DTEND") > -1: #Change year of DTSTART oder DTEND lines
      		#Format of the string: DTSTART;VALUE=DATE:19650521	#DTEND;VALUE=DATE:19650522
      		split=line.split(":")
      		helpline=split[0]+":"+year+split[1][4:]
      		fobj_out.write(helpline)		
      	else: #Change nothing, just copy the line
      		fobj_out.write(line)
      print("Complete!") #Let me know when you are finished
      #Close the documents
      fobj_in.close()
      fobj_out.close()
      
      posted in General Discussion
      S
      STH
    • Owncloud integration - Birthday Calendar

      Re: OwnCloud integration
      Owncloud calendar integration works fine except for the birthday calendar. Magic Mirror calendar module is not showing the birthdays.
      In the Owncloud Birthday calendar .ics file I found, that the birthday dates are stored with the birth year.
      Example for 22MAY1965
      DTSTART;VALUE=DATE:19650521
      DTEND;VALUE=DATE:19650522

      I assume that the calendar module is only showing entries of the current year.
      Is there a workaround or module existing that could help here?

      Thank you in advance.

      posted in General Discussion owncloud birthday calendar
      S
      STH
    • 1 / 1