<?xml version="1.0" encoding="utf-8"?>
<HmsMediaItem>
  <MediaType>3</MediaType>
  <ClassID>53</ClassID>
  <ItemID>0959a36b-22f4-424c-aff2-68c2163d394e</ItemID>
  <ItemPath>CyberHouse</ItemPath>
  <ParentID>234DF17B-418C-4FDC-9DFE-CD0C586D2E76</ParentID>
  <Properties>
    <Property>
      <ID>4</ID>
      <Value>CyberHouse</Value>
    </Property>
    <Property>
      <ID>50</ID>
      <Value>Интернет-телевидение</Value>
    </Property>
    <Property>
      <ID>515</ID>
      <Value>1</Value>
    </Property>
    <Property>
      <ID>700</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>701</ID>
      <Value>-1</Value>
    </Property>
    <Property>
      <ID>702</ID>
      <Value>-1</Value>
    </Property>
    <Property>
      <ID>517</ID>
      <Value>578-720,722-1080,482-576,402-480,322-400,202-320,0-200</Value>
    </Property>
    <Property>
      <ID>518</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>512</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>532</ID>
      <Value>1</Value>
    </Property>
    <Property>
      <ID>553</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>522</ID>
      <Value>0</Value>
    </Property>
    <Property>
      <ID>245</ID>
      <Value>0959a36b-22f4-424c-aff2-68c2163d394e</Value>
    </Property>
    <Property>
      <ID>93</ID>
      <Value>42037,9642572685</Value>
    </Property>
    <Property>
      <ID>530</ID>
      <Value>int gnTotal=0, gnImagesNotFound=0;
// ----------------------------------------------------------------------------
void LoadPlaylist() {
  string sData, sLink, sName, sGrp, sFile, sImg, sVal, group, sReplaceWhat=&apos;&apos;, sReplaceWith=&apos;&apos;;
  THmsScriptMediaItem Item;
  
  sFile = mpFilePath; if (Trim(mpComment)!=&apos;&apos;) sFile = mpComment;  
  HmsRegExMatch(&apos;--playlist="(.*?)"&apos;   , mpPodcastParameters, sFile);
  HmsRegExMatch(&apos;--replaceWhat="(.*?)"&apos;, mpPodcastParameters, sReplaceWhat);
  HmsRegExMatch(&apos;--replaceWith="(.*?)"&apos;, mpPodcastParameters, sReplaceWith);
  
  if (HmsRegExMatch(&apos;^http&apos;, sFile, &apos;&apos;))
    sData = HmsDownloadUrl(sFile, &apos;&apos;, true);
  else
    sData = HmsStringFromFile(sFile);
  
  sData = HmsUtf8Decode(sData);

  if (sReplaceWhat!=&apos;&apos;) sData = ReplaceStr(sData, sReplaceWhat, sReplaceWith);
  
  TRegExpr RE = TRegExpr.Create(&apos;#EXTINF:-?\\d?,?(.*?)[\\r\\n]([^\\r\\n]+)[\\r\\n$]&apos;, PCRE_SINGLELINE);
  try {
    if (RE.Search(sData)) do {
      sName = RE.Match(1);
      sLink = RE.Match(2);
      
      sGrp = &apos;&apos;;
      if (HmsRegExMatch(&apos;group-title="(.*)"&apos;, sName, sGrp)) sName = ReplaceStr(sName, sGrp, &apos;&apos;);
      sName = ReplaceStr(sName, &apos;group-title="", &apos;, &apos;&apos;);
      
      sName = Trim(sName);

      Item = HmsCreateMediaItem(sLink, FolderItem.ItemID, sGrp);
      Item[mpiTitle] = sName;
      Item[mpiThumbnail] = &apos;http://wonky.lostcut.net/TVimg/&apos;+sName+&apos;.png&apos;;
      gnTotal++;
      
      if (HmsRegExMatch(&apos;\\b(HD)\\b&apos;, sName, sGrp)) {
        Item = HmsCreateMediaItem(sLink, FolderItem.ItemID, sGrp);
        Item[mpiTitle    ] = sName;
        Item[mpiThumbnail] = &apos;http://wonky.lostcut.net/TVimg/&apos;+sName+&apos;.png&apos;;
      }

    } while (RE.SearchAgain());

  } finally { RE.Free(); }  
  HmsLogMessage(1, &apos;Всего каналов: &apos;+IntToStr(gnTotal));
  
}

// ----------------------------------------------------------------------------
{
  FolderItem.DeleteChildItems();
  LoadPlaylist();
}</Value>
    </Property>
    <Property>
      <ID>531</ID>
      <Value>C++Script</Value>
    </Property>
    <Property>
      <ID>527</ID>
      <Value>--replaceWhat="tvg-shift=0" --replaceWith=""</Value>
    </Property>
    <Property>
      <ID>525</ID>
      <Value>42048,4709412847</Value>
    </Property>
    <Property>
      <ID>550</ID>
      <Value>string csCommandLine = &apos;cmd://"%s" --no-crashdump --play-and-exit --language en -Idummy --demuxdump-file="&lt;OUTPUT FILE&gt;" vlc://pause:4 --access=p2p_access "%s" :demux=dump&apos;;

// --------------------------------------- Получение пути AceStream плеера ----
string GetTsPlayerPath() {
  return ExtractShortPathName(IncludeTrailingBackslash(RegistryRead(&apos;Software\\AceStream\\InstallDir&apos;)))+&apos;Player\\ace_player.exe&apos;;
}

// ----------------------------------------------------------------------------
void GetTTVLink() {
  string sData, sLink, sID = &apos;&apos;;
  
  if (HmsRegExMatch(&apos;acestream://(.*)&apos;, mpFilePath, sID)) {
    HmsLogMessage(1, mpTitle+&apos;: Открываем по ID в ссылке&apos;);

  } else if (HmsRegExMatch(&apos;/pid/.*?/stream.mp4&apos;, mpFilePath, &apos;&apos;)) {
    MediaResourceLink = mpFilePath;

  } else {
    sData = HmsUtf8Decode(HmsDownloadURL(mpFilePath, &apos;&apos;, true)); 

    if (HmsRegExMatch(&apos;loadTorrent\\("(.*?)"&apos;, sData, sLink)) {
      sID = HmsTempDirectory() + &apos;\\&apos; + mpTitle + &apos;.acelive&apos;;
      HmsDownloadURLToFile(sLink, sID);
      HmsLogMessage(1, mpTitle+&apos;: Открываем по торрент файлу&apos;);

    } else if (HmsRegExMatch(&apos;this.loadPlayer\\("(.*?)"&apos;, sData, sID)) {
      HmsLogMessage(1, mpTitle+&apos;: Открываем по ID в загруженной странице&apos;);

    } else {
      //HmsLogMessage(2, mpTitle+&apos;: Ошибка! Не найден ID или ссылка на torrent файл.&apos;);
      //return;

    }

  }

  if (sID!=&apos;&apos;) MediaResourceLink = Format(csCommandLine, [GetTsPlayerPath(), sID]);
  else         MediaResourceLink = mpFilePath; 
  
}

// ----------------------------------------------------------------------------
{
  GetTTVLink();
}</Value>
    </Property>
    <Property>
      <ID>551</ID>
      <Value>C++Script</Value>
    </Property>
    <Property>
      <ID>41</ID>
      <Value>http://sblack/cybephouse.pl</Value>
    </Property>
    <Property>
      <ID>42</ID>
      <Value>1</Value>
    </Property>
    <Property>
      <ID>43</ID>
      <Value>video/mpeg</Value>
    </Property>
  </Properties>
  <HmsTranscodingConfig>
    <TranscoderList>
      <Transcoder>
        <Name>VLC</Name>
        <Path>%Registry\SOFTWARE\VideoLAN\VLC\InstallDir%\vlc.exe</Path>
        <HomePage>http://www.videolan.org</HomePage>
        <Download>http://www.videolan.org</Download>
      </Transcoder>
    </TranscoderList>
    <TranscodingProfileList>
      <Profile>
        <TranscoderName>VLC</TranscoderName>
        <TranscodingCondition>mpInternetItem</TranscodingCondition>
        <TranscodingConditionSyntaxType>PascalScript</TranscodingConditionSyntaxType>
        <TranscodingComment></TranscodingComment>
        <TranscodingFolder>Транскодирование для интернет медиа-ресурсов</TranscodingFolder>
        <TranscodingMediaType>3</TranscodingMediaType>
        <TranscodingMimeType></TranscodingMimeType>
        <TranscodingMimeTypeScript></TranscodingMimeTypeScript>
        <TranscodingMimeTypeSyntaxType></TranscodingMimeTypeSyntaxType>
        <TranscodingMode>0</TranscodingMode>
        <TranscodingParams>function GetAudioCodec: string;
begin
  if Pos(&apos;wmv&apos;, cfgTranscodingTvsetMimeType) &gt; 0 then
    Result := &apos;wma2&apos;    
  else if (Pos(&apos;IPOD&apos;, UpperCase(cfgDeviceType)) &gt; 0) or
          (Pos(&apos;LG&apos;, UpperCase(cfgDeviceType)) = 1) or
          SameText(cfgTranscodingAudioCodec, &apos;AAC&apos;) or 
          (Pos(&apos;flv&apos;, cfgTranscodingTvsetMimeType) &gt; 0) then  
    Result := &apos;aac&apos;
  else if Pos(&apos;SONY&apos;, UpperCase(cfgDeviceType)) &gt; 0 then  
    Result := &apos;mpga&apos;
  else                
    Result := &apos;mpga&apos;    
end;

function GetFileFormat: string;
begin
  if Pos(&apos;wmv&apos;, cfgTranscodingTvsetMimeType) &gt; 0 then
    Result := &apos;asf&apos;    
  else if Pos(&apos;flv&apos;, cfgTranscodingTvsetMimeType) &gt; 0 then
    Result := &apos;ffmpeg{mux=flv}&apos;
  else if (Pos(&apos;MPEGTS&apos;, cfgTranscodingFileFormat) &gt; 0) or
          (Pos(&apos;SONY&apos;, UpperCase(cfgDeviceType)) &gt; 0) or
          (Pos(&apos;IPOD&apos;, UpperCase(cfgDeviceType)) &gt; 0) then           
    Result := &apos;ts&apos;    
  else     
    Result := &apos;mpeg1&apos;
end;

function GetVideoCodec: string;
begin
  if Pos(&apos;wmv&apos;, cfgTranscodingTvsetMimeType) &gt; 0 then                    
    if SameText(cfgTranscodingVideoCodec, &apos;X264&apos;) and (Pos(&apos;ASF&apos;, cfgTranscodingFileFormat) &gt; 0) then
      Result := &apos;h264&apos;      
    else
      Result := &apos;wmv2&apos;
  else if (Pos(&apos;IPOD&apos;, UpperCase(cfgDeviceType)) &gt; 0) or SameText(cfgTranscodingVideoCodec, &apos;X264&apos;) or 
          (Pos(&apos;flv&apos;, cfgTranscodingTvsetMimeType) &gt; 0) then  
    Result := &apos;h264&apos;    
  else
    Result := &apos;mp2v&apos;  
end;

function GetSampleRate: Integer;
begin
  if SameText(cfgTranscodingFileFormat, &apos;FLV&apos;) then  
    Result := 44100
  else
    Result := 48000   
end;

const
  csVideoLanParams =                                 
    &apos;--no-crashdump -Idummy --language=en%s%s --sout-ffmpeg-rc-buffer-size=%d %s--sout=#%stranscode&apos; +
    &apos;{vcodec=%s,vb=%d,fps=%s,scale=1%s,acodec=%s,ab=%d,channels=2,&apos; +
    &apos;samplerate=%d%s%s}:duplicate{dst=std{access=file,mux=%s,dst="&lt;OUTPUT FILE&gt;"}}&apos; +
    &apos;%s "&lt;INPUT FILE&gt;"&apos;; //  vlc:quit
    
var 
  i, iWidth, iHeight, iAspectWidth, iAspectHeight, iAudioStreamID: Integer;
  sAudioTrackID, sCanvasParams, sFrameRate, sDeinterlace, sGather, 
  sInternetTelevisionSplash, sKeepOut, sSubtitleParams, sSubtitleStreamID, 
  sSubtitleLanguage, sSubtitleOverlay: string;  
begin
  if HmsGetVideoSettings(vstDeinterlace) = &apos;on&apos; then 
    sDeinterlace := &apos;,deinterlace&apos;
  else
    sDeinterlace := &apos;&apos;;                        
  if cfgInternetTelevisionSplash &lt;&gt; &apos;&apos; then begin  
    sInternetTelevisionSplash := Format(&apos; "%s"&apos;, [cfgInternetTelevisionSplash]);    
    sGather  := &apos;gather:&apos;;                                              
    sKeepOut := &apos;--sout-keep &apos;;
  end else begin                             
    sInternetTelevisionSplash := &apos;&apos;;
    sGather  := &apos;&apos;;
    sKeepOut := &apos;&apos;    
  end;
  if mpInternetItem then
    sFrameRate := &apos;24&apos;
  else if cfgTranscodingFrameRate &lt;&gt; &apos;&apos; then                                      
    sFrameRate := cfgTranscodingFrameRate
  else if mpFrameRate &gt; 0 then
    sFrameRate := FormatFloat(&apos;0.000&apos;, mpFrameRate)
  else
    sFrameRate := &apos;25&apos;;
  if SameFloat(sFrameRate, &apos;23.976&apos;) then
    sFrameRate := &apos;24&apos;
  else if SameFloat(sFrameRate, &apos;29.970&apos;) then
    sFrameRate := &apos;30&apos;
  else if SameFloat(sFrameRate, &apos;59.940&apos;) then
    sFrameRate := &apos;60&apos;;    
  iWidth := mpWidth;     
  if iWidth &gt; 0 then begin                         
    i := Pos(&apos;:&apos;, cfgTranscodingScreenFormat);
    if i &gt; 0 then begin
      iAspectWidth  := StrToIntDef(Copy(cfgTranscodingScreenFormat, 1, i - 1), 16);
      iAspectHeight := StrToIntDef(Copy(cfgTranscodingScreenFormat, i + 1, 10), 9);      
    end else begin         
      iAspectWidth  := 16;
      iAspectHeight := 9      
    end;
    if iWidth &gt; cfgTranscodingScreenWidth then
      iWidth := cfgTranscodingScreenWidth;
    if iWidth &gt; 1280 then    
      iWidth := 1280;
    iHeight := Round((iWidth / iAspectWidth) * iAspectHeight);
    if iHeight mod 2 &lt;&gt; 0 then
      Inc(iHeight); 
    sCanvasParams := Format(&apos;,vfilter={canvas{width=%d,height=%d,aspect=%s}}&apos;, [iWidth, iHeight, cfgTranscodingScreenFormat]);
  end else
    sCanvasParams := &apos;&apos;;          
  if mpAudioStreamNo &gt;= 0 then begin  
    iAudioStreamID := HmsGetStreamID(stAudio, mpAudioStreamNo);    
    if iAudioStreamID &lt; 100 then                          
      sAudioTrackID := &apos; --audio-track=&apos; + IntToStr(mpAudioStreamNo)      
    else
      sAudioTrackID := &apos; --audio-track-id=&apos; + IntToStr(iAudioStreamID)
  end else                 
    sAudioTrackID := &apos;&apos;;
  sSubtitleParams  := &apos;&apos;;              
  sSubtitleOverlay := &apos;&apos;;                           
  if mpSubtitleLanguage &lt;&gt; &apos;&apos; then begin  
    if HmsRegExMatch(&apos;(.*?) &apos;, mpSubtitleLanguage, sSubtitleLanguage) and (Trim(sSubtitleLanguage) &lt;&gt; &apos;&apos;) then
      sSubtitleParams := &apos; --sub-language=&apos; + sSubtitleLanguage
    else if HmsRegExMatch(&apos;\[0x(.*?)\]&apos;, mpSubtitleLanguage, sSubtitleStreamID) then    
      sSubtitleParams := &apos; --sub-track-id=&apos; + IntToStr(StrToIntDef(&apos;$&apos; + sSubtitleStreamID, 0));      
    if sSubtitleParams &lt;&gt; &apos;&apos; then
      sSubtitleOverlay := &apos;,soverlay&apos;  
  end;          
  TranscodingParams := Format(csVideoLanParams, 
                               [sAudioTrackID, sSubtitleParams,
                                HmsTranscodingBufferSize(Min(cfgTranscodingVideoBitrate, 12000000)),
                                sKeepOut, sGather, GetVideoCodec,
                                Min(cfgTranscodingVideoBitrate div 1000, 12000), sFrameRate,
                                sCanvasParams, 
                                GetAudioCodec,
                                Min(cfgTranscodingAudioBitrate div 1000, 192),                                              
                                GetSampleRate,
                                sDeinterlace, sSubtitleOverlay, GetFileFormat,
                                sInternetTelevisionSplash]);                                
end.</TranscodingParams>
        <TranscodingParamsSyntaxType>PascalScript</TranscodingParamsSyntaxType>
        <TranscodingProfile>Интернет-телевидение</TranscodingProfile>
        <TranscodingProfileActive>-1</TranscodingProfileActive>
        <TranscodingProfilePriority>30</TranscodingProfilePriority>
        <TranscodingProfileUuid>1C044A2C92D743E0A29B8EBD557961F1</TranscodingProfileUuid>
      </Profile>
    </TranscodingProfileList>
  </HmsTranscodingConfig>
</HmsMediaItem>
