2008-11-09, 13:58
^Mask^ Wrote:Ok, so I get the part on what is needed: InitialiseVariables, CreateEpisodeItem and CreateVideoItem. CreateFolderItem is only required if you need to create a folder (for example of a set of programs, or maybe even splitting it up in "Seasons"). UpdateVideoItem is only used in case you don't have all the information (item.complete = False) (for example: the episode link only shows a href to part of the fully qualified url: /media/files/whatever.asf instead of http://www.myurl.com/media/files/whatever.asf or a missing thumb, whatever).Yep, this is completely true.
^Mask^ Wrote:Ok, I think I get that: I imagine you to use the word Program as a synonym for "TV-Shows", right? Like an online TV channel hosts multiple different TV Shows, and therefore a TV Show (or Program) could have multiple files under it, hence your statement Programs - Files.This is exactly what I meant.
Next, Folders contain Files (got it: Seasons could have different Episodes, or they could create different Categories like "Funny" with a long list of videos to view).
^Mask^ Wrote:Finally: Folders can again contain other things like new folders or new programs.Nope, folders can only contain other folders and video files.
^Mask^ Wrote:Ok, so ParseMainlists module is only needed in case you want to parse the main page for programs or in case you want to just define your own folder with different feed formats. In my case, what I can do is define different folders there for the different file formats: H264, iPOD, DivX and MPEG-4. Each of these folders has a different XML feed attached that can be parsed.You don't have to define the ParseMainlists. If you don't then the default will be used (the one in chn_class.py). If you do create one, you will have to write your own code to generate items.
^Mask^ Wrote:The part that confuses me is what comes next:You are almost right:
CreateEpisodeItem
CreateVideoItem
CreateFolderItem
Can you share with me what each of these modules does, maybe according to a simple example? So, ParseMainList takes the mainURL and uses self.episodeItemRegex to create a list of items using CreateEpisodeItem. CreateVideoItem and CreateFolderItem are the ones that actually create entries on the list, is it?
- ParseMainlist (called from chn_class.py) uses CreateEpisodeItem and the self.episodeItemRegex to create mainlist items (the naming EpisodeItem is a bit wrong/strange).
- ProcessFolderList (called from chn_class.py) uses CreateVideoItem and CreatefolderItem combined with self.folderItemRegex and self.videoItemRegex. It uses the regexes to determine what items are present on a page/url. Then for each of the results from the self.videoItemRegex it calls CreateVideoItem and passes on the results from the regex as the parameter resultSet. And for each of the results from the self.folderItemRegex it calls CreateFolderItem and passes on the results from the regex as the parameter resultSet.
So it is important that your Regexes have groups that define the name of the item and the url of the item. Let's say that the regex has 2 groups: first one gives the name and the second one the url. Then in the Create(Video/Folder)Item methode, you can use those groups like this: name = resultSet[0] and url = resultSet[1].
So what I can see from your code, it seems to be OK. But, I from the log I see that your regexes are not OK. Check if all the ( and ) are balanced.