PEAK XOOPS - Re: Events feeds? in englishin japanese

Re: Events feeds?

List posts in the topic

question Re: Events feeds?

msg# 1.2
depth:
1
Previous post - Next post | Parent - No child | Posted on 2004/10/9 1:21
kazuki  Private   Posts: 3
I asked the same question a while ago. I think it'll be included in future releases. So I did some primitive hacks on my site to provide RSS feed. Shown below is what I did.

SUMMARY
piCal ----> .ics(iCalendar-format) file
.ics ----> PHP iCalendar
PHP iCalendar ----> RSS feed

My server creates an iCalendar-format calendar file from the piCal web interface automatically with the shell script shown below. It's activated via cron. I's pretty odd, but shell scripting is the only programming method that I have some experience with.

######Shell Script to Create iCalendar-format Calendar File #####
#!/bin/sh

#URL at which 100 events from now are shown
URLHUNDRED='http://site.name/xoops.dir/modules/piCal/index.php?smode=List&num=100'

#Output iCalendar file
ICSHUNDRED='/PHP_iCalendar_Directory/calendars/events.ics'

# tmp file saving event_ids
PARSEDID='/tmp/parsed.event_id.txt'


### parser() $1(URL) $2(Output ids) Activated by ics_gen()###
### obtains event_ids shown in the $URL, save them in $PARSEDID
parser()
{
#echo $1 $2

wget -q $1 -O - |\
\
tr \< \\n |\
grep "action=View&event_id" |\
\
tr \= \\n |\
tr \' \\n |\
\
grep "^[0-9]*[0-9]$" |\
\
sort -u |\
\
sed -e 's/^/event_ids%5B%5D=/' \
-e 's/$/output_ics=iCalendar%28Win%29/' |\
\
tr \\n \& |\
\
sed -e 's/$/output_ics=iCalendar%28Win%29/' \
> $2

return
}
### /parser() $1(URL) $2(Output ids) ###


### ics_gen() $1(URL) $2(Output ics) ###
### Using event_ids in $PARSEDID, request iCalendar-format event information
### Utilizes POST request function of curl (-d option)
ics_gen()
{
parser "$1" "${PARSEDID}" ### Activates parser()

curl --silent \
-d `cat ${PARSEDID}` \
--url http://site.name/xoops.dir/modules/piCal/ \
> $2

return
}
### /ics_gen() $1(URL) $2(Output txt) $3(Output ics) ###


### Generates .ics files utilizing ics_gen() and parser()

ics_gen $URLHUNDRED $ICSHUNDRED


exit

#### Script Ends Here ####

Then the iCalendar-format calendar is read by PHP iCalendar ( http://phpicalendar.net/forums/ ), which does have RSS feed function. (You'll have to put the .ics file in the "calendars" directory in the PHP iCalendar parent directory.)

You just access iCalendar page which is showing the content of .ics file created by the script.

The RSS feed will be very crude, but I don't really mind. If someone can improve the methods, I would appreciate it.
Votes:0 Average:0.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!