Skip to content

Instantly share code, notes, and snippets.


RedsGT/Create_EDL.ps1 Secret

Last active Nov 14, 2020
What would you like to do?
#Use tags to only trigger this script on single series
$EpisodeFile_Path = $env:sonarr_episodefile_path
$Series_Path = $env:sonarr_series_path
$eventtype = $env:sonarr_eventtype
Set-Location -Path $Series_Path
$edl_template = "0 120 0`r`n1350 2000 0"
#Only need to create EDL for single file
If ($eventtype -eq "Download") {
$file = Get-ChildItem -Path $EpisodeFile_Path
#Create new EDL file
Add-Content -Path (($file.BaseName) + ".edl") -Value $edl_template
#Need to create an EDL file for all videos since Rename doesn't return filenames
Elseif ($eventtype -eq "Rename") {
#Get old EDL file list
$old_edl_file_list = Get-ChildItem -Path .\*.* -Include *.edl
#Remove old EDL files
foreach ($old_edl_file in $old_edl_file_list)
remove-item $old_edl_file
Use nfo files to get a single filename list since you should always
have one for Kodi metadata and the file extension won't change like
for different video codecs.
$file_list = Get-ChildItem -Path .\*.* -Include *.nfo
#Create new EDL files
foreach ($file in $file_list)
$edl_file_name = ($file.BaseName) + ".edl"
Add-Content -Path $edl_file_name -Value $edl_template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment