mirror of
https://github.com/Radarr/Radarr
synced 2024-12-22 07:52:34 +00:00
Updated Custom Post Processing Scripts (markdown)
parent
9b2ce19146
commit
5b3fb6d58a
1 changed files with 34 additions and 10 deletions
|
@ -54,26 +54,50 @@ The information from Radarr will not be added to $_ENV as one might expect but s
|
|||
#### PowerShell ####
|
||||
Sample script using the Radarr environment variables to create EDL files for all episodes is [here](https://gist.github.com/RedsGT/e1b5f28e7b5b81e1e45378151e73ba5c).
|
||||
|
||||
Sample script to have Plex scan destination folder only (not the entire library)
|
||||
Sample script to have Plex scan destination folder only and "analyze deeply" the file. PSQLite needed to query the plex DB. Adjust folder locations to match your setup.
|
||||
```
|
||||
# Custom Script path: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe\PowerShell.exe
|
||||
# Custom Script arguments: -ExecutionPolicy Bypass "C:\Users\Down\Desktop\Server\radarrcustom.ps1"
|
||||
# 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"
|
||||
|
||||
Set-ExecutionPolicy Unrestricted
|
||||
#set log file location
|
||||
$logfile = "C:\Users\Server\Desktop\radarrimport.txt"
|
||||
|
||||
#Set-ExecutionPolicy Unrestricted
|
||||
$movie_path = $env:radarr_movie_path
|
||||
|
||||
#set your plex library ID
|
||||
$libraryid = 0
|
||||
|
||||
#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 }
|
||||
|
||||
#set location of the plex scanner executable
|
||||
$exe = "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe"
|
||||
&$exe --scan --refresh --section $libraryid --directory $movie_path
|
||||
#Scan the movie folder
|
||||
& "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --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
|
||||
|
||||
#set location of log file
|
||||
write-output $movie_path | add-content C:\Users\Server\Desktop\radarrimport.txt
|
||||
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
|
||||
$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'"
|
||||
$itemid = Invoke-SqliteQuery -Query $query -DataSource $database
|
||||
$itemid = $itemid.metadata_item_id
|
||||
|
||||
#Analyze the ItemID
|
||||
& "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --analyze --item $itemid
|
||||
write-output "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe --analyze --item $itemid" | add-content $logfile
|
||||
|
||||
sleep 20
|
||||
|
||||
#Analyze deeply the item ID
|
||||
& "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe" --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 $movie_path $likemoviepath $itemid.metadata_item_id | add-content $logfile
|
||||
```
|
||||
#### Reverse Symlinking ####
|
||||
When using private trackers, it is imperitive to continue seeding. By using this script `on Download` and `on Upgrade` moves the media to your root movie folder as set in Radarr, and will create a symlink in the original download location so you can continue to seed.
|
||||
|
|
Loading…
Reference in a new issue