Created
January 8, 2016 12:03
-
-
Save XPlantefeve/e8fafd6b8d1163ebff27 to your computer and use it in GitHub Desktop.
New-Cue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .Synopsis | |
| Short description | |
| .DESCRIPTION | |
| Long description | |
| .EXAMPLE | |
| Example of how to use this cmdlet | |
| .EXAMPLE | |
| Another example of how to use this cmdlet | |
| #> | |
| function New-Cue | |
| { | |
| [CmdletBinding()] | |
| [OutputType([int])] | |
| Param | |
| ( | |
| # Param1 help description | |
| [Parameter(Mandatory=$true, | |
| ValueFromPipelineByPropertyName=$true, | |
| Position=0)] | |
| [string[]]$ChapterFile, | |
| [string]$Genre, | |
| [string]$Date, | |
| [string]$Performer, | |
| [string]$Title, | |
| [string]$AudioFile, | |
| [string]$Format | |
| ) | |
| Begin | |
| { | |
| if ($Format -and ! $AudioFile) { $AudioFile = "$((gi $ChapterFile).BaseName).$Format" } | |
| if ($AudioFile -and ! $Format) { $Format = (gi $AudioFile).Extension } | |
| } | |
| Process | |
| { | |
| foreach ( $file in $ChapterFile ) { | |
| "REM GENRE ""$Genre""" | |
| "REM DATE ""$Date""" | |
| "PERFORMER ""$Performer""" | |
| "TITLE ""$Title""" | |
| "FILE ""$AudioFile"" $($Format.ToUpper())" | |
| foreach ( $line in (gc $file) ) { | |
| if ( $line -match 'CHAPTER([0-9]*)=(.*)' ) { | |
| " TRACK $($matches[1]) AUDIO" | |
| " TITLE """"" | |
| " PERFORMER ""$Performer""" | |
| " INDEX $($matches[1]) $($matches[2])" | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment