2011-01-06, 20:51
mbetter Wrote:Can I hold you to this? :) I'm trying to get the hfboards.com forums to work, is there any chance you can take a peek and give me a heads up on some things that I'm going to have to change? I can muddle my was through regular expressions, I'm just looking for a "what is used for what" kind of overview and a list of a few things that I'm going to have to look at.
I did some of the work for you :)
Below is the start of a file for hfboards.com
This gets you the forums list and threads list. Notice the import at the top. This uses everything from the existing forum.xbmc.org file, and everything after it overrides that file. Most of it won't need to be changed in the hfboards.com file. I set some colors in the them to match the site. Change them if you wish. The logo won't show up in current versions. I found and fixed a bug that caused it not to work on full URL's.
What you'll need to do from here is copy the filter:replies and filter:post over from the forum.xbmc.org file and modify them to work. The filter:replies grabs all the text that contains the post data, and the filter:post extracts the actual data from that text. You may not need to alter the filter:replies, but you will need to modify the filter:post for sure. I got it to list posts on one thread but the data was empty. On other posts it would hang the script, probably stuck in a regex loop.
Once that is working you can test out some of the other things, like subscriptions, private messages, logins, etc. Some or all may work already.
The files are located in the addon folder under forums.
Some notes on the file syntax:
The basic line format:
type:id=data
data includes everything after the = until the end of the line (no quotes,etc)
ex: url:login=index.php
There is also the copy syntax:
type:id===id
The following will use the same filter for subscriptions as threads and must follow the threads def
filter:subscriptions===threads (must follow the threads def)
Lines that start with # are considered comments, blank lines are ignored.
I learned a bunch about Regular Expression while writing this addon, so some of my earlier ones are not very well done even though they work :)
Anyway take a look and drop me an email at [email protected] with any questions, and so I can send you files if necessary.
Code:
import:forum.xbmc.org
url:base=http://hfboards.com/
filter:forums=(?:(?P<subforum>\s)|<div>)(?:<a\shref="forumdisplay.php\?).*?f=(?P<forumid>\d+)">(?P<title>.*?)</a>(?:</div><div class="smallfont">(?P<description>.*?)</div>)?
filter:threads=<!---/IGNORE THREAD --->(?P<sticky><span style="float:right"> <img class="inlineimg" src="images/misc/sticky.gif")?.*?<a href="showthread.php\?[^<>]*?t=(?P<threadid>\d+)"\sid="thread_title.*?>(?P<title>.*?)</a>.*?window.open\(\'member.php\?.*?u=\d+\', \'_self\'\)">(?P<starter>.*?)</span.*?<a class="speciallink" href="member.php[^>]*?>(?P<lastposter>.*?)</a>
### Theme ####################################
theme:window_bg=FF193F6B
theme:title_bg=FFD7DBE7
theme:title_fg=FFCB3232
theme:desc_fg=FF000000
theme:post_code=FF005500