mirror of
https://github.com/Radarr/Radarr.git
synced 2024-06-28 00:44:48 +02:00
Updated Custom Post Processing Scripts (markdown)
parent
5b3fb6d58a
commit
81afe96d4f
|
@ -58,44 +58,40 @@ Sample script to have Plex scan destination folder only and "analyze deeply" the
|
||||||
```
|
```
|
||||||
# This script will add the movie to plex and scan the destination folder (it will not scan the entire library)
|
# This script will add the movie to plex and scan the destination folder (it will not scan the entire library)
|
||||||
# C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe\PowerShell.exe -ExecutionPolicy Bypass "C:\Users\Server\Desktop\radarrcustom.ps1"
|
# C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe\PowerShell.exe -ExecutionPolicy Bypass "C:\Users\Server\Desktop\radarrcustom.ps1"
|
||||||
|
|
||||||
#set log file location
|
|
||||||
$logfile = "C:\Users\Server\Desktop\radarrimport.txt"
|
|
||||||
|
|
||||||
#Set-ExecutionPolicy Unrestricted
|
|
||||||
$movie_path = $env:radarr_movie_path
|
$movie_path = $env:radarr_movie_path
|
||||||
|
#PSQlite location
|
||||||
|
Import-Module C:\Users\Server\Desktop\scripts\PSSQLite
|
||||||
|
#set file locations
|
||||||
|
$logfile = "C:\Users\Server\Desktop\radarrimport.txt"
|
||||||
|
$database = "C:\Users\Server\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db"
|
||||||
|
$plexscanner = "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe"
|
||||||
#set your plex library ID
|
#set your plex library ID
|
||||||
$libraryid = 0
|
$libraryid = 0
|
||||||
|
|
||||||
#If you have multiple root folders and library IDs you can set them like so
|
#If you have multiple root folders and library IDs you can set them like so
|
||||||
If ($movie_path -like '*Movies Release\*' ) { $libraryid = 19 }
|
#If ($movie_path -like '*Movies Release\*' ) { $libraryid = 19 }
|
||||||
|
|
||||||
|
|
||||||
#Scan the movie folder
|
#Scan the movie folder
|
||||||
& "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --scan --refresh --section $libraryid --directory $movie_path
|
& "$plexscanner" --scan --refresh --section $libraryid --directory $movie_path
|
||||||
write-output "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --scan --refresh --section $libraryid --directory $movie_path" | add-content $logfile
|
write-output """$plexscanner"" --scan --refresh --section $libraryid --directory $movie_path" | add-content $logfile
|
||||||
|
|
||||||
sleep 20
|
sleep 20
|
||||||
|
|
||||||
#PSQlite needed to query the plex db
|
|
||||||
Import-Module C:\Users\Server\Desktop\scripts\PSSQLite
|
|
||||||
|
|
||||||
#Query the plex db for the item ID
|
#Query the plex db for the item ID
|
||||||
$likemoviepath = $movie_path + "%"
|
$likemoviepath = $movie_path + "%"
|
||||||
$database = "C:\Users\Server\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db"
|
|
||||||
$query = "SELECT mi.metadata_item_id FROM media_parts mp LEFT JOIN media_items mi on mp.media_item_id=mi.id WHERE mp.file LIKE '$likemoviepath'"
|
$query = "SELECT mi.metadata_item_id FROM media_parts mp LEFT JOIN media_items mi on mp.media_item_id=mi.id WHERE mp.file LIKE '$likemoviepath'"
|
||||||
$itemid = Invoke-SqliteQuery -Query $query -DataSource $database
|
$itemid = Invoke-SqliteQuery -Query $query -DataSource $database
|
||||||
$itemid = $itemid.metadata_item_id
|
$itemid = $itemid.metadata_item_id
|
||||||
|
|
||||||
#Analyze the ItemID
|
#Analyze the ItemID
|
||||||
& "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --analyze --item $itemid
|
& "$plexscanner" --analyze --item $itemid
|
||||||
write-output "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --analyze --item $itemid" | add-content $logfile
|
write-output """$plexscanner"" --analyze --item $itemid" | add-content $logfile
|
||||||
|
|
||||||
sleep 20
|
sleep 20
|
||||||
|
|
||||||
#Analyze deeply the item ID
|
#Analyze deeply the item ID
|
||||||
& "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --analyze-deeply --item $itemid
|
& "$plexscanner" --analyze-deeply --item $itemid
|
||||||
write-output "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --analyze-deeply --item $itemid" | add-content $logfile
|
write-output """$plexscanner"" --analyze-deeply --item $itemid" | add-content $logfile
|
||||||
|
|
||||||
#write-output $movie_path $likemoviepath $itemid.metadata_item_id | add-content $logfile
|
#write-output $movie_path $likemoviepath $itemid.metadata_item_id | add-content $logfile
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue
Block a user