[RELEASE] Forum Browser - Programs Addon

  Thread Rating:
  • 5 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
scalpel Offline
Senior Member
Posts: 106
Joined: Jun 2010
Reputation: 0
Post: #41
It looks like you have too poor internet connection.
find quote
ruuk Online
Skilled Python Coder
Posts: 897
Joined: Aug 2005
Reputation: 123
Location: Bremerton, WA USA
Post: #42
lzoubek Wrote:Hi, cool addon.

I've just tried it and I have threading issues. Right now plugin is in deadlock, dialog window hangs up and is waiting for some thread. Here is pastebin. What I did was browsing a few topics. It took quite long time for one of them to load, so I've stopped it. Then I tried to login which took long time too, so I've decided to close addon.

The way I have the threading working, when you cancel an action or change an action, it tells the thread to stop and then starts a new thread if you've started some other action. When the old thread finishes any current blocking activities it will then see that it is stopped and not continue. I do this in this way because I cannot stop a blocking operation (such as opening a URL) and cannot kill the thread from the main thread. Normally this is not a problem except that if the site is down or some such thing then the thread will keep waiting for the open to finish. Then, when exiting the script I have to wait for any running threads to finish before it closes or else it will crash XBMC.

Hope that made sense Smile

One thing I could do is make the timeout shorter, or configurable.

If anyone can tell me a way to kill a thread from the main thread that would be great. I found one way, but it required modules not available in XBMC.
find quote
ndeshmukh Offline
Senior Member
Posts: 258
Joined: Aug 2010
Reputation: 1
Post: #43
I was just on pastebin, and saw there an api link, and was wondering when you would get around to using it, so that one press of a button and the debug log is pasted to pastebin, and the url recovered is inserted into the post.

Although that debug log would have a little unnecessary clutter, but still just sounded funny from the perspective of laid back couch automation.

Smile
find quote
mbetter Offline
Member
Posts: 62
Joined: Nov 2010
Reputation: 0
Post: #44
ruuk Wrote:If anyone wants to extend Forum Browser to access other forums, the forum format files are separate from the script, and anyone with knowledge of Regular Expressions can create one without needing to do any scripting. I'd be happy to help anyone do that Smile

Can I hold you to this? Smile 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.
find quote
ruuk Online
Skilled Python Coder
Posts: 897
Joined: Aug 2005
Reputation: 123
Location: Bremerton, WA USA
Post: #45
mbetter Wrote:Can I hold you to this? Smile 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.

Yeah, no problem. I'll get back to you with more, probably tomorrow - I'm off to bed right now. I took a glance, and it looks like a vBulletin forum, which is good, because three of the four forums I've done are vBulletin. I'll probably go over one of the forum files and add more notes to the comments, and send that to you with some tips and such. If you want you can email me at xbmc@2ndmind.net and I can reply to you from there.
find quote
ruuk Online
Skilled Python Coder
Posts: 897
Joined: Aug 2005
Reputation: 123
Location: Bremerton, WA USA
Post: #46
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 xbmc@2ndmind.net 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
find quote
ruuk Online
Skilled Python Coder
Posts: 897
Joined: Aug 2005
Reputation: 123
Location: Bremerton, WA USA
Post: #47
Submitted... may take some time to appear on repo.

Added the ablility to follow post links on my new Web Viewer addon.
find quote
jolid Offline
Senior Member
Posts: 123
Joined: Jul 2010
Reputation: 0
Location: Gothenburg, Sweden
Post: #48
Just recently i started getting this script error, heres my debug log:

http://pastebin.com/gQUytBxb
find quote
ruuk Online
Skilled Python Coder
Posts: 897
Joined: Aug 2005
Reputation: 123
Location: Bremerton, WA USA
Post: #49
jolid Wrote:Just recently i started getting this script error, heres my debug log:

http://pastebin.com/gQUytBxb

How did you install the addon? The error is caused because it's failing to import from the Web Viewer addon, which if you installed from the repo, should have been installed automatically. If you install the Web Viewer addon, the error should go away.
find quote
jolid Offline
Senior Member
Posts: 123
Joined: Jul 2010
Reputation: 0
Location: Gothenburg, Sweden
Post: #50
ruuk Wrote:How did you install the addon? The error is caused because it's failing to import from the Web Viewer addon, which if you installed from the repo, should have been installed automatically. If you install the Web Viewer addon, the error should go away.

Thank you, that fixed it. Cant remember uninstalling the web viewer though but yeah, I guess I must have..
find quote
Post Reply