1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* integrate music processing with utorrent-postprocess

This commit is contained in:
Reinhard Pointner 2013-01-10 19:30:16 +00:00
parent e318db8b56
commit 0171f31b09
3 changed files with 16 additions and 4 deletions

View File

@ -530,6 +530,7 @@ FiCODVDR
FiddleGoose
FiHTV
FilmHD
Filmikz
FiNaLe
FiTTY
FiXi0N

View File

@ -15,7 +15,7 @@ args.getFiles{ accept(it) }.each{
// override files only when --conflict override is set
if (!it.equals(nfile)) {
if (nfile.exists() && _args.conflict == 'override' && action != StandardRenameAction.TEST) {
nfile.delete(); // resolve conflict
nfile.delete() // resolve conflict
}
if (!nfile.exists()) {

View File

@ -30,7 +30,8 @@ def gmail = tryQuietly{ gmail.split(':', 2) }
def format = [
tvs: tryQuietly{ seriesFormat } ?: '''TV Shows/{n}/{episode.special ? "Special" : "Season "+s}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t}''',
anime: tryQuietly{ animeFormat } ?: '''Anime/{n}/{n} - {sxe} - {t}''',
mov: tryQuietly{ movieFormat } ?: '''Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}'''
mov: tryQuietly{ movieFormat } ?: '''Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}''',
music: tryQuietly{ musicFormat } ?: '''Music/{n}/{album}/{n} - {t}'''
]
@ -78,13 +79,13 @@ if (args.empty) {
input = input.flatten()
// extract archives (zip, rar, etc) that contain at least one video file
input += extract(file: input.findAll{ it.isArchive() }, output: null, conflict: 'override', filter: { it.isVideo() }, forceExtractAll: true)
input += extract(file: input.findAll{ it.isArchive() }, output: null, conflict: 'override', filter: { it.isVideo() || it.isAudio() }, forceExtractAll: true)
// sanitize input
input = input.findAll{ it?.exists() }.collect{ it.canonicalFile }.unique()
// process only media files
input = input.findAll{ it.isVideo() || it.isSubtitle() || it.isDisk() }
input = input.findAll{ it.isVideo() || it.isSubtitle() || it.isDisk() || it.isAudio() }
// ignore clutter files
input = input.findAll{ !(it.path =~ /\b(?i:sample|trailer|extras|deleted.scenes|music.video|scrapbook|behind.the.scenes)\b/) }
@ -100,6 +101,8 @@ def groups = input.groupBy{ f ->
// skip auto-detection if possible
if (forceIgnore(f))
return []
if (f.isAudio()) // PROCESS MUSIC FOLDER BY FOLDER
return [music: f.dir.name]
if (forceMovie(f))
return [mov: detectMovie(f, false)]
if (forceSeries(f))
@ -185,6 +188,14 @@ groups.each{ group, files ->
throw new Exception("Failed to rename movie: $group.mov")
}
}
// MUSIC MODE
if (group.music) {
def dest = rename(file:files, format:format.music, db:'AcoustID')
if (dest == null && failOnError) {
throw new Exception("Failed to rename music: $group.music")
}
}
}
// skip notifications if nothing was renamed anyway