1 (изменено: EV, 2019-11-26 16:58:43)

Тема: AHK: Создания папки по имени торрента. RegExReplace

Создание папки по имени торрента, для kodi, plex и т.д, которые тянут инфу, постеры по имени папки.
RegExReplace

2 (изменено: EV, 2019-11-26 16:45:36)

Re: AHK: Создания папки по имени торрента. RegExReplace

Loop, %FullPath%\*.torrent
FileName = %A_LoopFileName%
Text := RegExReplace(FileName, "i)[0-9@#\$\-\ ^&\[\]'\(\)`\{}]|rutor.is|ac3|.S\d|.E\d|gb|dts|custom|dc|divx|divx5|AVC|dvd|dvdrip|dvdivx|hdtv|hdrip|hdtvrip|multisubs|ntsc|ogg|ogm|proper|repack|rerip|retail|cd[1-9]|r3|r5|bd5|se|svcd|read.nfo|unrated|ws|\.ts|\.tc|.bdrip|576p|576i|.720p|1080p|.1080p|1080p|720i|_1080p|l_1080p_l|.1080i|hrhd|hrhdtv|hddvd|.bluray|x264|h264|xvid|xvidvd|xxx|www.www|.BDRemux|REPACK|WEBDL|.DDP5.1|.AlexFilm.TV|.NewStudio.TV|TV|.LostFilm.TV|.iP27|casstudio.tk_|.KvK.CasStudio.TK|.iTunes|.OlLanDGroup|bit|.HEVC|HEVC|.mkv|.CasStudio|.rus|rus|\b  - rus\b 1080p WEBDL |\b(LostFilm)\b|.DUB|.HDCLUB|dub|.EniaHD|.Eng|.Ukr|Jaskier|HEVC|.TUMBLER.Studio|.WEBRip|.Profix.Media|.WEB-DL|BDREMUX|\bD\b|.StudioSubs|\b.m\b|.seleZen|.Sub|.EUR|.torrent|.MegaPeer|._WEB-DLRip_|.[0-9]", "")

StringReplace, Text, Text, ., %A_Space%, All 
StringReplace, Text, Text, _, %A_Space%, All

3

Re: AHK: Создания папки по имени торрента. RegExReplace

Может можно сократить RegExReplace, например удалить всё после 1080P.

4

Re: AHK: Создания папки по имени торрента. RegExReplace

Знать бы ещё, как торрент называется, и какой текст хотите вытащить из названия.

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Skype dmitry_fiveg

5 (изменено: EV, 2019-11-27 02:23:19)

Re: AHK: Создания папки по имени торрента. RegExReplace

Loop, %FullPath%\*.torrent
FileName = %A_LoopFileName%

6

Re: AHK: Создания папки по имени торрента. RegExReplace

Можно через командную строку указать папку, для qBittorrent:

 Run, C:\Program Files\qBittorrent\qbittorrent.exe "%Path2%" --category=TV --first-and-last --save-path="D:\qBittorrent\TV\%TestVar%"

. TestVar имя торрента.

FullPath = %A_Desktop%
Loop, %FullPath%\*.torrent

Для uTorrent:

Run, %A_AppData%\uTorrent\uTorrent.exe /DIRECTORY "D:\qBittorrent\TV\%TestVar%" "%Path2%" 

7

Re: AHK: Создания папки по имени торрента. RegExReplace

#SingleInstance Force
SetBatchLines, -1
SetKeyDelay, 0

FullPath = %A_Desktop%
IfNotExist, %FullPath%\*.torrent
{
 MsgBox, The target file does not exist.
ExitApp
}

IfExist, %FullPath%\*.torrent

Loop, %FullPath%\*.torrent
FileName = %A_LoopFileName%
Text := RegExReplace(FileName, "i)[0-9@#\$\-\ ^&\[\]'\(\)`\{}]|rutor.is|ac3|.S\d|.E\d|gb|dts|custom|dc|divx|divx5|AVC|dvd|dvdrip|dvdivx|hdtv|hdrip|hdtvrip|multisubs|ntsc|ogg|ogm|proper|repack|rerip|retail|cd[1-9]|r3|r5|bd5|se|svcd|read.nfo|unrated|ws|\.ts|\.tc|.bdrip|576p|576i|.720p|1080p|.1080p|1080p|720i|_1080p|l_1080p_l|.1080i|hrhd|hrhdtv|hddvd|.bluray|x264|h264|xvid|xvidvd|xxx|www.www|.BDRemux|REPACK|WEBDL|.DDP5.1|.AlexFilm.TV|.NewStudio.TV|TV|.LostFilm.TV|.iP27|casstudio.tk_|.KvK.CasStudio.TK|.iTunes|.OlLanDGroup|bit|.HEVC|HEVC|.mkv|.CasStudio|.rus|rus|\b  - rus\b 1080p WEBDL |\b(LostFilm)\b|.DUB|.HDCLUB|dub|.EniaHD|.Eng|.Ukr|Jaskier|HEVC|.TUMBLER.Studio|.WEBRip|.Profix.Media|.WEB-DL|BDREMUX|\bD\b|.StudioSubs|\b.m\b|.seleZen|.Sub|.EUR|.torrent|.MegaPeer|._WEB-DLRip_|.[0-9]", "")

StringReplace, Text, Text, ., %A_Space%, All 
StringReplace, Text, Text, _, %A_Space%, All
Text := RegexReplace(Text, "[^A-Z\s]\K([A-Z])", " $1") ; Пробел перед заглавной

Gui, Color, a8a6a0
Gui, +AlwaysOnTop
Gui, Add, Button, x2 y30 w140 h30 , Films
Gui, Add, Button, x142 y30 w150 h30 , TV
Gui, Font, S11 CDefault, Verdana
Gui, Font, S11 CDefault, Verdana
Gui, Font, , 
Gui, Add, Button, x372 y30 w80 h30 , Закрыть
Gui, Font, , 
Gui, Font, S11, Verbana
Gui, Add, Edit, x2 y0 w530 h30 vTestVar, %Text%
Gui, Font, , 
Gui, Add, Button, x452 y30 w80 h30 , Отмена
Gui, Add, Button, x292 y30 w80 h30 , SwitchLocale
Gui, Show, x670 y836 h63 w536, qBittorrent
Return

GuiClose:
ExitApp

ButtonОтмена:
Gui, destroy
   ExitApp

ButtonЗакрыть:
RunWait, cmd.exe /c Taskkill /f /im qbittorrent.exe,, Hide
Gui, destroy
   ExitApp
    
ButtonFilms:
Gui, Submit, NoHide
FileCreateDir, D:\qBittorrent\Films\%TestVar%
FullPath = %A_Desktop%
Loop, %FullPath%\*.torrent
Path1 = %A_LoopFileFullPath%
Run, C:\Program Files\qBittorrent\qbittorrent.exe "%Path1%" --category=Films --first-and-last --save-path="D:\qBittorrent\Films\%TestVar%"  ; --sequential
WinActivate, ahk_exe qbittorrent.exe
WinWait, ahk_exe qbittorrent.exe
;Send {Enter 2}
ExitApp	

ButtonTV:
Gui, Submit, NoHide
FileCreateDir, D:\qBittorrent\TV\%TestVar%
FullPath = %A_Desktop%
Loop, %FullPath%\*.torrent
Path2 = %A_LoopFileFullPath%
Run, C:\Program Files\qBittorrent\qbittorrent.exe "%Path2%" --category=TV --first-and-last --save-path="D:\qBittorrent\TV\%TestVar%"  ; --sequential
WinActivate, ahk_exe qbittorrent.exe
WinWait, ahk_exe qbittorrent.exe
;Send {Enter 2}
ExitApp	
 
ButtonSwitchLocale:
StringCaseSense On
ControlFocus, Edit1, ahk_exe AutoHotkey.exe
Send ^{vk41}  ; "Ctrl+A"

   ;clipSave:=clipAnsi()
   send ^{Insert}
   sleep,50
StringReplace, Clipboard, Clipboard, zh , ж , All
StringReplace, Clipboard, Clipboard, kh , х , All
StringReplace, Clipboard, Clipboard, shh , щ , All
StringReplace, Clipboard, Clipboard, sch , щ , All
StringReplace, Clipboard, Clipboard, sh , ш , All
StringReplace, Clipboard, Clipboard, ju , ю , All
StringReplace, Clipboard, Clipboard, yu , ю , All
StringReplace, Clipboard, Clipboard, ja , я , All
StringReplace, Clipboard, Clipboard, ya , я , All
StringReplace, Clipboard, Clipboard, ts , ц , All
StringReplace, Clipboard, Clipboard, ch , ч , All
StringReplace, Clipboard, Clipboard, c , ц , All
StringReplace, Clipboard, Clipboard, h , х , All
StringReplace, Clipboard, Clipboard, j , й , All
StringReplace, Clipboard, Clipboard, Zh , Ж , All
StringReplace, Clipboard, Clipboard, Kh , Х , All
StringReplace, Clipboard, Clipboard, Shh , Щ , All
StringReplace, Clipboard, Clipboard, Ju , Ю , All
StringReplace, Clipboard, Clipboard, Yu , Ю , All
StringReplace, Clipboard, Clipboard, Ja , Я , All
StringReplace, Clipboard, Clipboard, Ya , Я , All
StringReplace, Clipboard, Clipboard, Ts , Ц , All
StringReplace, Clipboard, Clipboard, Ch , Ч , All
StringReplace, Clipboard, Clipboard, Sch , Щ , All
StringReplace, Clipboard, Clipboard, Sh , Ш , All
StringReplace, Clipboard, Clipboard, C , Ц , All
StringReplace, Clipboard, Clipboard, H , Х , All
StringReplace, Clipboard, Clipboard, a , а , All
StringReplace, Clipboard, Clipboard, b , б , All
StringReplace, Clipboard, Clipboard, v , в , All
StringReplace, Clipboard, Clipboard, w , в , All
StringReplace, Clipboard, Clipboard, g , г , All
StringReplace, Clipboard, Clipboard, d , д , All
StringReplace, Clipboard, Clipboard, e , е , All
StringReplace, Clipboard, Clipboard, z , з , All
StringReplace, Clipboard, Clipboard, i , и , All
StringReplace, Clipboard, Clipboard, k , к , All
StringReplace, Clipboard, Clipboard, l , л , All
StringReplace, Clipboard, Clipboard, m , м , All
StringReplace, Clipboard, Clipboard, n , н , All
StringReplace, Clipboard, Clipboard, o , о , All
StringReplace, Clipboard, Clipboard, p , п , All
StringReplace, Clipboard, Clipboard, r , р , All
StringReplace, Clipboard, Clipboard, s , с , All
StringReplace, Clipboard, Clipboard, t , т , All
StringReplace, Clipboard, Clipboard, u , у , All
StringReplace, Clipboard, Clipboard, f , ф , All
StringReplace, Clipboard, Clipboard, y , ы , All
StringReplace, Clipboard, Clipboard, ' , ь , All
StringReplace, Clipboard, Clipboard, A , А , All
StringReplace, Clipboard, Clipboard, B , Б , All
StringReplace, Clipboard, Clipboard, V , В , All
StringReplace, Clipboard, Clipboard, W , В , All
StringReplace, Clipboard, Clipboard, G , Г , All
StringReplace, Clipboard, Clipboard, D , Д , All
StringReplace, Clipboard, Clipboard, E , Е , All
StringReplace, Clipboard, Clipboard, Z , З , All
StringReplace, Clipboard, Clipboard, I , И , All
StringReplace, Clipboard, Clipboard, K , К , All
StringReplace, Clipboard, Clipboard, L , Л , All
StringReplace, Clipboard, Clipboard, M , М , All
StringReplace, Clipboard, Clipboard, N , Н , All
StringReplace, Clipboard, Clipboard, O , О , All
StringReplace, Clipboard, Clipboard, P , П , All
StringReplace, Clipboard, Clipboard, R , Р , All
StringReplace, Clipboard, Clipboard, S , С , All
StringReplace, Clipboard, Clipboard, T , Т , All
StringReplace, Clipboard, Clipboard, U , У , All
StringReplace, Clipboard, Clipboard, F , Ф , All
StringReplace, Clipboard, Clipboard, Y , Ы , All
   send +{Insert}
Return