AMC - rescan PLEX library section

Running FileBot from the console, Groovy scripting, shell scripts, etc
ptoshack
Posts: 2
Joined: 20 Feb 2016, 16:51

AMC - rescan PLEX library section

Post by ptoshack »

hi,

I have been using FileBot and AMC for quite some time now and have since converted my entire library of TV, movies and music. In fact I have 5 large PLEX libraries.

My question is how do I trigger a rescan of a specific section only?

The manual method from a web browser:

http://192.168.x.xxx:32400/library/sections/1/refresh

or command-line:

.\"Plex Media Scanner.exe" --scan --refresh --section 1


My working script looks like this:

filebot -script fn:amc --output "N:\TV Library" --log-file "N:\TV Library\amc.log" --action move -non-strict "N:\TV Library\Downloads" --def excludeList="N:\TV Library\amc_tv.txt" --def clean=y --def storeReport=y --def plex=192.168.x.xxx:<token>

Any suggestions would be appreciated.

Cheers
Paul
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

Not supported. But a scan for new files shouldn't take more than a few hundred milliseconds even if you have millions of files.

EDIT: you can use the --def exec option though
:idea: Please read the FAQ and How to Request Help.
ptoshack
Posts: 2
Joined: 20 Feb 2016, 16:51

Re: AMC - rescan PLEX library section

Post by ptoshack »

Thanks. I like the --def exec option although it seems to be very particular about spaces in the command that gets executed. I've tried various ways to escape the spaces with no luck. Any suggestions?

The addition of this line in my FileBot script

--def exec="c:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --scan --refresh --section 1"

gives the following error:

Locking N:\TV Library\amc.log
Run script [fn:amc] at [Sun Feb 21 10:57:55 EST 2016]
Parameter: excludeList = N:\TV Library\amc_tv.txt
Parameter: clean = y
Parameter: storeReport = y
Parameter: exec = c:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --scan --refresh --section 1
Argument: N:\TV Library\Downloads
Creating excludes: N:\TV Library\amc_tv.txt
Input: N:\TV Library\Downloads\Hawaii.Five-0.2010.S06E15.HDTV.x264-LOL[rarbg]\hawaii.five-0.2010.615.hdtv-lol.mp4
Exclude: N:\TV Library\Downloads\Hawaii.Five-0.2010.S06E15.HDTV.x264-LOL[rarbg]\RARBG.com.txt
Exclude: N:\TV Library\Downloads\Hawaii.Five-0.2010.S06E15.HDTV.x264-LOL[rarbg]\hawaii.five-0.2010.615.hdtv-lol.nfo
Group: [tvs:hawaii five 0] => [hawaii.five-0.2010.615.hdtv-lol.mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [Hawaii Five-0, Hawaii Five 0 2010]
Fetching episode data for [Hawaii Five-0]
Fetching episode data for [Hawaii Five-O]
Processed 1 files
Execute: c:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --scan --refresh --section 1
'c:\Program' is not recognized as an internal or external command,
operable program or batch file.

Saving report as C:\Users\Medusa\AppData\Roaming\FileBot\reports\AMC [2016-02-21 10h58m] Hawaii.Five-0.2010.S06E15.HDTV.x264-LOL[rarbg].html
Done ヾ(@⌒ー⌒@)ノ

Press any key to continue . . .
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

Mind your spaces.

Please read the command-line noob manual:
viewtopic.php?f=4&t=1899
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

I would want to use this as well but does filebot have a way to retrieve the path of the show it just moved so i can trigger a partial scan?

ie:

Rename episodes using [TheTVDB]
Auto-detected query: [Blue Bloods]
Fetching episode data for [Blue Bloods]
[MOVE] Rename [P:\Processing\sonarr_tv\blue.bloods.703.hdtv-lol.mkv] to [D:\videos\TV\Blue Bloods\Season 7\Blue Bloods - 7x03 - The Price of Justice.mkv]
Processed 1 files

just grab D:\videos\TV\Blue Bloods\Season 7 so i can do

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 2 --directory "D:\videos\TV\Blue Bloods\Season 7"
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

You can use --def exec for any command:

Code: Select all

--def exec="mycommand \"{folder}\""
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Thanks
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

When i try using this via powershell i get a error but not exactly sure what the problem is...maybe you might see it

Error:

Code: Select all

filebot : File not found: C:\Windows\System32\WindowsPowerShell\v1.0\Files
At line:1 char:8
+        filebot -script  fn:amc --def seriesFormat="D:/videos/TV/{n}/{'Season '+s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (File not found:...hell\v1.0\Files:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
My Script:

Code: Select all

function output-filbotMovies{

param ([int]$plexsection, $Folder)
Write-host "Looking for New French Movies or English Movies" -foregroundcolor "red"
filebot -script  fn:amc --def movieFormat="D:/videos/{file =~ /cpsfr/ ? audio.size() > 1 ? 'dual audio movies' : 'French movies' : 'movies'}/{plex[1..-1]}" --action move -non-strict $Folder --log-file P:/scripts/Filebot.log --def ut_label=Movie --def clean=y -no-xattr --log Fine --def exec=""C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section $plexsection --directory \"{folder}\""

}

$Source = "P:\Processing"

$FolderPaths = get-childitem $source |select -ExpandProperty fullname

foreach ($FolderPath in $FolderPaths){

    $directoryInfo = (Get-ChildItem $FolderPath | Measure-Object).count

    if ($FolderPath -match "sickrage_tv" -and $directoryInfo -gt 1){
	
			Write-host "Looking for New French Series" -foregroundcolor "red"
           filebot -script  fn:amc --def seriesFormat="D:/videos/FrenchTV/{n}/{'Season '+s}/{n} - {sxe} - {t}" --action move -non-strict $FolderPath --log-file P:/scripts/Filebot.log  --def ut_label=Series --def clean=y -no-xattr --log Fine --lang fr --def exec='"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 6 --directory \"{folder}\"'

    }
    ElseIf ($FolderPath -match "^.*(cps|cpsfr).*$" -and $directoryInfo -gt 2){

         $Files = (get-childitem $FolderPath -recurse |?{$_.name -like "*.mkv" -or $_.name -like "*.mp4" -or $_.name -like "*.avi" }).Fullname
         foreach ($File in $Files){
            
            $audio = P:\apps\Mediainfo_x64\MediaInfo.exe "--Inform=General;%AudioCount%" $File

            if ($FolderPath -like "*cps"){
			    $section = "1"
                output-filbotMovies -plexsection $section -Folder $FolderPath
		    }
		    Elseif ($audio -ge 2){
            
                $section = "18"
                output-filbotMovies -plexsection $section -Folder $FolderPath
                    
            }
            Else {

                $section = "17"
                output-filbotMovies -plexsection $section -Folder $FolderPath    
            }
		}
    }
    Elseif ($FolderPath -match "sonarr_tv" -and $directoryInfo -gt 1){

		Write-host "Looking for New English Series" -foregroundcolor "red"
       filebot -script  fn:amc --def seriesFormat="D:/videos/TV/{n}/{'Season '+s}/{n} - {sxe} - {t}" --action test -non-strict $FolderPath --log-file P:/scripts/Filebot.log --def clean=y -no-xattr --log Fine --conflict auto --def ut_label=Series --def exec='"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory \"{folder}\"'
    }
    ElseIf ($FolderPath -match "UFC" -and $directoryInfo -gt 0){
        
		Write-host "Looking for New UFC PPV/FN" -foregroundcolor "red"
        filebot -script  fn:amc --def movieFormat="D:/videos/UFC/{plex[1..-1]}" --action move -non-strict $FolderPath --log-file P:/scripts/Filebot.log --def ut_label=Movie --def clean=y -no-xattr --log Fine --def exec='"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 2 --directory \"{folder}\"'
    
    }
}

If i run the script without

Code: Select all

--def exec='"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory \"{folder}\"'
It works
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

Use @files to avoid the intricacies of command-line argument parsing: viewtopic.php?t=3244
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Using @file like so?

plexscanner.txt

Code: Select all

--def exec='"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory \"{folder}\"'
Full command would be ?

Code: Select all

filebot -script  fn:amc --def seriesFormat="D:/videos/TV/{n}/{'Season '+s}/{n} - {sxe} - {t}" --action test -non-strict $FolderPath --log-file P:/scripts/Filebot.log --def clean=y -no-xattr --log Fine --conflict auto --def ut_label=Series --def exec=@P:/scripts/plexscanner.txt
Maybe i should call a batch file...but again im still stuck with passing the folder path to plexscanner...
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Well i dont think this will work because it will fail when i have more then one tv show to process since it doesnt launch after each show and only after all items have been processed.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

The whole point of the @file is so that you don't have to command-line escape the arguments... Hence the @file will look like this:

Code: Select all

exec="C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "{folder}"
Usage:

Code: Select all

filebot -script fn:sysenv --def @/path/to/my/def.txt
saitoh183 wrote:Well i dont think this will work because it will fail when i have more then one tv show to process
Why would you think that? This is wrong. It'll work. Check the logs.
saitoh183 wrote:it doesnt launch after each show and only after all items have been processed.
This is correct.
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

So for my purpose it is not a solution because the plex scanner needs to launch for each file cuz of the --directory parameter in the command. Or else it without it, it will scan the entire library
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

Use your script to process two different files, and then post the logs here. We'll see what's happening and you can explain how it's different from what you want.
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Ok,

here is a example of what needs to happen:

Folder A:
Show 1
Show 2

Filebot:
After each file --def exec needs to run

So after Show 1 is processed i would need
C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "D:\Videos\TV\Show1\ Season X"
Then Show 2 is processed by Filebot and then exec runs
C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "D:\Videos\TV\Show2\ Season X"
And so on


If there is only 1 Show to process (all within the same season), then everything will work

But if there are multiple shows or even 1 show but with episodes from different season, the exec will fail because it will only pass the last folder processes to the plexscanner.exe directory parameter.

So we would get: (which would be wrong outcome)
Filebot reports Show 1 processed
Filebot reports Show 2 processed
--exec runs:
C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "D:\Videos\TV\Show2\ Season X"



The only way i think i could maybe get around this limitation would be if there was a way to store each folder path into some sort of array after each file is process and then pass that array to my script that i set in the --exec parameter. Then in my script i process each element of the array with a loop....IDK...just thinking out loud..
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

PLEASE POST THE COMPLETE LOG

--def exec will execute one command PER FILE which is what you're asking for (though if you were to call the EXACT SAME command multiple times then FileBot will optimize that away) so either it's already working, or there's a bug. Either way, the log will show what's happening.


EDIT:


This is a LOG. It clearly shows what's going on and is thus VERY HELPFUL in helping us understand what's going on.

As we can see, the --def exec command is called once PER FOLDER because the execute template we pass in yields 2 unique commands when applied to the 3 processed files:

Code: Select all

...
Parameter: exec = ls -l '{folder}'
Input: Alias.1x01.mp4
Input: Alias.1x02.mp4
Input: Alias.2x01.mp4
...
[COPY] Rename [Alias.1x01.mp4] to [TV Shows/Alias/Season 01/Alias - S01E01 - Truth Be Told.mp4]
[COPY] Rename [Alias.1x02.mp4] to [TV Shows/Alias/Season 01/Alias - S01E02 - So It Begins.mp4]
[COPY] Rename [Alias.2x01.mp4] to [TV Shows/Alias/Season 02/Alias - S02E01 - The Enemy Walks In.mp4]
Processed 3 files
Execute: ls -l 'TV Shows/Alias/Season 01'
total 0
-rw-r--r--  1 reinhard  staff  0 Oct 14 01:35 Alias - S01E01 - Truth Be Told.mp4
-rw-r--r--  1 reinhard  staff  0 Oct 14 01:35 Alias - S01E02 - So It Begins.mp4
Execute: ls -l 'TV Shows/Alias/Season 02'
total 0
-rw-r--r--  1 reinhard  staff  0 Oct 14 01:35 Alias - S02E01 - The Enemy Walks In.mp4
...
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

I will post a log file once i can get it to actually run my script at the end currently i still have the same error even with the @file command

Thanks for the example but why i said it wouldnt work as i want was because of what you replied to my statement
rednoah wrote:saitoh183 wrote:
it doesnt launch after each show and only after all items have been processed.

This is correct.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

You can always wrap the amc script in your own script and then call the amc script folder per folder so exec will be executed after each folder. I don't see the point but you can make your exact use case work if you don't mind a line of bash script (or many lines of PS script :P). :D
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Seem to be getting a error when it comes to process exec

my plexscanner.txt

Code: Select all

exec='C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe' --scan --refresh --section 3 --directory "{folder}"
I also tried

Code: Select all

exec='"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "{folder}"'
Log:

Code: Select all

PS C:\Windows\System32\WindowsPowerShell\v1.0>        filebot -script  fn:amc --def seriesFormat="P:/videos/TV/{n}/{'Season '+s}/{n} - {sxe} - {t}" --action test -non-strict $FolderPath --log-file P:/scripts/Filebot.log --def clean=y -no-xattr --log Fine --conflict auto --def ut_label=Series --def @P:/scripts/plexscanner.txt

Locking P:\scripts\Filebot.log
Run script [fn:amc] at [Fri Oct 14 08:48:55 EDT 2016]
Rename episodes using [TheTVDB]
Auto-detected query: [The Real World]
Fetching episode data for [The Real World]
Fetching episode data for [The Real L Word]
Fetching episode data for [The Ideal World]
Fetching episode data for [My Week in the Real World]
Fetching episode data for [The Challenge]
[TEST] Rename [P:\testp\sonarr_tv\The.Real.World.S32E01.HDTV.x264-CRiMSON\WaAdEmhS18g0pzGiGg6fuOGdok1P7XMDcu5v.mkv] to [P:\videos\TV\The Real World\Season 32\The Real World - 32x01 - A Bloody Good Start.mkv]
Processed 1 files
filebot : The filename, directory name or volume label syntax is incorrect.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Could it be that Filebot is interpreting the plexscanner parameters as Filebot parameters so it is looking for a --def ?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC - rescan PLEX library section

Post by rednoah »

Nope, FileBot definitely doesn't have any issues here. You can't use '...' as quotes on Windows, so you're already wrong there. Your @file probably has empty lines as well so you're passing "" (empty string) as argument. Your smart use of --log fine instead of default --log all probably hides important output. Why would you reduce logging when haven't even gotting it working? Oh well...

EDIT: --output is missing as well


Here is the solution. Change that paths, run it, post back the command-line output.

Code: Select all

filebot -script fn:amc /path/to/input --output "P:/videos" --action test -non-strict --log-file amc.log -no-xattr --conflict auto --def ut_label=Series clean=y exec=@X:/scanner.cmd
X:/scanner.cmd

Code: Select all

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "{folder}"
:idea: Please read the FAQ and How to Request Help.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Code: Select all

Run script [fn:amc] at [Fri Oct 14 12:28:10 EDT 2016]
Parameter: seriesFormat = P:/videos/TV/{n}/{'Season '+s}/{n} - {sxe} - {t}
Parameter: clean = y
Parameter: ut_label = Series
Parameter: exec = "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "{folder}"
Argument: P:\Processing\sonarr_tv
Input: P:\Processing\sonarr_tv\macgyver.2016.103.hdtv-lol.mkv
Input: P:\Processing\sonarr_tv\Project.Runway.S15E05.HDTV.x264-daview\2MqPomZAa6GC4rBDnOdkvi.mp4
Exclude: P:\Processing\sonarr_tv\.stfolder
Exclude: P:\Processing\sonarr_tv\Project.Runway.S15E05.HDTV.x264-daview\16085539.txt
Group: [tvs:macgyver] => [macgyver.2016.103.hdtv-lol.mkv]
Group: [tvs:project runway] => [2MqPomZAa6GC4rBDnOdkvi.mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [MacGyver]
Fetching episode data for [MacGyver]
Fetching episode data for [MacGyver (2016)]
Fetching episode data for [Bunny MacGyver]
Fetching episode data for [Young MacGyver]
Apply Filter: {age < 7}
Include [MacGyver (2016) - 1x04 - Wire Cutter]
[TEST] Rename [P:\Processing\sonarr_tv\macgyver.2016.103.hdtv-lol.mkv] to [P:\videos\TV\MacGyver (2016)\Season 1\MacGyver (2016) - 1x04 - Wire Cutter.mkv]
Processed 1 files
Rename episodes using [TheTVDB]
Auto-detected query: [Project Runway]
Fetching episode data for [Project Runway]
Fetching episode data for [Project Runway Korea]
Fetching episode data for [Project Runway Junior]
Fetching episode data for [Project Runway Italia]
Fetching episode data for [Project Runway Canada]
Apply Filter: {age < 7}
Include [Project Runway - 15x05 - There's No “I” in “Team”]
[TEST] Rename [P:\Processing\sonarr_tv\Project.Runway.S15E05.HDTV.x264-daview\2MqPomZAa6GC4rBDnOdkvi.mp4] to [P:\videos\TV\Project Runway\Season 15\Project Runway - 15x05 - There's No “I” in “Team”.mp4]
Processed 1 files
Execute: "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "P:\videos\TV\MacGyver (2016)\Season 1"
Execute: "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "P:\videos\TV\Project Runway\Season 15"
Done ヾ(@⌒ー⌒@)ノ
Ok, it seems to work for launching the execute on each file. Now i just need to see if plex is actually getting the command. My plex is in the middle of a refresh so i will see after it is done. I wish i didnt have to use powershell to do my entire script but it is the language i have the most knowledge about and im on windows 8.1...Setting the log to Fine hide the Execute line from the log...this is also a reason why i thought it wasnt working.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Ok, it is not launching even if the execute says so in the log. In Powershell console i see the following

Code: Select all

Locking P:\scripts\Filebot.log
Run script [fn:amc] at [Fri Oct 14 13:23:49 EDT 2016]
Parameter: seriesFormat = P:/videos/TV/{n}/{'Season '+s}/{n} - {sxe} - {t}
Parameter: clean = y
Parameter: ut_label = Series
Parameter: exec = "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "{folder}"
Argument: P:\Processing\sonarr_tv
Input: P:\Processing\sonarr_tv\macgyver.2016.103.hdtv-lol.mkv
Input: P:\Processing\sonarr_tv\Project.Runway.S15E05.HDTV.x264-daview\2MqPomZAa6GC4rBDnOdkvi.mp4
Exclude: P:\Processing\sonarr_tv\.stfolder
Exclude: P:\Processing\sonarr_tv\Project.Runway.S15E05.HDTV.x264-daview\16085539.txt
Group: [tvs:macgyver] => [macgyver.2016.103.hdtv-lol.mkv]
Group: [tvs:project runway] => [2MqPomZAa6GC4rBDnOdkvi.mp4]
Rename episodes using [TheTVDB]
Auto-detected query: [MacGyver]
Fetching episode data for [MacGyver]
Fetching episode data for [MacGyver (2016)]
Fetching episode data for [Bunny MacGyver]
Fetching episode data for [Young MacGyver]
Apply Filter: {age < 7}
Include [MacGyver (2016) - 1x04 - Wire Cutter]
[TEST] Rename [P:\Processing\sonarr_tv\macgyver.2016.103.hdtv-lol.mkv] to [P:\videos\TV\MacGyver (2016)\Season 1\MacGyver (2016) - 1x04 - Wire Cutter.mkv]
Processed 1 files
Rename episodes using [TheTVDB]
Auto-detected query: [Project Runway]
Fetching episode data for [Project Runway]
Fetching episode data for [Project Runway Korea]
Fetching episode data for [Project Runway Junior]
Fetching episode data for [Project Runway Italia]
Fetching episode data for [Project Runway Canada]
Apply Filter: {age < 7}
Include [Project Runway - 15x05 - There's No “I” in “Team”]
[TEST] Rename [P:\Processing\sonarr_tv\Project.Runway.S15E05.HDTV.x264-daview\2MqPomZAa6GC4rBDnOdkvi.mp4] to [P:\videos\TV\Project Runway\Season 15\Project Runway - 15x0
5 - There's No “I” in “Team”.mp4]
Processed 1 files
Execute: "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "P:\videos\TV\MacGyver (2016)\Season 1"
filebot : 'C:\Program' is not recognized as an internal or external command,
At line:1 char:1
+ filebot -script  fn:amc --def seriesFormat=@P:/scripts/test.groovy --filter "age ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ('C:\Program' is...ternal command,:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
operable program or batch file.
Execute: "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "P:\videos\TV\Project Runway\Season 15"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

I think i figured it out

needed double quotes around the entire line of the test.cmd

Code: Select all

""C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section 3 --directory "{folder}""
Plex Media Scanner.log

Code: Select all

Oct 14, 2016 13:33:04.363 [4932] INFO - Plex Media Scanner v1.2.2.2857-d34b464 - Microsoft PC x64 - build: windows-i386 - GMT -04:00
Oct 14, 2016 13:33:04.364 [4932] INFO - Windows version: 6.3 (Build 9600), language en-GB
Oct 14, 2016 13:33:04.364 [4932] INFO - 4 2400 MHz processor(s): Architecture=0, Level=15, Revision=1537 Processor Identifier=Intel64 Family 15 Model 6 Stepping 1, GenuineIntel
Oct 14, 2016 13:33:04.365 [4932] DEBUG - "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe"  --scan --refresh --section 3 --directory "P:\videos\TV\Project Runway\Season 15"
Oct 14, 2016 13:33:04.361 [7048] DEBUG - Opening 20 database sessions to library, SQLite 3.8.9, threadsafe=1
Oct 14, 2016 13:33:04.496 [7048] ERROR - 'P:\videos\TV\Project Runway\Season 15' was not inside any known section location, skipping.
saitoh183
Posts: 112
Joined: 02 Oct 2012, 16:59

Re: AMC - rescan PLEX library section

Post by saitoh183 »

Is there a way to pass a variable to the cmd file? I ask because depending on the media being processes the library scan i call needs to point to the proper library section (ie plex library TV shows is section 3, Movies is section 6) i tried something like :

Code: Select all

filebot -script  fn:amc --def seriesFormat=@P:/scripts/test.groovy --filter "age < 7" --action test -non-strict $FolderPath --log-file P:/scripts/Filebot.log --def clean=y -no-xattr --conflict auto --def ut_label=Series --def exec=@P:/scripts/test.cmd "$plexsection"
and

Code: Select all

filebot -script  fn:amc --def seriesFormat=@P:/scripts/test.groovy --filter "age < 7" --action test -non-strict $FolderPath --log-file P:/scripts/Filebot.log --def clean=y -no-xattr --conflict auto --def ut_label=Series --def exec=@P:/scripts/test.cmd $plexsection
Where $plexsection = 4
Log:

Code: Select all

Locking P:\scripts\Filebot.log
Run script [fn:amc] at [Fri Oct 14 13:44:55 EDT 2016]
Parameter: seriesFormat = P:/videos/TV/{n}/{'Season '+s}/{n} - {sxe} - {t}
Parameter: clean = y
Parameter: ut_label = Series
Parameter: exec = ""C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section %1 --directory "{folder}""
Argument: P:\Processing\sonarr_tv
Argument: C:\Windows\System32\WindowsPowerShell\v1.0\4
filebot : File not found: C:\Windows\System32\WindowsPowerShell\v1.0\4
Also in the test.cmd i made this change, but not sure if this is what needs to be done in order to get the variable to show up

Code: Select all

""C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section %1 --directory "{folder}""
If it cant be done, then i will need to find a way to run it directly from --exec
Post Reply