openmensarss

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2025 License: MIT Imports: 5 Imported by: 0

README

OpenMensaRSS

OpenMensaRSS Logo

OpenMensa RSS library and feed generation in Go.

Libary Usage

This library offers two simple functions to query OpenMensa using go-openmensa for a canteen, which return a gorilla/feeds Feed.

The returned feed structs can subsequently be modified and exported as RSS or Atom.

How does this work?

Furthermore, this repository also implements automatic RSS feed generation. The daily generated feeds are then published on GitHub pages. The RSS feed can then be used, embedded or read on any website or reader. For instance, you can add a RSS feed to your Tuwel frontpage.

The published RSS feeds use the same IDs as OpenMensa, e.g. the TU Wien canteen is served at https://schicho.github.io/openmensarss/1098.xml.

A GitHub Actions runner queries the OpenMensa API every day for selected canteens. Using this glue code library the runner creates a RSS feed for each canteen. Subsequently, the generated RSS feeds are deployed on GitHub pages.

More feeds can be found at https://schicho.github.io/openmensarss/.

Documentation

Index

Constants

View Source
const OpenMensaRSSGenerator string = "OpenMensa RSS Generator"

Variables

View Source
var RSSMetadata = struct {
	Description string
	Author      feeds.Author
	Link        feeds.Link
	Image       feeds.Image
}{
	Description: "Automated RSS feed using OpenMensa",
	Author:      feeds.Author{Name: OpenMensaRSSGenerator, Email: "johann.schicho@tuwien.ac.at"},
	Link:        feeds.Link{Href: "https://schicho.github.io/openmensarss/"},
	Image:       feeds.Image{Url: "https://schicho.github.io/openmensarss/omrss.gif", Title: OpenMensaRSSGenerator, Link: "https://schicho.github.io/openmensarss/"},
}

RSSMetadata allows setting of general metadata for the feeds generated using this library's functions. All fields can be modified here before generation, or of course after generation on a per feed basis.

Functions

func FeedForCanteen

func FeedForCanteen(canteen *openmensa.Canteen, date time.Time) (*feeds.Feed, error)

FeedForCanteen creates a feed of the canteen menu on a certain day. The Canteen struct specifies the canteen from OpenMensa. The day is selected by passing a time stamp.

Throws an error if the OpenMensa API does not provide data for the specified input.

func FeedForCanteenID

func FeedForCanteenID(id int, date time.Time) (*feeds.Feed, error)

FeedForCanteenID creates a feed of the canteen menu on a certain day. The id specifies the canteen from OpenMensa. The day is selected by passing a time stamp.

Throws an error if the OpenMensa API does not provide data for the specified input.

Types

This section is empty.

Directories

Path Synopsis
cmd
generaterss command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL