filebot-watcher docker - Problem renaming Series - source file also moved to the destination folder

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
synack
Posts: 3
Joined: 14 Mar 2021, 11:34

filebot-watcher docker - Problem renaming Series - source file also moved to the destination folder

Post by synack »

Hello

I have recently moved from filebot on DSM7.2 to filebot-watcher using docker-compose.
I'm using one container to watch movies, this is working without any problem.
Similarly, I'm using another container for Series, and here i'm facing following problem: when the file is being downloaded with torrent client, it is placed on the watch directory (atomic move), and detected with INOTIFY. amc script is executed, the file is being renamed and moved (hardlink) to the Series Library as per the rules defined on the snippet, but i am also getting another hardlink copy of the source/dowloaded file in target destination, which is not expected:

Code: Select all

drwxr-xr-x 1 xxxx users         18 Apr 29 01:01 'WandaVision (2021)'/
-rw-r--r-- 2 xxxx users 1180934286 Apr 29 01:00  WandaVision.S01E01.2021.MULTI.1080p.WEBRip.x264.AC3-SUNNY.mkv
[xxx@xxxx: /volume1/videos/SeriesLibrary/Series]$ pwd
/volume1/videos/SeriesLibrary/Series
using this docker-compose:

Code: Select all

  filebot-tvseries:
    container_name: watcher-tvseries
    image: rednoah/filebot:watcher
    networks: 
      - synobridge
    restart: unless-stopped
    environment:
      - PUID=1035
      - PGID=100
      - UMASK=022
      - INOTIFYWAIT_OPTS=--recursive
      - SETTLE_DOWN_TIME=15
    volumes:
      - /volume1:/volume1
      - /volume1/docker/filebot/:/config
      - /volume1/docker/filebot/watcher-tvseries:/data
    command: /volume1/videos/MoviesLibrary/_Downloads/_Watch/TV-Series --action duplicate --lang en --def clean=y --conflict skip -non-strict --log all --log-file /config/filebot.log --def excludeList=/config/.excludes --def artwork=n --def seriesDB=TheMovieDB::TV --output /volume1/videos/SeriesLibrary/ --def seriesFormat=@/config/filebot/filebotS --def "exec=chmod 755 -Rf '{folder}/'" --def "exec=sh /config/tmm-scripts/TV-series"
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
and these filebot logs

Code: Select all

Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
[INOTIFY] /volume1/videos/MoviesLibrary/_Downloads/_Watch/TV-Series/WandaVision.S01E01.2021.MULTI.1080p.WEBRip.x264.AC3-SUNNY.mkv
[2024/04/28 23:00:51 UTC] Waiting 15 seconds for changes to settle down...
Run script [fn:amc] at [Sun Apr 28 23:01:12 GMT 2024]
[PSA] Important Discussion of Changes effective as of 28 Apr 2023:
https://www.filebot.net/forums/viewtopic.php?t=13406
Parameter: excludeList = /config/.excludes
Parameter: unsorted = y
Parameter: music = y
Parameter: artwork = n
Parameter: clean = y
Parameter: seriesDB = TheMovieDB::TV
Parameter: seriesFormat = /volume1/videos/SeriesLibrary/Series/{n.upperInitial()} ({y})/{episode.special ? 'Specials' : 'Saison '+s.pad(2)}/{n.upperInitial().space('.')}.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{t.upperInitial().space('.')}.
{
	allOf
		{if (hd == "UHD") { hd = "UHD" } else if (hd== "FHD") { hd = "FHD" }}
		{ vs }
		{ vf }
		{if (vc == "AVC") { vc = "H264" } else if (vc == "HEVC") { vc = "H265" } else { vc +"." }}
		{ any{ hdr.space('') }{ 'SDR' } }
	.join(".").space('.')
}
.{bitdepth}bits.
{
	def preferredLang = 'Eng'
	def useChFilter = false
	def filter = { [it.codec, it.ch] }
	def codecList =
	[
	'MP3' : 'MP3',
	'PCM' : 'PCM',
	'AAC LC' : 'AAC',
	'AAC LC SBR' : 'AAC',
	'AAC LC SBR PS' : 'AAC',
	'AC 3' : 'AC3',
	'AC 3 Dep' : 'EAC3',
	'E AC 3' : 'EAC3',
	'E AC 3 JOC' : 'EAC3 Atmos',
	'AC 3 Dep JOC' : 'EAC3 Atmos',
	'DTS' : 'DTS',
	'DTS 96 24' : 'DTS 96-24',
	'DTS ES' : 'DTS-ES',
	'DTS ES XXCH' : 'DTS-ES',
	'DTS XBR' : 'DTS-HD HRA',
	'DTS ES XBR' : 'DTS-HD HRA',
	'DTS ES XXCH XBR' : 'DTS-HD HRA',
	'DTS XLL' : 'DTS-HD MA',
	'DTS ES XLL' : 'DTS-HD MA',
	'DTS ES XXCH XLL' : 'DTS-HD MA',
	'DTS XLL X' : 'DTS-X',
	'MLP FBA' : 'TrueHD',
	'MLP FBA 16 ch' : 'TrueHD Atmos'
	]
	def audioStreams = []
	def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') }
	def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6.0/,'5.1').replaceAll(/8.0/,'7.1') }
	def oneStream = { it.collect{ filter(it) }*.minus(null).unique().flatten().join(' ') }
	def dString = { it.toDouble().toString() }
	def toInt = { it.toInteger() }
	any{audio.collect{ au ->
		def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] })
		def format_profile = any{ audioClean(au['Format_AdditionalFeatures'])}{}
		def String ch = any{ channelClean(au.ChannelPositionsString2).tokenize('\\/')*.toDouble().toString().sum() }
			{ channelClean(dString(au.ChannelsOriginal)) } { channelClean(dString(au.Channels)) }
		def chFilter =	( ( ( (ac == 'AAC'||ac == 'MP3') && ch != '2.0') || ( (ac == 'AC3'||ac == 'EAC3'||ac == 'DTS'||ac == 'TrueHD'||ac == 'MLPFBA') && ch != '5.1' ) ) ? ch : null )
		def combined = allOf{codec}{format_profile}.join(' ')
		audioStreams << ['index' : codecList.findIndexOf { it.key == combined }, 'default' : any {au['default'][0].toBoolean() }{ audio.size == 1 ? true : '' },
		'codec' : codecList.get(combined, 'Add to "' + combined + '" codecList'), 'combined' : combined, 'ch' : useChFilter ? chFilter : ch,
		'bitrate' : any{ toInt(au.BitRate) }{ toInt(au.BitRate_Maximum) }{ dString(au.FrameRate) }{null},
		'objects' : any{ '[' + au['NumberOfDynamicObjects'] + ' Objs]' }{null}, 'lang' : any{ au.'LanguageString3'.upperInitial() }{null} ]
		return audioStreams
	}
	def addToList = audioStreams.codec.findAll{ it.contains('Add to') }.unique().sort()
	def allStreams = audioStreams.collect{ filter(it) }*.minus(null).unique()*.join(' ')
	def preferredStream = oneStream(audioStreams.findAll{ it.index == audioStreams.index.max() })
	def bestBitRate = oneStream(audioStreams.findAll{ it.bitrate == audioStreams.bitrate.max() })
	def defaultStream = oneStream(audioStreams.findAll{ it.default == true })
	def bestPreferredLang = any{ audioStreams.findAll{ it.lang == preferredLang }.sort{ a, b -> b.bitrate <=> a.bitrate }.collect{ filter(it) }*.minus(null).unique().get(0).join(' ') }{}
	
	bestBitRate.space('.')
	
	}{'NO_AUDIO'}
}
Parameter: exec = sh /config/tmm-scripts/TV-series
Argument[0]: /volume1/videos/MoviesLibrary/_Downloads/_Watch/TV-Series
Use excludes: /config/.excludes (6)
Ignore system path: /volume1/videos/MoviesLibrary/_Downloads/_Watch/TV-Series/Terminal.S01E03.FRENCH.SDR.2160p.WEB.H265-FW/@eaDir
Input: /volume1/videos/MoviesLibrary/_Downloads/_Watch/TV-Series/WandaVision.S01E01.2021.MULTI.1080p.WEBRip.x264.AC3-SUNNY.mkv
Group files by movie or series
Group: {Series=WandaVision (2021)} => [WandaVision.S01E01.2021.MULTI.1080p.WEBRip.x264.AC3-SUNNY.mkv]
Rename episodes using [TheMovieDB] with [Airdate Order]
Lookup via [WandaVision] [WandaVision]
Fetching episode data for [WandaVision]
* WandaVision [85271] | 9 episodes | 1x01-09
[DUPLICATE] from [/volume1/videos/MoviesLibrary/_Downloads/_Watch/TV-Series/WandaVision.S01E01.2021.MULTI.1080p.WEBRip.x264.AC3-SUNNY.mkv] to [/volume1/videos/SeriesLibrary/Series/WandaVision (2021)/Saison 01/WandaVision.S01E01.Filmed.Before.A.Live.Studio.Audience.FHD.WEB-DL.1080p.H264.SDR.8bits.AC3.2.0.mkv]
Processed 1 file
Execute: sh /config/tmm-scripts/TV-series
Done ヾ(@⌒ー⌒@)ノ
any idea why i'm getting the source file being moved as well on the target folder?
User avatar
rednoah
The Source
Posts: 23054
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: filebot-watcher docker - Problem renaming Series - source file also moved to the destination folder

Post by rednoah »

filebot processed only 1 file according to the log:

Code: Select all

[DUPLICATE] from [/volume1/videos/MoviesLibrary/_Downloads/_Watch/TV-Series/WandaVision.S01E01.2021.MULTI.1080p.WEBRip.x264.AC3-SUNNY.mkv] to [/volume1/videos/SeriesLibrary/Series/WandaVision (2021)/Saison 01/WandaVision.S01E01.Filmed.Before.A.Live.Studio.Audience.FHD.WEB-DL.1080p.H264.SDR.8bits.AC3.2.0.mkv]
If some other file is created somewhere, then it wasn't this filebot call according to the log. Note that the ls output above only shows one file at the target destination, so that matches the log. What is the file path of the other hardlink that was created unexpectedly?




:!: On an unrelated note. You pass --def exec twice on the command-line. Keep in mind that the you can only pass one --def key=value per key:

Code: Select all

Parameter: exec = sh /config/tmm-scripts/TV-series



EDIT:

I see now. This is the unexpected file:

Code: Select all

-rw-r--r-- 2 xxxx users 1180934286 Apr 29 01:00  WandaVision.S01E01.2021.MULTI.1080p.WEBRip.x264.AC3-SUNNY.mkv

Code: Select all

/volume1/videos/SeriesLibrary/Series
The interesting bit here is the link count of 2. The file ended up at 3 locations (original, target, unexpected extra) and should thus not have a link count of 3? That might be a clue.
:idea: Please read the FAQ and How to Request Help.
synack
Posts: 3
Joined: 14 Mar 2021, 11:34

Re: filebot-watcher docker - Problem renaming Series - source file also moved to the destination folder

Post by synack »

Hi Rednoah

Indeed this was not created by Filebot ; i could find what the problem was, my old script running at torrent completion was creating this unexpected extra hardlink (i forgot to remove it..). All good now.

thanks as well for the warning on --def key, i will fix this.
Post Reply