Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pukkandan committed Sep 18, 2020
1 parent bf4e2e4 commit 7e4b055
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ temp/*
youtube-dl-*/*
Download/*
ydl.ahk.ini
*.exe
*.sublime*
24 changes: 24 additions & 0 deletions Channel.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--ignore-errors
--geo-bypass
--retries infinite
--fragment-retries infinite
--skip-unavailable-fragments
--cache-dir temp
--add-metadata

--external-downloader aria2c
--external-downloader-args "--disk-cache 128M --summary-interval 0 --console-log-level warn --max-tries 0 --retry-wait 1 --split 16 --max-connection-per-server 16 --min-split-size 1M"











--output "%ydl_home%/%(uploader)s [%(playlist_id)s]/%(playlist_index)03d - %(title)s [%(id)s].%(ext)s"

--playlist-reverse
22 changes: 22 additions & 0 deletions Default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--ignore-errors
--geo-bypass
--retries infinite
--fragment-retries infinite
--skip-unavailable-fragments
--cache-dir temp
--add-metadata

--external-downloader aria2c
--external-downloader-args "--disk-cache 128M --summary-interval 0 --console-log-level warn --max-tries 0 --retry-wait 1 --split 16 --max-connection-per-server 16 --min-split-size 1M"











--output "%ydl_home%/%(uploader)s - %(title)s [%(id)s] (%(resolution)s).%(ext)s"
22 changes: 22 additions & 0 deletions Folder.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--ignore-errors
--geo-bypass
--retries infinite
--fragment-retries infinite
--skip-unavailable-fragments
--cache-dir temp
--add-metadata

--external-downloader aria2c
--external-downloader-args "--disk-cache 128M --summary-interval 0 --console-log-level warn --max-tries 0 --retry-wait 1 --split 16 --max-connection-per-server 16 --min-split-size 1M"











--output "%ydl_home%/%(playlist_title)s [%(playlist_id)s]/%(uploader)s - %(title)s [%(id)s] (%(resolution)s).%(ext)s"
24 changes: 24 additions & 0 deletions Playlist Reverse.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--ignore-errors
--geo-bypass
--retries infinite
--fragment-retries infinite
--skip-unavailable-fragments
--cache-dir temp
--add-metadata

--external-downloader aria2c
--external-downloader-args "--disk-cache 128M --summary-interval 0 --console-log-level warn --max-tries 0 --retry-wait 1 --split 16 --max-connection-per-server 16 --min-split-size 1M"











--output "%ydl_home%/%(uploader)s - %(playlist_title)s [%(playlist_id)s]/%(playlist_index)03d - %(title)s [%(id)s].%(ext)s"

--playlist-reverse
22 changes: 22 additions & 0 deletions Playlist.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--ignore-errors
--geo-bypass
--retries infinite
--fragment-retries infinite
--skip-unavailable-fragments
--cache-dir temp
--add-metadata

--external-downloader aria2c
--external-downloader-args "--disk-cache 128M --summary-interval 0 --console-log-level warn --max-tries 0 --retry-wait 1 --split 16 --max-connection-per-server 16 --min-split-size 1M"











--output "%ydl_home%/%(uploader)s - %(playlist_title)s [%(playlist_id)s]/%(playlist_index)03d - %(title)s [%(id)s].%(ext)s"
22 changes: 22 additions & 0 deletions retry.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off
setlocal

:start
set retry_err=1

echo.
echo.^> %date% %time%
echo.RUNNING:
echo.%*
echo.

call %* && set retry_err=0

if ["%retry_err%"]==["1"] echo.ERROR, Retrying...
echo.---------------------------------------------------
echo.

if %retry_err%==1 goto :start

pause
exit /b
118 changes: 118 additions & 0 deletions ydl.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
SetWorkingDir, % A_ScriptDir
#SingleInstance, force
#NoEnv
#NoTrayIcon

EnvSet, ydl_dir, % A_ScriptDir
global SCRNAME:="Youtube Downloader"

global Path:=getOpt("path", A_WorkingDir "\Download"), Opts:=getOpt("opts"), Prof:=getOpt("profile","<NONE>"), URL, resSign:=getOpt("sign",">="), Res:=getOpt("res","720")

Gui, Margin, 10, 10

Gui, Add, Text, W50 Right ym+5, URLs
Gui, Add, Edit, vURL x+m W400 yp-5 R5

Gui, Add, Text, W50 Right xm y+15, Options
Gui, Add, Edit, vOpts x+m W400 yp-5 R2, % Opts

Gui, Add, Text, W50 Right y+15 xm, Path
Gui, Add, Edit, vPath x+m W380 yp-5, % Path
Gui, Add, Button, gPathClicked yp-1 x+0 W20, ...

Gui, Add, Text, xm y+15 W50 Right, Resolution
Gui, Add, DropDownList, vresSign x+m yp-5 W40 section section, >=|<=
guiSet("resSign", resSign, "ChooseString")
Gui, Add, ComboBox, vRes x+0 yp W50, 0|144|360|480|720|1080|2160
guiSet("Res", Res)

Gui, Add, Text, x+m yp+5 W50 Right, Profile
Gui, Add, ComboBox, vProf x+m yp-5 W100, % createProfList()
guiSet("Prof", Prof)

Gui, Add, Button, Default gDownload yp-1 xs+330 W70, Download

Gui, Show,, % SCRNAME
Return



GuiClose:
ExitApp

guiSet(key, val, type="Text") {
GuiControl, % type, % key, % val
}

createProfList() {
ret:="<NONE>"
Loop, Files, *.conf
ret.="|" subStr(A_LoopFileName, 1, -5)
return ret
}

Download(){
Gui, +OwnDialogs
Gui, Submit, NoHide
if !validate()
return

urls := !regexReplace(URL,"S)\s+")?"": "-- """ RegexReplace(url,"S)\s+", " ") """"
getAud := Res==0? "-x -f bestaudio" :""
format := "--format-sort """ (resSign=="<="?"":"+") "height:" res ",width,proto_preference,+fps,codec_preference,+filesize,+filesize_approx,+tbr,+vbr,+abr,audio_codec_preference"""
prof := Prof=="<NONE>"?"": "--config-location """ Prof ".conf"""
EnvSet, ydl_home, % Path

cmd := "retry.cmd youtube-dl " prof " " format " " getAud " " Opts " " urls
msgbox % cmd
run, % cmd
}

PathClicked(){
Gui, +OwnDialogs
GuiControlGet, current,, Path
FileSelectFolder, folder, % current, 3
guiSet("Path", folder? folder :current)
}

validate(){
if !URL{
msgbox, % 48+4+256, % SCRNAME, No URL given. `nAre you sure you want to continue?
IfMsgBox, No
return False
}

if Res is not integer
return showErr("Resolution", Res)
if Res<0
return showErr("Resolution", Res)

Path:=RegExReplace(Path, "\\$")
FileCreateDir, % Path
if !InStr(FileExist(Path), "D")
return showErr("Path", Path)

if (Prof!="<NONE>" && !FileExist(Prof ".conf"))
return showErr("Profile", Prof)

saveOpt("path", Path)
saveOpt("profile", Prof)
saveOpt("opts", Opts)
saveOpt("sign", resSign)
saveOpt("res", Res)
return true
}

showErr(key, val) {
msgbox, 16, % SCRNAME, "%val%" is not a valid %key%
return false
}

saveOpt(key, val) {
IniWrite, % val, % A_ScriptFullPath ".ini", Options, % key
}

getOpt(key, def:=" ") {
IniRead, out, % A_ScriptFullPath ".ini", Options, % key, % def
return out
}
4 changes: 4 additions & 0 deletions youtube-dl.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@setlocal
@py "%~dp0\youtube-dl-my-tweaks\youtube_dl\__main__.py" %*
@echo.
@exit /b

0 comments on commit 7e4b055

Please sign in to comment.