Move subtitle and rename all files

Any questions? Need some help?
Post Reply
rpluto
Posts: 4
Joined: 29 Apr 2014, 12:04

Move subtitle and rename all files

Post by rpluto »

Hi there.

I have one script thats call filebot with the specific parameters

The Main purpose of this script is to move/rename subtitles from a dropbox folder to the correct location of the video file and rename this video file too.

For Series i include the path of the all series in the script.

Code: Select all

'#V ----------------------------------------------
With Series.Append(New CSerie)
  .Name   = "Vikings"
  .Search = "Vikings"
  .Path   = PathSeries & "Vikings\season02\"
End with

Code: Select all


Private Function SubtitleSeries_Action_RenameFilesAndMove()
	Dim FileBotFormat
	Set WshShell = CreateObject("Wscript.Shell")
	FilebotFormat = "{n.upperInitial().space('.')}.{s00e00}.{t.space('.')}.{source}-{group}{if (lang.toString()=='por')'.pt'}{if (lang.toString()=='eng')'.en'}"

	Aux_DeleteTempFiles(Path)	

	Aux_SendNotification "SubSerie - " & FileName, FileName & " added to " & Path	

	WshShell.Run [b]FilebotPath & " -rename " & chr(34) & Fullpath & FileName & chr(34) & " --db TheTVDB --format " & chr(34) & FilebotFormat & chr(34) & " --lang en --action move -non-strict --conflict override --output " & chr(34) & Path & chr(34[/b]),7,TRUE
	
	Aux_DeleteTempFiles(Path)	
	
	WScript.sleep 10000
	WshShell.Run [b]FilebotPath & " -rename " & chr(34) & Replace(Path,"\","\\") & chr(34) & " --db TheTVDB --format " & chr(34) & FilebotFormat & chr(34) & " --lang en --action move -non-strict --conflict fail[/b]",7,TRUE
	
	Aux_DeleteTempFiles(Path)
	Aux_RefreshPlex(19)
End Function	

So far so good for Series

The process is like this:
Sickbeard snatch the file to uTorrent and when downloaded put it on the correct location. for example (Vikings\Season02\.....)
After this when i stop the torrent, in uTorrent, the script runs and rename all files in that folder.
(This because i have the path where the uTorrent saved the episode)

When i have subtitles, i put the subtitle, remotely, on a dropbox folder, and this part of script is called to

1) Move the subtitle to Path
2) Rename everything on that Path (again)

But now i try to do something like this to Movies, but i dont have the Path of the movie so to move the subtitle file i used

Code: Select all

Private Function SubtitleMovies_Action_RenameFilesAndMove()
	Dim FileBotFormat
	Set WshShell = CreateObject("Wscript.Shell")
	FilebotFormat = PathMoviesHD & "/{n.upperInitial()} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{source}.{vc}.{ac}.{group}{if (lang.toString()=='por')'.pt'}{if (lang.toString()=='eng')'.en'}"
	
	Aux_SendNotification "SubMovie - " & FileName, FileName & " added to " & PathMoviesHD	

	WshShell.Run FilebotPath & " -rename " & chr(34) & Fullpath & FileName & chr(34) & " --db TheMovieDB --format " & chr(34) & FilebotFormat & chr(34) & " --lang en --action move -non-strict --conflict override --output " & chr(34) & PathMoviesHD & chr(34),7,TRUE
	
	....
End Function


But after this i dont know how to rename all files on that folder because, i dont know which folder is created.

Can someone help how i can solve this?

This also is need to optimize the current script, and put all in one, without to have the paths for all series in the script.

Thanks.
User avatar
rednoah
The Source
Posts: 23933
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Move subtitle and rename all files

Post by rednoah »

The issue may be clear to you, but just pasting code with loads of text will not help anyone else. I don't know what you want other than "It doesn't work. Make it work." which is the kind of requests if learned to ignore for the sake of mental sanity. ;)


PS: I'm on Linux now and have no way (nor interested) in debugging your Visual Basic code. If you want me to write scripts for you it's $100 minimum.

PS2: And if you want me to do it in Visual Basic I'll set the minimum at $1000, just so I don't have to do it. :P
:idea: Please read the FAQ and How to Request Help.
rpluto
Posts: 4
Joined: 29 Apr 2014, 12:04

Re: Move subtitle and rename all files

Post by rpluto »

Ok RedNoah, if you understand like that, no problem.

Thank you anyway RedNoah
rpluto
Posts: 4
Joined: 29 Apr 2014, 12:04

Re: Move subtitle and rename all files

Post by rpluto »

Think i made it


Calling the script from my VbScript

Code: Select all

Private Function Subtitle_Main()
	'iniciar variaveis
	Fullpath = Left(Wscript.Arguments(1),InStrRev(Wscript.Arguments(1),"\"))
	FileName = Mid(Wscript.Arguments(1),len(Fullpath)+1) 
	Aux_RenameFile(Wscript.Arguments(1))
	FileName=LCase(FileName)
	FileExtension = Right(FileName,len(FileName) - InStrRev(FileName,"."))

	if FileExtension <> "srt" then 
		WScript.quit ' se nao legendas sai do script
	end if

	Dim FileBotFormat
	Set WshShell = CreateObject("Wscript.Shell")
	
	Aux_SendNotification "Subtitle - " & FileName, ""

	WshShell.Run FilebotPath & " --action move -non-strict --conflict override -script " & chr(34) & FilebotScriptPath & "move_subtitle" & chr(34) & " " & chr(34) & Fullpath & FileName & chr(34),7,TRUE
	
	Aux_RefreshPlex(19)
	Aux_RefreshPlex(8)
End Function

And the rest is part of RedNoah amc script code

http://pastebin.com/6DFDxXvd

And of clean.groovy too

http://pastebin.com/JewSy4vJ


And the most important :)

http://books.google.co.ao/books?id=kV8G ... &q&f=false


Thx again for your work RedNoah
User avatar
rednoah
The Source
Posts: 23933
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Move subtitle and rename all files

Post by rednoah »

Oh, you found a free ebook on Groovy! Nice, I'll add that to the links section.
:idea: Please read the FAQ and How to Request Help.
Post Reply