главная страница
материалы
  ms access и bitmap
  win в ucs-2 на perl
  приложение facebook
  медиа библиотека
  восстановление exif
  netgear stora
  html и javascript
  openwrt upgrade
  yandex dns
  playlist vbs
  фотоархив
  конвертация
  перекодировка для tv
  перекодировка для tvix

Создание плейлиста в VBS

Function RussianStringToURLEncode(ByVal txt)
For i = 1 To Len(txt)
    l = Mid(txt, i, 1)
  If AscW(l) > 4095 then
    t = "%" & Hex(AscW(l) \ 64 \ 64 + 224) & "%" & Hex(AscW(l) \ 64) & "%" & Hex(8 * 16 + AscW(l) Mod 64)
  ElseIf AscW(l) > 127 then
    t = "%" & Hex(AscW(l) \ 64 + 192) & "%" & Hex(8 * 16 + AscW(l) Mod 64)
  ElseIf AscW(l) < 39 OR (AscW(l) >= 91 AND AscW(l) <= 96) then
    t = "%" & Hex(AscW(l))
  Else
    t = l
  End If
  RussianStringToURLEncode = RussianStringToURLEncode & t
Next
End Function

Set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Shell.Application")
Set folder = oShell.NameSpace(fso.GetAbsolutePathName("."))
Set arr = CreateObject("System.Collections.ArrayList")

for each file in folder.Items
  arr.Add(fso.GetFileName(file.Path))
next
arr.Sort()

Set ts = CreateObject("ADODB.Stream")
ts.Charset = "UTF-8"
ts.Open
ts.writetext "#EXTM3U", 1

for each arrfile in arr
set file=folder.ParseName(arrfile)
if folder.GetDetailsOf(file, 9) = "Видео" then
  name = folder.GetDetailsOf(file, 0)
  dur = folder.GetDetailsOf(file, 27)
  path = file.Path

  if IsDate(dur) then
    durs = DateDiff("s",0,TimeValue(dur))
  else
    durs = ""
  end if
  ts.writetext "#EXTINF:" & durs & ", - " & Replace(name,","," -"), 1
  path = Replace(path,"локальная директрория","http://web-директория")
  path = Replace(path,"\","/")
  path = RussianStringToURLEncode(path)
  ts.writetext path, 1
end if
next

ts.Position = 3
Set fs = CreateObject("ADODB.Stream")
fs.Type = 1
fs.Open()
ts.CopyTo(fs)
ts.Close
fs.SaveToFile "!" & folder.Self.name & ".m3u8", 2
fs.Close