Exemple #1
0
 protected void ExecSearch()
 {
     ServiceInterface server = new ServiceInterface();
       List<WebProgram> progs = server.SearchEPG(edTitle.Text);
       DataTable dt = new DataTable();
       dt.Columns.Add("time", typeof(string));
       dt.Columns.Add("genre", typeof(string));
       dt.Columns.Add("channel", typeof(string));
       dt.Columns.Add("program", typeof(string));
       dt.Columns.Add("logo", typeof(string));
       dt.Columns.Add("idProgram", typeof(int));
       foreach (WebProgram p in progs)
       {
     DataRow row = dt.NewRow();
     string s = p.startTime.ToString() + "-" + p.endTime.ToShortTimeString();
     if (p.startTime < DateTime.Now && p.endTime > DateTime.Now)
       s = "<a name=\"currentdatetime\"></a>" + s;
     row["time"] = s;
     row["genre"] = p.genre;
     row["channel"] = p.channelName;
     row["program"] = "<b>" + GetScraperLink(p.Title) + "</b><br/>" + p.description;
     row["logo"]=Utils.GetLogoURL(p.channelName,true);
     row["idProgram"] = p.idProgram;
     dt.Rows.Add(row);
       }
       grid.DataSource = dt;
       grid.DataBind();
       int width; int height;
       Utils.GetThumbDimensions(out width, out height);
       grid.Columns[2].ControlStyle.Width = width;
       grid.Columns[2].ControlStyle.Height = height;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["authenticated"] == null)
     Response.Redirect("Login.aspx");
       ServiceInterface server = new ServiceInterface();
       Label1.Text = Request.QueryString["channelName"];
       List<WebProgram> progs=server.GetTodayEPGForChannel(Int32.Parse(Request.QueryString["idChannel"]));
       DataTable dt=new DataTable();
       dt.Columns.Add("time",typeof(string));
       dt.Columns.Add("genre", typeof(string));
       dt.Columns.Add("program",typeof(string));
       dt.Columns.Add("idProgram", typeof(int));
       foreach (WebProgram p in progs)
       {
     DataRow row = dt.NewRow();
     string s=p.startTime.ToString() + "-" + p.endTime.ToShortTimeString();
     if (p.startTime<DateTime.Now && p.endTime>DateTime.Now)
       s="<a name=\"currentdatetime\"></a>"+s;
     row["time"] = s;
     row["genre"] = p.genre;
     row["program"] = "<b>" + GetScraperLink(p.Title) + "</b><br/>" + p.description;
     row["idProgram"] = p.idProgram;
     dt.Rows.Add(row);
       }
       grid.DataSource = dt;
       grid.DataBind();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["authenticated"] == null)
          Response.Redirect("Login.aspx");
        if (IsPostBack)
          return;
        ServiceInterface server = new ServiceInterface();
        if (Request.QueryString["idSchedule"] != null)
        {
          lHeading.Text = "Edit Schedule";
          WebSchedule sched = server.GetSchedule(Int32.Parse(Request.QueryString["idSchedule"]));
          lChannel.Text = sched.channelName;
          hfIdChannel.Value = sched.idChannel.ToString();
          edStart.Text = sched.startTime.ToString();
          edEnd.Text = sched.endTime.ToString();
          edTitle.Text = sched.programName;
          cbScheduleType.SelectedValue = sched.scheduleType.ToString();
        }
        else if (Request.QueryString["idProgram"] != null)
        {
          WebProgram p = server.GetEPG(Int32.Parse(Request.QueryString["idProgram"]));

          WebChannel c = server.GetChannel(p.idChannel);
          cbChannelType.SelectedIndex = c.isTv ? 1 : 2;
          populateChannelGroups();
          cbChannel.SelectedValue = p.idChannel.ToString();
          lChannel.Text = p.channelName;
          hfIdChannel.Value = p.idChannel.ToString();

          edStart.Text = p.startTime.ToString();
          edEnd.Text = p.endTime.ToString();
          edTitle.Text = p.Title;
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     string streamURL=Utils.GetStreamURL();
     ServiceInterface server = new ServiceInterface();
     if (Request.QueryString["idTvGroup"] != null)
     {
       AddHeader("Tv MiniEPG for [" + Request.QueryString["groupName"] + "]","");
       List<WebMiniEPG> channels=server.GetTvMiniEPGForGroup(Int32.Parse(Request.QueryString["idTvGroup"]));
       foreach (WebMiniEPG chan in channels)
     AddItem(chan.name, chan.epgNow.startTime.ToString() + "-" + chan.epgNow.endTime.ToString() + " " + chan.epgNow.title, streamURL + "/Streamer.aspx?idChannel=" + chan.idChannel.ToString() + "&idProfile=" + Request.QueryString["idProfile"]);
     }
     else if (Request.QueryString["idRadioGroup"] != null)
     {
       AddHeader("Radio MiniEPG for [" + Request.QueryString["groupName"] + "]","");
       List<WebMiniEPG> channels = server.GetRadioMiniEPGForGroup(Int32.Parse(Request.QueryString["idRadioGroup"]));
       foreach (WebMiniEPG chan in channels)
     AddItem(chan.name, chan.epgNow.startTime.ToString() + "-" + chan.epgNow.endTime.ToString() + " " + chan.epgNow.title, streamURL + "/Streamer.aspx?idChannel=" + chan.idChannel.ToString() + "&idProfile=" + Request.QueryString["idProfile"]);
     }
     else if (Request.QueryString["recordings"] != null)
     {
       AddHeader("Recordings","");
       List<WebRecording> recs = server.GetAllRecordings("");
       foreach (WebRecording rec in recs)
     AddItem(rec.title,rec.description,streamURL + "/Streamer.aspx?idRecording=" + rec.idRecording.ToString() + "&idProfile=" + Request.QueryString["idProfile"]);
     }
     else if (Request.QueryString["movies"] != null)
     {
       AddHeader("Movies","");
       List<WebMovie> movies=server.GetAllMovies("");
       foreach (WebMovie m in movies)
     AddItem(m.title,m.plot,streamURL + "/Streamer.aspx?idMovie=" + m.idMovie.ToString() + "&idProfile=" + Request.QueryString["idProfile"]);
     }
     else if (Request.QueryString["music"] != null)
     {
       AddHeader("Music","");
       List<WebMusicTrack> tracks=server.GetAllMusicTracks("","","");
       foreach (WebMusicTrack track in tracks)
     AddItem(track.album,track.title,streamURL + "/Streamer.aspx?idMusicTrack=" + track.idTrack.ToString() + "&idProfile=" + Request.QueryString["idProfile"]);
     }
     else if (Request.QueryString["tvseries"] != null)
     {
       AddHeader("TV Series","");
       List<WebSeries> series=server.GetAllTvSeries("","");
       foreach (WebSeries s in series)
     AddItem(s.seriesName,s.episodeName,streamURL + "/Streamer.aspx?idTvSeries=" + s.compositeId + "&idProfile=" + Request.QueryString["idProfile"]);
     }
     else if (Request.QueryString["movingpictures"] != null)
     {
       AddHeader("Moving Pictures","");
       List<WebMovingPicture> mpics=server.GetAllMovingPictures("");
       foreach (WebMovingPicture m in mpics)
     AddItem(m.title,m.plot,streamURL + "/Streamer.aspx?idMovingPicture=" + m.id.ToString() + "&idProfile=" + Request.QueryString["idProfile"]);
     }
     AddFooter();
     Response.Clear();
     Response.ContentType = "application/rss+xml";
     Response.Write(rss);
     Response.End();
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     int idChannel;
     if (!Int32.TryParse(cbChannel.SelectedValue,out idChannel))
     {
       lChanError.Visible=true;
       return;
     }
     ServiceInterface server = new ServiceInterface();
     if (Request.QueryString["idSchedule"]!=null)
       server.DeleteSchedule(Int32.Parse(Request.QueryString["idSchedule"]));
     server.AddSchedule(idChannel, edTitle.Text, DateTime.Parse(edStart.Text), DateTime.Parse(edEnd.Text), Int32.Parse(cbScheduleType.SelectedValue));
     RegisterStartupScript("close", "<script>window.close();</script>");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["authenticated"] == null)
     Response.Redirect("Login.aspx");
       List<string> recPaths = new List<string>();
       ServiceInterface server = new ServiceInterface();
       if (hfAction.Value != "")
       {
     if (hfAction.Value == "0")
       server.StopTimeShifting(Int32.Parse(hfIdChannel.Value), Int32.Parse(hfIdCard.Value), hfUsername.Value);
     else if (hfAction.Value == "1")
       server.StopRecording(Int32.Parse(hfIdChannel.Value), Int32.Parse(hfIdCard.Value), hfUsername.Value);
     hfAction.Value = "";
       }
       List<WebTvServerStatus> states = server.GetTvServerStatus();
       DataTable dt=new DataTable();
       dt.Columns.Add("name",typeof(string));
       dt.Columns.Add("type",typeof(string));
       dt.Columns.Add("state",typeof(string));
       dt.Columns.Add("channel",typeof(string));
       dt.Columns.Add("user",typeof(string));
       dt.Columns.Add("action", typeof(string));
       foreach (WebTvServerStatus state in states)
       {
     if (!recPaths.Contains(state.recordingFolder))
       recPaths.Add(state.recordingFolder);
     DataRow row = dt.NewRow();
     row["name"] = state.cardName;
     row["type"] = state.cardTypeStr;
     row["state"] = state.statusStr;
     row["channel"] = state.channel;
     row["user"] = state.userName;
     if ((CardStatus)state.status == CardStatus.TimeShifting)
     {
       row["action"]="<input type=\"button\" ID=\"btn\" Value=\"Stop timeshift\" onclick=KickSession("+state.idCard.ToString()+","+state.idChannel.ToString()+",'"+state.userName+"',0); />";
     }
     else if ((CardStatus)state.status == CardStatus.Recording)
     {
       row["action"] = "<input type=\"button\" ID=\"btn\" Value=\"Stop recording\" onclick=KickSession(" + state.idCard.ToString() + "," + state.idChannel.ToString() + ",'" + state.userName + "',1); />";
     }
     dt.Rows.Add(row);
       }
       grid.DataSource = dt;
       grid.DataBind();
       RefreshServerInfo(recPaths);
 }
 protected void populateChannels()
 {
     ServiceInterface server = new ServiceInterface();
     List<WebChannel> channels=null;
     if (cbChannelType.SelectedIndex == 1)
       channels = server.GetChannelsInTvGroup(Int32.Parse(cbGroup.SelectedValue));
     else if (cbChannelType.SelectedIndex == 2)
       channels = server.GetChannelsInRadioGroup(Int32.Parse(cbGroup.SelectedValue));
     cbChannel.Items.Clear();
     foreach (WebChannel ch in channels)
       cbChannel.Items.Add(new ListItem(ch.displayName, ch.idChannel.ToString()));
     cbChannel.SelectedIndex = 0;
     lChannel.Text = cbChannel.SelectedItem.Text;
     hfIdChannel.Value = cbChannel.SelectedItem.Value;
 }
Exemple #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string filename="";

          if (Request.QueryString["sectoken"] == null)
          {
        Utils.Log("Streamer.aspx: ERROR: No sectoken for authentication provided");
        return;
          }
          string uid; string pwd;
          Utils.GetLogin(out uid, out pwd);
          string sectoken = Request.QueryString["sectoken"];
          string decrypt = CryptoHelper.Crypt(sectoken, false);
          if (decrypt.Length < 10)
          {
        Utils.Log("Streamer.aspx: ERROR: Invalid sectoken");
        return;
          }
          decrypt = decrypt.Remove(0, 8);
          if (decrypt != uid + pwd)
          {
        Utils.Log("Streamer.aspx: ERROR: Invalid sectoken");
        return;
          }

          List<EncoderConfig> cfgs = Utils.LoadConfig();
          EncoderConfig cfg = cfgs[Int32.Parse(Request.QueryString["idProfile"])];

          ServiceInterface server = new ServiceInterface();
          if (Request.QueryString["idChannel"]!=null)
          {
        if (server.GetChannel(Int32.Parse(Request.QueryString["idChannel"])).isRadio)
          bufferSize = 2560;
        WebTvResult res = server.StartTimeShifting(Int32.Parse(Request.QueryString["idChannel"]));
        if (res.result != 0)
        {
          Utils.Log("Streamer.aspx: ERROR: StartTimeShifting failed with error: " + res.result.ToString());
          Response.Output.WriteLine("ERROR: StartTimeShifting failed with error: " + res.result.ToString());
          Response.End();
          return;
        }
        usedCard = res.user.idCard;
        usedChannel = res.user.idChannel;
        tvServerUsername = res.user.name;
        if (cfg.inputMethod == TransportMethod.Filename)
          filename = res.rtspURL;
        else
          filename = res.timeshiftFile;
          }
          else if (Request.QueryString["idRecording"]!=null)
          {
        WebRecording rec=server.GetRecording(Int32.Parse(Request.QueryString["idRecording"]));
        filename = rec.fileName;
          }
          else if (Request.QueryString["idMovie"]!=null)
          {
        WebMovie movie=server.GetMovie(Int32.Parse(Request.QueryString["idMovie"]));
        filename=movie.file;
          }
          else if (Request.QueryString["idMusicTrack"]!=null)
          {
        WebMusicTrack track = server.GetMusicTrack(Int32.Parse(Request.QueryString["idMusicTrack"]));
        filename = track.file;
          }
          else if (Request.QueryString["idTvSeries"] != null)
          {
        WebSeries series = server.GetTvSeries(Request.QueryString["idTvSeries"]);
        filename = series.filename;
          }
          else if (Request.QueryString["idMovingPicture"] != null)
          {
        WebMovingPicture pic = server.GetMovingPicture(Int32.Parse(Request.QueryString["idMovingPicture"]));
        filename = pic.filename;
          }
          if (!File.Exists(filename) && !filename.StartsWith("rtsp://"))
          {
        Utils.Log("Streamer.aspx: Requested file " + filename + " does not exist.");
        return;
          }
          Response.Clear();
          Response.Buffer=false;
          Response.BufferOutput=false;
          Response.AppendHeader("Connection","Keep-Alive");
          Response.ContentType="video/x-msvideo";
          Response.StatusCode=200;

          Stream mediaStream=null;
          EncoderWrapper encoder=null;
          Stream outStream = null;

          if (cfg.inputMethod != TransportMethod.Filename)
          {
        if (Request.QueryString["idChannel"] != null)
        {
          mediaStream = new TsBuffer(filename);
        }
        else
          mediaStream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
        encoder=new EncoderWrapper(mediaStream,cfg);
          }
          else
        encoder=new EncoderWrapper(filename,cfg);

          if (cfg.useTranscoding)
        outStream = encoder;
          else
        outStream = mediaStream;

          byte[] buffer = new byte[bufferSize];
          int read;
          try
          {
        while ((read = outStream.Read(buffer, 0, buffer.Length)) > 0)
        {
          try
          {
            Response.OutputStream.Write(buffer, 0, read);
          }
          catch (Exception)
          {
            break; // stream is closed
          }
          if (Request.QueryString["idChannel"] != null)
            server.SendHeartBeat(usedChannel, usedCard, tvServerUsername);
        }
          }
          catch (Exception ex)
          {
        Utils.Log("Streamer.aspx: Exception raised="+ex.Message+Environment.NewLine+ex.StackTrace);
          }
          if (mediaStream!=null)
        mediaStream.Close();
          if (Request.QueryString["idChannel"] != null)
        server.StopTimeShifting(usedChannel, usedCard, tvServerUsername);
          encoder.StopProcess();
        Response.End();
    }
Exemple #9
0
 protected void RefreshTvSeries()
 {
     ServiceInterface server = new ServiceInterface();
     List<WebSeries> series = server.GetAllTvSeries(edSeries.Text,edEpisode.Text);
     DataTable dt = new DataTable();
     dt.Columns.Add("compositeId", typeof(string));
     dt.Columns.Add("series", typeof(string));
     dt.Columns.Add("episode", typeof(string));
     foreach (WebSeries s in series)
     {
       DataRow row = dt.NewRow();
       row["compositeId"] = s.compositeId;
       row["series"] = s.seriesName;
       row["episode"] = "<b>S" + s.season.ToString() + "E" + s.episode.ToString() + " " + s.episodeName + "</b><br/>" + s.episodePlot;
       dt.Rows.Add(row);
     }
     gridTvSeries.DataSource = dt;
     gridTvSeries.DataBind();
     LoadStreamingProfiles(cbTvSeriesProfiles);
 }
Exemple #10
0
 protected void gridSchedules_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int idx = (int)gridSchedules.DataKeys[e.RowIndex].Value;
     ServiceInterface server = new ServiceInterface();
     server.DeleteSchedule(idx);
     e.Cancel = true;
     RefreshSchedules();
 }
    protected void populateChannelGroups()
    {
        ServiceInterface server = new ServiceInterface();
        cbGroup.Items.Clear();
        List<WebChannelGroup> groups=null;
        if (cbChannelType.SelectedIndex == 1)
          groups = server.GetTvChannelGroups();
        else if (cbChannelType.SelectedIndex == 2)
          groups = server.GetRadioChannelGroups();
        else
        {
          cbGroup.Items.Clear();
          cbChannel.Items.Clear();
          return;
        }

        int idx = 0;
        int allIndex = -1;
        foreach (WebChannelGroup g in groups)
        {
          if (g.name == "All Channels" && allIndex == -1)
        allIndex = idx;
          cbGroup.Items.Add(new ListItem(g.name, g.idGroup.ToString()));
          idx++;
        }
        cbGroup.SelectedIndex = allIndex;
        populateChannels();
    }
Exemple #12
0
 protected void RefreshRecordings()
 {
     ServiceInterface server = new ServiceInterface();
     List<WebRecording> recs = server.GetAllRecordings(edRecTitle.Text);
     DataTable dt = new DataTable();
     dt.Columns.Add("time", typeof(string));
     dt.Columns.Add("channel", typeof(string));
     dt.Columns.Add("genre", typeof(string));
     dt.Columns.Add("program", typeof(string));
     dt.Columns.Add("idRecording", typeof(int));
     foreach (WebRecording rec in recs)
     {
       DataRow row = dt.NewRow();
       row["time"] = rec.startTime.ToString() + "-" + rec.endTime.ToShortTimeString();
       row["channel"] = rec.channelName;
       row["genre"] = rec.genre;
       row["program"] = "<b>" + GetScraperLink(rec.title) + "</b><br/>" + rec.description;
       row["idRecording"] = rec.idRecording;
       dt.Rows.Add(row);
     }
     gridRecordings.DataSource = dt;
     gridRecordings.DataBind();
 }
Exemple #13
0
 protected void RefreshRadio()
 {
     ServiceInterface server = new ServiceInterface();
     if (cbRadioGroups.Items.Count == 0)
     {
       List<WebChannelGroup> radiogroups = server.GetRadioChannelGroups();
       int i = 0;
       int index = -1;
       int allIndex = -1;
       foreach (WebChannelGroup g in radiogroups)
       {
     if (g.name == "All Channels" && allIndex != -1)
       allIndex = i;
     if (g.name != "All Channels" && index != -1)
       index = i;
     cbRadioGroups.Items.Add(new ListItem(g.name, g.idGroup.ToString()));
     i++;
       }
       if (index != -1)
     cbRadioGroups.SelectedIndex = index;
       else
     cbRadioGroups.SelectedIndex = allIndex;
     }
     List<WebMiniEPG> epgs = server.GetRadioMiniEPGForGroup(Int32.Parse(cbRadioGroups.SelectedValue));
     DataTable dt = new DataTable();
     dt.Columns.Add("channel", typeof(string));
     dt.Columns.Add("now_next", typeof(string));
     dt.Columns.Add("idChannel", typeof(int));
     dt.Columns.Add("logo", typeof(string));
     foreach (WebMiniEPG epg in epgs)
     {
       if (epg.idChannel == 0) continue;
       DataRow row = dt.NewRow();
       row["channel"] = epg.name;
       row["now_next"] = epg.epgNow.startTime.ToShortTimeString() + " - " + epg.epgNow.endTime.ToShortTimeString() + ": " + epg.epgNow.title + "<br/>" + epg.epgNext.startTime.ToShortTimeString() + " - " + epg.epgNext.endTime.ToShortTimeString() + ": " + epg.epgNext.title;
       row["idChannel"] = epg.idChannel;
       row["logo"] = Utils.GetLogoURL(epg.name,false);
       dt.Rows.Add(row);
     }
     gridRadio.DataSource = dt;
     gridRadio.DataBind();
     int width; int height;
     Utils.GetThumbDimensions(out width, out height);
     gridRadio.Columns[0].ControlStyle.Width = width;
     gridRadio.Columns[0].ControlStyle.Height = height;
     LoadStreamingProfiles(cbRadioProfiles);
 }
Exemple #14
0
 protected void RefreshPictures()
 {
     ServiceInterface server = new ServiceInterface();
     List<string> p = server.GetAllPicturePaths();
     cbPicturePath.Items.Clear();
     foreach (string s in p)
       cbPicturePath.Items.Add(s);
     if (p.Count>0)
       cbPicturePath.SelectedIndex = 0;
 }
Exemple #15
0
 protected void RefreshMusicTracks()
 {
     ServiceInterface server = new ServiceInterface();
     List<WebMusicTrack> tracks = server.GetAllMusicTracks(edMusicAlbum.Text,edMusicArtist.Text,edMusicTitle.Text);
     DataTable dt = new DataTable();
     dt.Columns.Add("album", typeof(string));
     dt.Columns.Add("artist", typeof(string));
     dt.Columns.Add("trackno", typeof(int));
     dt.Columns.Add("title", typeof(string));
     dt.Columns.Add("idTrack", typeof(int));
     dt.Columns.Add("duration", typeof(int));
     dt.Columns.Add("durationStr", typeof(string));
     foreach (WebMusicTrack t in tracks)
     {
       DataRow row = dt.NewRow();
       row["album"] = t.album;
       row["artist"] = t.artist;
       row["trackno"] = t.trackno;
       row["title"] = t.title;
       row["idTrack"] = t.idTrack;
       row["duration"] = t.duration;
       row["durationStr"] = GetDurationString(t.duration);
       dt.Rows.Add(row);
     }
     gridMusic.DataSource = dt;
     gridMusic.DataBind();
     LoadStreamingProfiles(cbMusicProfiles);
 }
Exemple #16
0
 protected void RefreshMovingPictures()
 {
     ServiceInterface server = new ServiceInterface();
     List<WebMovingPicture> pics = server.GetAllMovingPictures(edMovingTitle.Text);
     DataTable dt = new DataTable();
     dt.Columns.Add("id", typeof(int));
     dt.Columns.Add("genre", typeof(string));
     dt.Columns.Add("parentalRating", typeof(string));
     dt.Columns.Add("movie", typeof(string));
     foreach (WebMovingPicture p in pics)
     {
       DataRow row = dt.NewRow();
       row["id"] = p.id;
       row["genre"] = p.genre;
       row["parentalRating"] = p.parentalRating;
       string s = "<b>" + p.title;
       if (p.year > 0)
     s += " (" + p.year.ToString() + ")";
       s += "</b><br/>" + p.plot;
       row["movie"] = s;
       dt.Rows.Add(row);
     }
     gridMovingPictures.DataSource = dt;
     gridMovingPictures.DataBind();
     LoadStreamingProfiles(cbMovingPicturesProfiles);
 }
Exemple #17
0
 protected void RefreshMovies()
 {
     ServiceInterface server = new ServiceInterface();
     List<WebMovie> movies = server.GetAllMovies(edMovieTitle.Text);
     DataTable dt = new DataTable();
     dt.Columns.Add("genre", typeof(string));
     dt.Columns.Add("file", typeof(string));
     dt.Columns.Add("title", typeof(string));
     dt.Columns.Add("plot", typeof(string));
     dt.Columns.Add("idMovie", typeof(int));
     foreach (WebMovie m in movies)
     {
       DataRow row = dt.NewRow();
       row["genre"] = m.genre;
       row["file"] = System.IO.Path.GetFileName(m.file);
       row["title"] = GetScraperLink(m.title);
       row["plot"] = m.plot;
       row["idMovie"] = m.idMovie;
       dt.Rows.Add(row);
     }
     gridMovies.DataSource = dt;
     gridMovies.DataBind();
     LoadStreamingProfiles(cbMovieProfiles);
 }
Exemple #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["authenticated"] == null)
       Response.Redirect("Login.aspx");
     if (!IsPostBack)
     {
       ServiceInterface server = new ServiceInterface();
       SupportedMPFunctions f=server.GetSupportedMPFunctions();
       btnMovie.Visible = f.myVideos;
       btnMusic.Visible = f.myMusic;
       btnPictures.Visible = f.myPictures;
       btnTvSeries.Visible = f.myTvSeries;
       btnMovingPictures.Visible = f.movingPictures;
     }
 }
Exemple #19
0
    protected void btnShowPictures_Click(object sender, EventArgs e)
    {
        ServiceInterface server = new ServiceInterface();
        List<WebPicture> pics = server.GetAllPicturesByPath(cbPicturePath.SelectedValue);
        int width; int height;
        Utils.GetThumbDimensions(out width, out height);
        foreach (WebPicture pic in pics)
        {
          Image thumb = new Image();
          thumb.ImageUrl = Utils.GetStreamURL()+"/PictureStreamer.aspx?thumb=" + Server.UrlEncode(pic.file);
          thumb.ImageAlign = ImageAlign.Top;
          thumb.AlternateText = System.IO.Path.GetFileNameWithoutExtension(pic.file) + Environment.NewLine + pic.taken.ToString();
          thumb.BorderStyle = BorderStyle.Outset;
          thumb.BorderWidth = new Unit(1);

          thumb.Width = new Unit(width);
          thumb.Height = new Unit(height);
          thumb.Attributes.Add("hspace", "4");
          thumb.Attributes.Add("vspace", "4");
          thumb.Attributes.Add("onclick", "window.open('"+Utils.GetStreamURL()+"/PictureViewer.aspx?picture=" + Server.UrlEncode(pic.file) + "');");
          thumb.Style.Add("cursor", "hand");
          picBox.Controls.Add(thumb);
        }
    }
Exemple #20
0
    protected void RefreshTv()
    {
        ServiceInterface server = new ServiceInterface();
        if (cbTvGroups.Items.Count == 0)
        {
          List<WebChannelGroup> tvgroups = server.GetTvChannelGroups();
          int i = 0;
          int index = -1;
          int allIndex = -1;
          foreach (WebChannelGroup g in tvgroups)
          {
        if (g.name == "All Channels" && allIndex == -1)
          allIndex = i;
        if (g.name != "All Channels" && index == -1)
          index = i;
        cbTvGroups.Items.Add(new ListItem(g.name, g.idGroup.ToString()));
        i++;
          }
          if (index != -1)
        cbTvGroups.SelectedIndex = index;
          else
        cbTvGroups.SelectedIndex = allIndex;
        }

        List<WebMiniEPG> epgs = server.GetTvMiniEPGForGroup(Int32.Parse(cbTvGroups.SelectedValue));
        DataTable dt = new DataTable();
        dt.Columns.Add("channel", typeof(string));
        dt.Columns.Add("now_next", typeof(string));
        dt.Columns.Add("idChannel", typeof(int));
        dt.Columns.Add("logo", typeof(string));
        foreach (WebMiniEPG epg in epgs)
        {
          if (epg.idChannel == 0) continue;
          DataRow row = dt.NewRow();
          row["channel"] = epg.name;
          row["now_next"] = epg.epgNow.startTime.ToShortTimeString() + " - " + epg.epgNow.endTime.ToShortTimeString() + ": <a href=EPGSearch.aspx?title=" + Server.UrlEncode(epg.epgNow.title) + " target=_blank><img border=0 src=\"pics/btnRecurrences.png\" alt=\"Find recurrences\" style=\"margin-right:5px;vertical-align:middle\" title=\"Find recurrences\" /></a>" + GetScraperLink(epg.epgNow.title) + "<br/>" + epg.epgNext.startTime.ToShortTimeString() + " - " + epg.epgNext.endTime.ToShortTimeString() + ": <a href=EPGSearch.aspx?title=" + Server.UrlEncode(epg.epgNext.title) + " target=_blank><img border=0 src=\"pics/btnRecurrences.png\" alt=\"Find recurrences\" style=\"margin-right:5px;vertical-align:middle\" title=\"Find recurrences\" /></a>" + GetScraperLink(epg.epgNext.title);
          row["idChannel"] = epg.idChannel;
          row["logo"] = Utils.GetLogoURL(epg.name,true);
          dt.Rows.Add(row);
        }
        gridTv.DataSource = dt;
        gridTv.DataBind();
        int width; int height;
        Utils.GetThumbDimensions(out width, out height);
        gridTv.Columns[0].ControlStyle.Width = width;
        gridTv.Columns[0].ControlStyle.Height = height;
        LoadStreamingProfiles(cbTvProfiles);
    }
Exemple #21
0
 protected void RefreshSchedules()
 {
     ServiceInterface server = new ServiceInterface();
     List<WebSchedule> scheds = server.GetAllSchedules();
     DataTable dt = new DataTable();
     dt.Columns.Add("startTime", typeof(string));
     dt.Columns.Add("endTime", typeof(string));
     dt.Columns.Add("channel", typeof(string));
     dt.Columns.Add("title", typeof(string));
     dt.Columns.Add("type", typeof(string));
     dt.Columns.Add("idSchedule", typeof(int));
     foreach (WebSchedule s in scheds)
     {
       DataRow row = dt.NewRow();
       row["startTime"] = s.startTime.ToString();
       row["endTime"] = s.endTime.ToString();
       row["channel"] = s.channelName;
       row["title"] = s.programName;
       row["type"] = s.scheduleTypeStr;
       row["idSchedule"] = s.idSchedule;
       dt.Rows.Add(row);
     }
     gridSchedules.DataSource = dt;
     gridSchedules.DataBind();
 }
Exemple #22
0
 protected string GetStreamingURL(string queryString)
 {
     string url = "";
     string rtspProfile = "idProfile="+(cbRecordingProfiles.Items.Count - 1).ToString();
     if (queryString.Contains("idRecording") && queryString.Contains(rtspProfile))
     {
       ServiceInterface server = new ServiceInterface();
       string idRecording = queryString.Substring(0, queryString.IndexOf('&'));
       idRecording = idRecording.Remove(0, 12);
       url = server.GetRecordingURL(Int32.Parse(idRecording));
     }
     else
       url = "\""+Utils.GetStreamURL() + "/Streamer.aspx?" + queryString+"\"";
     return url;
 }