Ignore:
Timestamp:
Sep 9, 2022, 8:20:25 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Removed TemplateGenerics package. Generics usage replaced by standard Generics.Collections.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/TV/UPageTV.pas

    r137 r138  
    5656  with TWebSession(HandlerData) do begin
    5757    ModuleUser.LoadUserInfo;
    58     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     58    with HtmlDocument.Body, SubItems.AddString do begin
    5959      Text := 'Stažení přehrávače: <a href="http://www.videolan.org/vlc/">VLC Media Player</a><br/>' +
    6060    'Seznam všech kanálů do přehrávače: <a href="playlist/">Playlist</a><br/>' +
     
    7070        with DbRows[I] do begin
    7171          TuneUp := '&nbsp;';
    72           if Values['StreamWeb'] <> '' then
    73             TuneUp := MakeLink('Naladit', Values['StreamWeb']);
    74           if Values['Stream'] <> '' then
    75             TuneUp := MakeLink('Naladit', NavigationLink('/tv/playlist?id=' + Values['ShortName']));
    76           Text := Text + '<tr><td>' + MakeLink(Values['Name'], Values['Homepage']) +
     72          if Items['StreamWeb'] <> '' then
     73            TuneUp := MakeLink('Naladit', Items['StreamWeb']);
     74          if Items['Stream'] <> '' then
     75            TuneUp := MakeLink('Naladit', NavigationLink('/tv/playlist?id=' + Items['ShortName']));
     76          Text := Text + '<tr><td>' + MakeLink(Items['Name'], Items['Homepage']) +
    7777            '</td><td align="center">' +
    78             Values['Language'] + '</td><td align="center">' + Values['Category'] + '</td>' +
     78            Items['Language'] + '</td><td align="center">' + Items['Category'] + '</td>' +
    7979            '<td>' + TuneUp + '</td></tr>';
    8080        end;
     
    9999  I: Integer;
    100100  Text: string;
     101  Id: string;
    101102begin
    102103  with TWebSession(HandlerData) do begin
    103       Response.Headers.Add('Content-Type', 'audio/mpegurl');
    104       Response.Headers.Add('Content-Disposition', 'attachment; filename=playlist.m3u');
    105       try
    106         DbRows := TDbRows.Create;
     104    Response.Headers.Add('Content-Type', 'audio/mpegurl');
     105    Response.Headers.Add('Content-Disposition', 'attachment; filename=playlist.m3u');
     106    try
     107      DbRows := TDbRows.Create;
    107108
    108109      Text := '#EXTM3U' + LineEnding;
    109       if Request.Query.SearchKey('id') <> -1 then begin
    110         Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") AND (`ShortName`="' + Database.EscapeString(Request.Query.Values['id']) + '") ');
     110      if Request.Query.TryGetValue('id', Id) then begin
     111        Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") AND (`ShortName`="' + Database.EscapeString(Id) + '") ');
    111112        if DbRows.Count > 0 then begin
    112           Text := Text + '#EXTINF:0,' + DbRows[0].Values['Name'] + LineEnding
    113           + DbRows[0].Values['Stream'] + LineEnding;
     113          Text := Text + '#EXTINF:0,' + DbRows[0].Items['Name'] + LineEnding
     114          + DbRows[0].Items['Stream'] + LineEnding;
    114115        end;
    115116      end else begin
    116117        Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") ORDER BY `Name` ');
    117118        for I := 0 to DbRows.Count - 1 do begin
    118           Text := Text + '#EXTINF:0,' + DbRows[I].Values['Name'] + LineEnding
    119           + DbRows[I].Values['Stream'] + LineEnding;
     119          Text := Text + '#EXTINF:0,' + DbRows[I].Items['Name'] + LineEnding
     120          + DbRows[I].Items['Stream'] + LineEnding;
    120121        end;
    121122      end;
    122123      Response.Content.WriteString(Text);
    123124
    124       finally
    125         DbRows.Free;
    126       end
     125    finally
     126      DbRows.Free;
     127    end
    127128  end;
    128129end;
Note: See TracChangeset for help on using the changeset viewer.