Open Usernamnet opened 2 years ago
Or you write a short script that does the trick; included below is an example that works with MS Windows (.bat-file). Doing it that way you don't need svtplay-dl to support formatting of meta data to meet your specific requirements.
@echo off setlocal EnableExtensions :: :: A simple script-wrapper to svtplay-dl to set resolution as part of filename :: Use the script with parameters as they would have been used with svtplay-dl :: :: limitation: supports a single value for resolution used with parameter --resolution :: :: 1. use svtplay-dl to get media, put the result in a temporary subdirectory set tmp=%RANDOM% md svtpl%tmp% cd svtpl%tmp% call svtplay-dl % :: get the file name of what svtplay-dl has created dir /b .mp4 > filename_mp4.txt 2>&1 dir /b .mkv > filename_mkv.txt 2>&1 :: :: 2. get resolution from the parameter list used with svtplay-dl set argcount=0 :get_arg if -%1-==-- goto :argdone set /a argcount+=1 set chk=%1 if not %chk:--resolution=%==%chk% set /a match=argcount+1 if %argcount% equ %match% set resolution=%chk:=% shift goto :get_arg :arg_done :: :: 3. setup file-renaming to your liking if %resolution%==360 set filename_meta=[640x360] if %resolution%==540 set filename_meta=[960x540] if %resolution%==720 set filename_meta=[1280x720] if %resolution%==1080 set filename_meta=[1920x1080] :: etc etc :: :: 4. rename the file and clean up temporary resources for /f "tokens=" %%i in (filename_mp4.txt filename_mkv.txt) do ( call :setname %%i ) del *.txt > nul 2>&1 cd.. rd svtpl%tmp% exit /b :: subroutine to perform file renaming and relocation :set_name set filename="%1" if %filename%=="File Not Found" exit /b set filename=%filename:"=% if not %filename:.mp4=%==%filename% ( ren %filename% %filename:.mp4=%%filename_meta%.mp4 move %filename:.mp4=%%filename_meta%.mp4 .. ) else if not %filename:.mkv=%==%filename% ( ren %filename% %filename:.mkv=%%filename_meta%.mkv move %filename:.mkv=%%filename_meta%.mkv .. ) exit /b
Now when new feature {resolution} is in place. it would be nice to have that as a filename option for the configfile