--- a/plugin.video.mediathek/mediathek/bayerisches.py
+++ b/plugin.video.mediathek/mediathek/bayerisches.py
@@ -29,7 +29,7 @@
   def name(self):
     return "BayernFS";
   def isSearchable(self):
-    return False;
+    return True;
   def __init__(self, simpleXbmcGui):
     self.gui = simpleXbmcGui;
     
@@ -38,19 +38,20 @@
     else:
       self.baseType = "rtsp_mov_http"
     
+    self.channel = "bfs"
+    #self.channel = "bfsalpha"
+    
     self.root_url="http://mediathek-video.br.de/js/config.js";
     self.regexp_findArchive=re.compile("http://.*/archive/archive\.xml\.zip\.adler32");
     
-    self.menuTree = (
-      TreeNode("0","Alle","http://LoadAll",True),
-      );
-
-
-  def buildPageMenu(self, link, initCount):
-    self.gui.log("buildPageMenu: "+link);
-
+    self.menuTree = [
+      TreeNode("0","Alle","LoadAll",True),
+      TreeNode("1","Alle Mitschnitte","LoadAusstrahlung",True),
+      TreeNode("2","Alle Podcasts","LoadPodcasts",True),
+      ];
+    
+    #Zip Archiv einlesen
     a=self.loadAndUnzip();
-    print a
     try:
       self.xml_cont = minidom.parseString(a); 
     except:
@@ -58,14 +59,73 @@
         TreeNode("0","Plugin Broken, Sry ;)","http://LoadAll",False,initCount),
       );
       return;
+
+    #Alle Sendungen einlesen
+    self.broadcasts = {}
+    for itemNode in self.xml_cont.getElementsByTagName("sendungen")[0].getElementsByTagName("sendung"):
+      broadcast = self.extractBroadcastInformation(itemNode);
+      self.broadcasts[broadcast['id']] = broadcast;
+    
+    #Sendungen raussuchen, f��r die es Mitschnitte gibt
+    self.sendungen = {}
+    for itemNode in self.xml_cont.getElementsByTagName("ausstrahlung"):
+      sender = itemNode.getAttribute("sender");
+      sendung = self.readText(itemNode,"sendung")
+      if not self.broadcasts[sendung]['sender']:
+        self.broadcasts[sendung]['sender'] = sender
+      if self.broadcasts[sendung]['sender'] != self.channel:
+        self.broadcasts[sendung]['display'] = False
+      else:
+        videos = itemNode.getElementsByTagName("videos")[0];
+        if videos.hasChildNodes():
+          self.broadcasts[sendung]['display'] = True
+    
+    #Sendungen anzeigen
     displayItems=[];
-    for itemNode in self.xml_cont.getElementsByTagName("ausstrahlung"):
-      displayItem = self.extractVideoInformation(itemNode);
-      if(displayItem is not None):
-        displayItems.append(displayItem);
+    for broadcast in self.broadcasts.itervalues():
+      if broadcast['display']:
+        displayItems.append(broadcast);
+
+    x=3
+    for displayItem in sorted(displayItems, key = lambda item:item['name'].lower(), reverse=False):
+      self.menuTree.append(TreeNode(str(x),displayItem['name'],displayItem['id'],True));
+      x = x+1
+
+  def buildPageMenu(self, link, initCount, searchText = ""):
+    self.gui.log("buildPageMenu: "+link);
+    displayItems=[];
+    if not link == "LoadPodcasts":
+      #Mitschnitte
+      for itemNode in self.xml_cont.getElementsByTagName("ausstrahlung"):
+        sendung = self.readText(itemNode,"sendung")
+        if self.broadcasts[sendung]['sender'] == self.channel:
+          if link == "LoadAusstrahlung" or link == "LoadAll" or link == "LoadSearch" or link == sendung:
+            picture = self.broadcasts[sendung]["node"].getAttribute("bild")
+            displayItem = self.extractVideoInformation(itemNode, picture, searchText);
+            if(displayItem is not None):
+              displayItems.append(displayItem);
+    if not link == "LoadAusstrahlung":
+      #Podcasts
+      for itemNode in self.broadcasts.itervalues():
+        if itemNode['sender'] == self.channel:
+          if link == "LoadAll" or link == "LoadPodcasts" or link == "LoadSearch" or link == itemNode['id'] :
+            if itemNode["node"].getElementsByTagName("podcasts")[0].hasChildNodes():
+              podcasts  = itemNode["node"]
+              for podcastFeed in podcasts.getElementsByTagName("podcasts")[0].getElementsByTagName("feed"):
+                picture = self.readText(podcastFeed,"image")
+                for podcastNode in podcastFeed.getElementsByTagName("podcast"):
+                  displayItem = self.extractPodcastInformation(podcastNode,picture, searchText);
+                  if(displayItem is not None):
+                    displayItems.append(displayItem);
+
     itemCount = len(displayItems) +initCount    
     for displayItem in sorted(displayItems, key = lambda item:item.date, reverse=True):
       self.gui.buildVideoLink(displayItem,self,itemCount);
+
+  def searchVideo(self, searchText):
+    searchText = searchText.lower()
+    self.buildPageMenu("LoadSearch", 0, searchText)
+
   def readText(self,node,textNode):
     try:
       node = node.getElementsByTagName(textNode)[0].firstChild;
@@ -112,41 +172,45 @@
 
   def parseDate(self,dateString):
     return time.strptime(dateString,"%Y-%m-%dT%H:%M:%S");
-    
-  def extractVideoInformation(self, itemNode):
+ 
+  def extractBroadcastInformation(self,itemNode):
+    broadcast = {}
+    broadcast["id"] = itemNode.getAttribute("id")
+    broadcast["name"] = itemNode.getAttribute("name")
+    broadcast["bild"] = itemNode.getAttribute("bild")
+    broadcast["sender"] = None
+    if itemNode.getElementsByTagName("podcasts")[0].hasChildNodes() and self.channel == "bfs":
+      broadcast["display"] = True
+    else:
+      broadcast["display"] = False
+    broadcast["node"] = itemNode
+    return broadcast
+    
+  def extractVideoInformation(self, itemNode, picture = "", searchText = ""):
     title = self.readText(itemNode,"titel");
     
     dateString = self.readText(itemNode,"beginnPlan");
     pubDate = self.parseDate(dateString);
     
-    try:
-      subtitle = self.readText(itemNode,"nebentitel");
-    except:
-      subtitle = "";
-    
-    try:
-      description = self.readText(itemNode,"beschreibung");
-    except:
-      description = "";
-    
-    try:
-      picture = self.readText(itemNode,"bild");
-    except:
-      picture="";
-
+    subtitle = self.readText(itemNode,"nebentitel");
+      
+    description = self.readText(itemNode,"beschreibung");
+    
+    
+    if not searchText == "":
+      if not searchText in title.lower() and not searchText in description.lower():
+          return None;
+    
     links = {};
-    links[0] = SimpleLink("broken", 0);
-    links[1] = SimpleLink("broken", 0);
-    links[2] = SimpleLink("broken", 0);
 
     try:
       videos = itemNode.getElementsByTagName("videos")[0];
       if not videos.hasChildNodes():
-        print "no videos";
+        #print "no videos";
         return None;
 
       for videotag in videos.getElementsByTagName("video"):
-        print videotag.attributes;
+        #print videotag.attributes;
         if (not videotag.hasAttribute("host")):
           return None;
         link = "rtmp://" + videotag.attributes["host"].value + "/" + videotag.attributes["application"].value + "/";
@@ -164,6 +228,34 @@
       
       return None;
     
-    return DisplayObject(title,subtitle,picture,description,links,True, pubDate)
-    
-      
+    startBei =  (self.readText(itemNode,"startBei"));
+    endeBei =  (self.readText(itemNode,"endeBei"));
+    
+    duration = 0
+    if startBei.strip() and endeBei.strip():
+      duration = str((int(endeBei)+int(startBei))/1000)
+    
+    return DisplayObject(title,subtitle,picture,description,links,True, pubDate, duration)
+    
+  def extractPodcastInformation(self, itemNode, picture = "", searchText = ""):
+    title = self.readText(itemNode,"title");
+    
+    dateString = self.readText(itemNode,"pubdate");
+    pubDate = self.parseDate(dateString);
+    
+    description = self.readText(itemNode,"description");
+    
+    duration = self.readText(itemNode,"duration");
+
+    link = itemNode.getElementsByTagName("enclosure")[0].getAttribute("streamurl");
+
+    links = {};
+    links[0] = SimpleLink(link, 0);
+    
+    if not searchText == "":
+      if not searchText in title.lower() and not searchText in description.lower():
+          return None;
+    
+    return DisplayObject(title,"",picture,description,links,True, pubDate, duration)
+    
+