initial commit
This commit is contained in:
commit
1041495f6a
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2024 Octopus "Oct2pus" Octopus
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/env fish
|
||||||
|
|
||||||
|
# Requires opus-tools, golf (included in gist)
|
||||||
|
set SOURCE_DIR $argv[1]
|
||||||
|
set OUTPUT_DIR $argv[2]
|
||||||
|
set SOURCE_TREE (gold $SOURCE_DIR)
|
||||||
|
|
||||||
|
# incase I want to make any changes to the encoding.
|
||||||
|
function _encode
|
||||||
|
opusenc $argv[1] $argv[2]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create source tree structure
|
||||||
|
for folder in $SOURCE_TREE
|
||||||
|
mkdir -p $OUTPUT_DIR/$folder
|
||||||
|
set list (golf $SOURCE_DIR/$folder)
|
||||||
|
for i in $list
|
||||||
|
if test (string match -r "\.flac" $i)
|
||||||
|
set o (string replace ".flac" ".opus" $i)
|
||||||
|
if test ! -e $OUTPUT_DIR/$folder/$o
|
||||||
|
_encode $SOURCE_DIR/$folder/$i $OUTPUT_DIR/$folder/$o
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if test ! -e $OUTPUT_DIR/$folder/$i
|
||||||
|
cp $SOURCE_DIR/$folder/$i $OUTPUT_DIR/$folder/$i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module git.jade.moe/oct2pus/flac2opus/gold
|
||||||
|
|
||||||
|
go 1.19
|
|
@ -0,0 +1,27 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var files []fs.DirEntry
|
||||||
|
var err error
|
||||||
|
if len(os.Args) > 1 {
|
||||||
|
files, err = os.ReadDir(os.Args[1])
|
||||||
|
} else {
|
||||||
|
files, err = os.ReadDir(".")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
for _, file := range files {
|
||||||
|
if file.IsDir() && !strings.HasPrefix(file.Name(), ".") {
|
||||||
|
fmt.Println(file.Name())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module git.jade.moe/oct2pus/flac2opus/golf
|
||||||
|
|
||||||
|
go 1.19
|
|
@ -0,0 +1,27 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var files []fs.DirEntry
|
||||||
|
var err error
|
||||||
|
if len(os.Args) > 1 {
|
||||||
|
files, err = os.ReadDir(os.Args[1])
|
||||||
|
} else {
|
||||||
|
files, err = os.ReadDir(".")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
for _, file := range files {
|
||||||
|
if !file.IsDir() && !strings.HasPrefix(file.Name(), ".") {
|
||||||
|
fmt.Println(file.Name())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Flac2Opus
|
||||||
|
|
||||||
|
script to batch convert .flac files to .opus files
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
`./convert.fish sourcedir destdir`
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
You need golang & opus-tools (for opusenc). you can likely substitute it with ffmpeg if you would like to modify the script, though.
|
||||||
|
|
||||||
|
golf (*GO* *L*ist *F*iles) and gold (*GO* *L*ist *D*irectories) are expected to be in your $PATH.
|
||||||
|
|
||||||
|
## LICENSE
|
||||||
|
|
||||||
|
MIT
|
Loading…
Reference in New Issue