Index: OnlineVideos/DotNetZip/Zlib.cs
===================================================================
--- OnlineVideos/DotNetZip/Zlib.cs	(revision 1352)
+++ OnlineVideos/DotNetZip/Zlib.cs	(working copy)
@@ -399,7 +399,7 @@
     internal sealed class Adler
     {
         // largest prime smaller than 65536
-        private static readonly int BASE = 65521;
+        private static readonly uint BASE = 65521;
         // NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
         private static readonly int NMAX = 5552;
 
@@ -408,8 +408,8 @@
             if (buf == null)
                 return 1;
 
-            int s1 = (int) (adler & 0xffff);
-            int s2 = (int) ((adler >> 16) & 0xffff);
+            uint s1 = (uint)(adler & 0xffff);
+            uint s2 = (uint)((adler >> 16) & 0xffff);
 
             while (len > 0)
             {
Index: OnlineVideos/DotNetZip/ZlibBaseStream.cs
===================================================================
--- OnlineVideos/DotNetZip/ZlibBaseStream.cs	(revision 1352)
+++ OnlineVideos/DotNetZip/ZlibBaseStream.cs	(working copy)
@@ -443,7 +443,12 @@
                 throw new ZlibException("Cannot Read after Writing.");
 
             if (count == 0) return 0;
-            if (nomoreinput && _wantCompress) return 0;  // workitem 8557
+            // workitem 10562
+            // this quits too early if the input buffer has been consumed but 
+            // there's still output which hasn't been created yet (e.g. block
+            // data for tables / tree, or the trailing adler32 data). we
+            // need to wait for a Z_STREAM_END from Deflate instead.
+            //if (nomoreinput && _wantCompress) return 0;  // workitem 8557
             if (buffer == null) throw new ArgumentNullException("buffer");
             if (count < 0) throw new ArgumentOutOfRangeException("count");
             if (offset < buffer.GetLowerBound(0)) throw new ArgumentOutOfRangeException("offset");
@@ -473,6 +478,10 @@
                         nomoreinput = true;
 
                 }
+                // workitem 10562
+                // if we've consumed all the input then we need to generate any
+                // remaining block data and checksums and put them in the pending array
+                if (nomoreinput) _flushMode = FlushType.Finish;
                 // we have data in InputBuffer; now compress or decompress as appropriate
                 rc = (_wantCompress)
                     ? _z.Deflate(_flushMode)
@@ -485,38 +494,49 @@
                     throw new ZlibException(String.Format("{0}flating:  rc={1}  msg={2}", (_wantCompress ? "de" : "in"), rc, _z.Message));
 
                 if ((nomoreinput || rc == ZlibConstants.Z_STREAM_END) && (_z.AvailableBytesOut == count))
-                    break; // nothing more to read
+                {
+                    // workitem 10562
+                    // we've genuinely reached the end of the output stream now,
+                    // including any block data and adler32 which appears after
+                    // the compressed input data. we don't have any more bytes
+                    // to return so we can stop processing
+                    return 0; // nothing more to read
+                };
             }
             //while (_z.AvailableBytesOut == count && rc == ZlibConstants.Z_OK);
-            while (_z.AvailableBytesOut > 0 && !nomoreinput && rc == ZlibConstants.Z_OK);
+            //while (_z.AvailableBytesOut > 0 && !nomoreinput && rc == ZlibConstants.Z_OK);
+            while (_z.AvailableBytesOut > 0 && rc == ZlibConstants.Z_OK);
 
 
-            // workitem 8557
-            // is there more room in output? 
-            if (_z.AvailableBytesOut > 0)
-            {
-                if (rc == ZlibConstants.Z_OK && _z.AvailableBytesIn == 0)
-                {
-                    // deferred
-                }
+            // workitem 10562
+            // the following is no longer required as we now call _z.Deflate
+            // in the main loop above instead
+            //// workitem 8557
+            //// is there more room in output? 
+            //if (_z.AvailableBytesOut > 0)
+            //{
+            //    if (rc == ZlibConstants.Z_OK && _z.AvailableBytesIn == 0)
+            //    {
+            //        // deferred
+            //    }
+            //
+            //    // are we completely done reading?
+            //    if (nomoreinput)
+            //    {
+            //        // and in compression?
+            //        if (_wantCompress)
+            //        {
+            //            // no more input data available; therefore we flush to
+            //            // try to complete the read
+            //            rc = _z.Deflate(FlushType.Finish);
+            //
+            //            if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
+            //                throw new ZlibException(String.Format("Deflating:  rc={0}  msg={1}", rc, _z.Message));
+            //        }
+            //    }
+            //}
 
-                // are we completely done reading?
-                if (nomoreinput)
-                {
-                    // and in compression?
-                    if (_wantCompress)
-                    {
-                        // no more input data available; therefore we flush to
-                        // try to complete the read
-                        rc = _z.Deflate(FlushType.Finish);
 
-                        if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
-                            throw new ZlibException(String.Format("Deflating:  rc={0}  msg={1}", rc, _z.Message));
-                    }
-                }
-            }
-
-
             rc = (count - _z.AvailableBytesOut);
 
             // calculate CRC after reading
Index: OnlineVideos/OnlineVideoSites.xml
===================================================================
--- OnlineVideos/OnlineVideoSites.xml	(revision 1352)
+++ OnlineVideos/OnlineVideoSites.xml	(working copy)
@@ -19,6 +19,12 @@
       <Description>Die ARD Mediathek ist ein Gemeinschaftsangebot der Arbeitsgemeinschaft der Rundfunkanstalten der Bundesrepublik Deutschland (ARD) und der Deutschen Welle.</Description>
       <Categories />
     </Site>
+    <Site name="YouSee" util="YouSee" agecheck="false" enabled="true" lang="da">
+      <Description>YouSee Web TV</Description>
+      <item key="youSeeUserName"><![CDATA[username]]></item>
+      <item key="youSeePassWord"><![CDATA[password]]></item>
+      <Categories />
+    </Site>
     <Site name="BR" util="Br" agecheck="false" enabled="true" lang="de">
       <Description>Kostenlos verfügbare Sendungen aus der Mediathek des Bayerischen Rundfunks (BR).</Description>
       <Categories />
Index: SiteUtilProjects/OnlineVideos.Sites.dinky/OnlineVideos.Sites.dinky.csproj
===================================================================
--- SiteUtilProjects/OnlineVideos.Sites.dinky/OnlineVideos.Sites.dinky.csproj	(revision 0)
+++ SiteUtilProjects/OnlineVideos.Sites.dinky/OnlineVideos.Sites.dinky.csproj	(revision 0)
@@ -0,0 +1,61 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{6DC3C973-236D-41AA-9A25-701E9BDEF70A}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>OnlineVideos.Sites.dinky</RootNamespace>
+    <AssemblyName>OnlineVideos.Sites.dinky</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>C:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\OnlineVideos\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>C:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\OnlineVideos\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="YouSee.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\OnlineVideos\OnlineVideos.csproj">
+      <Project>{E0D9D390-CDD6-4B98-86F3-6EB04A958882}</Project>
+      <Name>OnlineVideos</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
Index: SiteUtilProjects/OnlineVideos.Sites.dinky/Properties/AssemblyInfo.cs
===================================================================
--- SiteUtilProjects/OnlineVideos.Sites.dinky/Properties/AssemblyInfo.cs	(revision 0)
+++ SiteUtilProjects/OnlineVideos.Sites.dinky/Properties/AssemblyInfo.cs	(revision 0)
@@ -0,0 +1,36 @@
+﻿using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OnlineVideos.Sites.dinky")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Default")]
+[assembly: AssemblyProduct("OnlineVideos.Sites.dinky")]
+[assembly: AssemblyCopyright("Copyright © Default 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b602b4b8-9d9e-411d-a12b-c73e96f98322")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: SiteUtilProjects/OnlineVideos.Sites.dinky/YouSee.cs
===================================================================
--- SiteUtilProjects/OnlineVideos.Sites.dinky/YouSee.cs	(revision 0)
+++ SiteUtilProjects/OnlineVideos.Sites.dinky/YouSee.cs	(revision 0)
@@ -0,0 +1,105 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.ComponentModel;
+using System.Web;
+using System.Net;
+using System.Xml;
+
+namespace OnlineVideos.Sites
+{
+  public class YouSeeUtil : OnlineVideos.Sites.SiteUtilBase
+  {
+    private string baseUrl = "http://yousee.tv/feeds/player/livetv/%s/";
+    private string login1_url = "https://login.yousee.dk";
+    private string LOGIN2_URL = "http://yousee.tv/sso/login";
+    private string videoUrl = "";
+    private string streamUrl = "";
+    private string swfUrl = "http://yousee.tv/design/swf/YouSeeVideoPlayer_beta.swf";
+    private string pageUrl = "http://yousee.tv/livetv/";
+
+    [Category("OnlineVideosUserConfiguration"), Description("Defines the username")]
+    string youSeeUserName = "";
+    [Category("OnlineVideosUserConfiguration"), Description("Defines the password")]
+    string youSeePassWord = "";
+    [Category("OnlineVideosUserConfiguration"), Description("Defines the quality")]
+    string youSeeQuality = "1200";
+    private CookieContainer ccYouSee = new CookieContainer();
+
+    public override void Initialize(SiteSettings siteSettings)
+    {
+      base.Initialize(siteSettings);
+
+      string postData = "Username=" + youSeeUserName + "?password=" + youSeePassWord + "?SucessURl=" + LOGIN2_URL;
+      GetWebDataFromPost(login1_url, postData, ccYouSee);
+    }
+
+    public override int DiscoverDynamicCategories()
+    {
+      if (Settings.Categories.Count() == 0)
+      {
+        Settings.Categories.Add(new RssLink() { Name = "Live TV", Url = baseUrl, Other = null, HasSubCategories = false });
+        Settings.Categories.Add(new RssLink() { Name = "Cinema", Url = baseUrl, Other = null, HasSubCategories = false });
+        Settings.Categories.Add(new RssLink() { Name = "TV Arkiv", Url = baseUrl, Other = null, HasSubCategories = false });
+      }
+      return Settings.Categories.Count;
+    }
+
+    public override List<VideoInfo> getVideoList(Category category)
+    {
+      List<VideoInfo> videoList = new List<VideoInfo>();
+      if (category.Name.Equals("Live TV"))
+      {
+        XmlDocument doc = new XmlDocument();
+        string webData = GetWebData(((RssLink)category).Url.Replace("%s", "DR1"), ccYouSee);
+        doc.LoadXml(webData);
+        videoUrl = doc.SelectSingleNode("/configuration/server/url").InnerText;
+        int streamIdx = 0;
+        if (youSeeQuality != "600")
+        {
+          streamIdx = 1;
+        }
+
+        XmlNodeList list = doc.SelectNodes("/configuration/channels/channel");
+        foreach (XmlNode channel in list)
+        {
+          VideoInfo video = new VideoInfo();
+          video.Title = channel.SelectSingleNode("name").InnerText;
+          video.ImageUrl = channel.SelectSingleNode("logo_large").InnerText;
+          video.Other = GetWebData(((RssLink)category).Url.Replace("%s", channel.SelectSingleNode("id").InnerText), ccYouSee);
+          XmlDocument docChannel = new XmlDocument();
+          docChannel.LoadXml(video.Other.ToString());
+          XmlNodeList listProgram = docChannel.SelectNodes("/configuration/programs/program");
+          if (listProgram.Count > 1)
+          {
+            video.Description = listProgram[0].SelectSingleNode("title").InnerText + Environment.NewLine + listProgram[0].SelectSingleNode("description").InnerText;
+            video.Title2 = listProgram[0].SelectSingleNode("title").InnerText;
+          }
+          XmlNodeList streams = docChannel.SelectNodes("/configuration/server/streams/stream");
+          streamUrl = streams[streamIdx].SelectSingleNode("name").InnerText;
+          video.VideoUrl = string.Format("http://127.0.0.1/stream.flv?rtmpurl={0}&swfurl={1}&conn={3}&swfVfy={2}&live=true",
+                      System.Web.HttpUtility.UrlEncode(videoUrl + "/" + streamUrl), //rtmpurl
+                      System.Web.HttpUtility.UrlEncode(swfUrl),  //swfurl
+                      System.Web.HttpUtility.UrlEncode(swfUrl),  //swfvfy
+                      System.Web.HttpUtility.UrlEncode("S:serverurl")   //conn
+                      //System.Web.HttpUtility.UrlEncode(videoUrl),  //tcurl
+                      //System.Web.HttpUtility.UrlEncode(pageUrl), //pageurl={}
+                      //"a3f7c981a5fc1c865d7f75c39ffe4b44a5c830718a1ed306fe680b3efdf33ff6", // swfhash
+                      //387972 // swfsize
+                      ); //const
+          videoList.Add(video);
+        }
+      }
+      return videoList;
+    }
+
+    public override string getUrl(VideoInfo video)
+    {
+      string url = ReverseProxy.GetProxyUri(RTMP_LIB.RTMPRequestHandler.Instance,video.VideoUrl);
+
+      return url;
+    }
+
+  }
+}
