{ "info": { "author": "Ontje L\u00fcnsdorf", "author_email": "oluensdorf@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Timetable - generate timetables from iCal files\r\n===============================================\r\n\r\niCal is a relatively compact albeit unintuitive and inconvenient text format\r\nfor calendaring and scheduling information. Recurring events can be defined\r\nthrough a large set of rules, which makes the format compact but inconvenient\r\nfor automatic processing. The intention of this package is to provide functions\r\nto ease the automatic processing of iCalendar files by converting the iCalendar\r\ninformation into a timetable.\r\n\r\nInstallation\r\n------------\r\n\r\nTimetable requires Python 2 or 3. You can install Timetable easily via `pip\r\n`_:\r\n\r\n.. code-block:: bash\r\n\r\n $ pip install timetable\r\n\r\nDocumentation & Code\r\n--------------------\r\n\r\nYou can find `a short guide`__, `some examples`__, and the `API reference`__ in\r\nthe `online documentation`__. The source code is available on `Bitbucket`__.\r\n\r\nIf you find any bugs, please post them in the `issue tracker`__.\r\n\r\n__ https://timetable.readthedocs.org/en/latest/guide.html\r\n__ https://timetable.readthedocs.org/en/latest/examples.html\r\n__ https://timetable.readthedocs.org/en/latest/api.html\r\n__ https://timetable.readthedocs.org/en/latest/\r\n__ https://bitbucket.org/luensdorf/timetable\r\n__ https://bitbucket.org/luensdorf/timetable/issues\r\n\r\nGetting started\r\n---------------\r\n\r\nA timetable is a sorted sequence of tuples containing start and end datetime\r\nof an entry, for example ``(start, end, entry)``. ``start`` and\r\n``end`` are *datetime* offset-naive objects (e.g. containing no timezone\r\ninformation) in UTC time. The ``entry`` is a dictionary, containing arbitrary\r\nvalues.\r\n\r\nThe following example is a valid timetable list:\r\n\r\n.. code-block:: python\r\n\r\n [\r\n (datetime(2015, 1, 1, 12), datetime(2015, 1, 1, 13), {}),\r\n (datetime(2015, 1, 2, 12), datetime(2015, 1, 2, 13), {}),\r\n (datetime(2015, 1, 3, 12), datetime(2015, 1, 3, 13), {}),\r\n ]\r\n\r\nTimetables can be generated from iCal files. The following example shows how a\r\ntimetable is generated from all VEVENT entries in a iCal calendar. The example\r\nprints the start *datetime* of each entry as well as the calendar events\r\nsummary:\r\n\r\n.. code-block:: python\r\n\r\n >>> from timetable import parse_ical, generate_timetable\r\n >>>\r\n >>> icaldata = b\"\"\"\r\n ... BEGIN:VCALENDAR\r\n ... BEGIN:VEVENT\r\n ... UID:0\r\n ... DTSTART:20150101T120000Z\r\n ... DTEND:20150101T130000Z\r\n ... RRULE:FREQ=DAILY;COUNT=3;BYDAY=TH,FR\r\n ... SUMMARY:event a\r\n ... END:VEVENT\r\n ... BEGIN:VEVENT\r\n ... UID:1\r\n ... DTSTART:20150101T123000Z\r\n ... DTEND:20150101T133000Z\r\n ... RRULE:FREQ=DAILY;COUNT=3\r\n ... SUMMARY:event b\r\n ... END:VEVENT\r\n ... END:VCALENDAR\r\n ... \"\"\"\r\n >>> calendar = parse_ical(icaldata)[0]\r\n >>> for start, end, entry in generate_timetable(calendar, b'vevent'):\r\n ... summary = str(entry['item'][b'summary'][0].value.decode('utf-8'))\r\n ... print('%s %s' % (start.isoformat(), summary))\r\n 2015-01-01T12:00:00 event a\r\n 2015-01-01T12:30:00 event b\r\n 2015-01-02T12:00:00 event a\r\n 2015-01-02T12:30:00 event b\r\n 2015-01-03T12:30:00 event b\r\n 2015-01-08T12:00:00 event a\r\n\r\nspam or eggs?\r\n-------------\r\n\r\nTimetable data can be used to calculate metrics for time management, like for\r\nexample, compute the time spent in meetings or working on projects.\r\n\r\nHowever, of more pressing concern is the question if you spent more time eating\r\neggs or spam for lunch in two months, assuming you eat spam for 45 minutes but\r\nonly every other week on monday and tuesday whereas you eat eggs for 15 minutes\r\nevery week but only from wednesday to friday:\r\n\r\n.. code-block:: python\r\n\r\n >>> from datetime import datetime, timedelta\r\n >>> from timetable import parse_ical, generate_timetable, clip_timetable\r\n >>> \r\n >>> icaldata = b\"\"\"\r\n ... BEGIN:VCALENDAR\r\n ... BEGIN:VEVENT\r\n ... UID:0\r\n ... DTSTART:20150101T120000Z\r\n ... DTEND:20150101T124500Z\r\n ... RRULE:FREQ=WEEKLY;BYDAY=MO,TU;INTERVAL=2\r\n ... SUMMARY:spam\r\n ... END:VEVENT\r\n ... BEGIN:VEVENT\r\n ... UID:1\r\n ... DTSTART:20150101T120000Z\r\n ... DTEND:20150101T121500Z\r\n ... RRULE:FREQ=WEEKLY;BYDAY=WE,TH,FR\r\n ... SUMMARY:eggs\r\n ... END:VEVENT\r\n ... END:VCALENDAR\r\n ... \"\"\"\r\n >>> calendar = parse_ical(icaldata)[0]\r\n >>> \r\n >>> start = datetime(2015, 1, 1)\r\n >>> end = datetime(2015, 3, 1)\r\n >>> timetable = clip_timetable(generate_timetable(calendar), start, end)\r\n >>> \r\n >>> time = {b'spam': 0, b'eggs': 0}\r\n >>> for start, end, entry in timetable:\r\n ... food_name = entry['item'][b'summary'][0].value\r\n ... time[food_name] += (end - start).total_seconds() / 3600\r\n >>> \r\n >>> print('spam: %.2f, eggs: %.2f' % (time[b'spam'], time[b'eggs']))\r\n spam: 6.75, eggs: 6.50\r\n\r\nIt looks like spam.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/luensdorf/timetable", "keywords": "time,timetable,ical,calendar", "license": "UNKNOWN", "maintainer": "", "maintainer_email": "", "name": "timetable", "package_url": "https://pypi.org/project/timetable/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/timetable/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.org/luensdorf/timetable" }, "release_url": "https://pypi.org/project/timetable/0.2/", "requires_dist": null, "requires_python": null, "summary": "Generate timetables from iCal data.", "version": "0.2" }, "last_serial": 1978746, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "610f43b7973778f434f5c31b968a1c69", "sha256": "c12a2ecd5bc6126d3b1268167f7b2762de9645d50355b2692c531cf38fa27765" }, "downloads": -1, "filename": "timetable-0.2.tar.gz", "has_sig": false, "md5_digest": "610f43b7973778f434f5c31b968a1c69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12213, "upload_time": "2016-02-20T13:51:15", "url": "https://files.pythonhosted.org/packages/bc/3f/38be89eb6c3b08acb557e5266d7501f0a0fbad80aa9b5a4114b27ea832c4/timetable-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "610f43b7973778f434f5c31b968a1c69", "sha256": "c12a2ecd5bc6126d3b1268167f7b2762de9645d50355b2692c531cf38fa27765" }, "downloads": -1, "filename": "timetable-0.2.tar.gz", "has_sig": false, "md5_digest": "610f43b7973778f434f5c31b968a1c69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12213, "upload_time": "2016-02-20T13:51:15", "url": "https://files.pythonhosted.org/packages/bc/3f/38be89eb6c3b08acb557e5266d7501f0a0fbad80aa9b5a4114b27ea832c4/timetable-0.2.tar.gz" } ] }