Coder Social home page Coder Social logo

michochieng / icsparser Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 10.12 MB

This program finds all google calendar files in a directory, parses the files and prints the output into the CFUR playlist schedule in adobe illustrator.

License: MIT License

Python 53.02% JavaScript 28.86% TeX 18.12%
calendar python schedule

icsparser's Introduction

ICS File Parser

This program finds all google calendar (ics) files in the working directory, parses the files and prints the output into the CFUR playlist schedule in adobe illustrator.

Classes

Event

This class is used to encapsulate parsed events.

Parser

This class handles parsing incoming text files and printing the parsed data to an output file.

    Functions

  • parseFile
    • This function handles parsing data from an incoming text file in multiple steps.
    1. Lines from the text file are read and stored in the lines variable.
    2. The lines variable is then used in a for loop to scan for specific event attribute identifiers.
    3. Once an identifier is found the data from that line will cleaned and saved into a temporary varible for future use.
    4. At the end of an event block the temporary variables are used to create an Event object that is then push to a list of Events.
  • getRruleDay
    • This function is used in the parseFile function and determines what day an event will regularly reoccur on then returns that day in the form of a string.
  • cleanList
    • This function is used to create a new 'clean' event list that excludes past events that have been saved to the event list that's used to hold all events saved from the parseFile function.
  • getDate
    • This function uses the current days datetime to get the date of the most recent sunday in the current week.
  • convertDay
    • Used to find what day of the week Daily events start on by converting a datetime to one of the
  • printEvents
    • This Function will create a new file and print Events from the earleir mentioned Event list to said file.
  • getFiles
    • This will find all the files in the current directory (in this case the icsParser directory) with the .ics file extension
  • stripGenre
    • Strips genre tags (anything inside and including brackets) from all of the event titles

Example

Creating a parse file for adobe illustrator

my@comp: python3 icsParser.py
  • Example of output parse file
-----EVENT 113
Throwback Funk & Soul
19
20220120
BYDAY=TH
-1
-----EVENT 114
Folk Traditions
10
20210909
BYDAY=TH
20220120
-----EVENT 115
Folk Traditions (Roots)
10
20220120
BYDAY=TH
-1

Generating schedule from parse file

  • In illustrator goto the 'file' tab, select 'scripts' then 'other scritps' and select the adobe.jsx file. This will run the script and generate a version of the schedule below.

output

  • A PNG of the schedule will be saved in the scripts folder.

Notes

  • The files to be parsed must be in the same directory as the python file otherwise they wont be found.
  • More detail on the functions can be found in the comments.
  • Should be ran using python 3.x

Fixes/Additions

  • Text alignment in cells
  • Varying text size depending on length of the string
  • Increasing text range stroke width to increase visability
  • Automatically get ics file names from the working directory instead of entering manually
  • Exporting to PDF once schedule is created

icsparser's People

Contributors

michochieng avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.