iNTERNAL in filename causing issues with rename.

Any questions? Need some help?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: iNTERNAL in filename causing issues with rename.

Post by rednoah »

Based on what we know, FileBot works just fine in every scenario I can test, but doesn't work in your specific setup with python calling FileBot.

We know what works, and we know what doesn't, so now it's just painstakingly and methodically trying different things to find out what exactly is different in each scenario.

We already tried calling filebot -rename from python, and that works, so it's something specific to your amc call. The next step would be to make that exact same amc call in CMD instead of from python, and maybe that way you can reproduce it, or find a workaround.

My feeling is that the solution is something specific to your use case, and won't result in any changes to FileBot that would be beneficial to other users, so I won't be able to spend too much time on this.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: iNTERNAL in filename causing issues with rename.

Post by ZeroByDivide »

I'm honestly thinking it's either filebot or windows OS in general or something as even using something as simple as the default utorrent-postprocess.pyw https://raw.githubusercontent.com/fileb ... rocess.pyw script just changing the

Code: Select all

seriesFormat = '''{plex}'''
to include

Code: Select all

{vf} {vc} {ac} {af}
it throws the same problem of not including them in the rename at all.

Though I think I made some kind of breakthrough on this. Now let me explain how things seem to be going down and this is with just testing the default python script with the small change I mentioned above.

Whenever filebot gets called and starts to extract it seems to put the .mkv several folders deep
example:

Code: Select all

C:\Users\JourneyOver\Desktop\QBT\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS.mkv
Now notice the above path, The .mkv is at least 2 folders deep from the main "The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS" folder.

Now when I was testing using

Code: Select all

filebot -extract C:\Users\JourneyOver\Desktop\QBT\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS\the.big.bang.theory.s11e17.proper.720p.hdtv.x264-killers.rar -rename C:\Users\JourneyOver\Desktop\QBT\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS --db TheTVDB --action TEST --format "{vf} {vc} {ac} {af}"
instead it doesn't seem to be extracting it several folders deep like before
example:

Code: Select all

C:\Users\JourneyOver\Desktop\QBT\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS\the.big.bang.theory.s11e17.proper.720p.hdtv.x264-killers\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS.mkv
this time the .mkv is only one folder deeper than the main "The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS" folder.

So my current theory and I will explain below on why I think it's my current theory is that something in the AMC script is extracting the file several folders deeper than it needs to be even though there are literally no subfolders in the zipped/rared files and making the filepath to long for it to read the file correctly..

because if I take the .mkv file from the first example and move it so its got one less folder like the filepath in the second example then everything works splendidly and actually includes the "{vf} {vc} {ac} {af}" stuff in the rename process when calling from the python script.
Same deal with if I delete the extra word from the folders making the path look like

Code: Select all

C:\Users\JourneyOver\Desktop\QBT\The.Big.Bang.Theory.S11E17.720p.HDTV.x264-KILLERS\the.big.bang.theory.s11e17.720p.hdtv.x264-killers\The.Big.Bang.Theory.S11E17.720p.HDTV.x264-KILLERS\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS.mkv
Edit: and it's the same reason why when I was testing the python script only having

Code: Select all

command = [
'filebot',
'-extract',
'C:/Users/JourneyOver/Desktop/QBT/The.Big.Bang.Theory.S11E17.iNTERNAL.720p.WEB.x264-BAMBOOZLE/the.big.bang.theory.s11e17.internal.720p.web.x264-bamboozle.rar',
'-rename',
'C:/Users/JourneyOver/Desktop/QBT/The.Big.Bang.Theory.S11E17.iNTERNAL.720p.WEB.x264-BAMBOOZLE/the.big.bang.theory.s11e17.internal.720p.web.x264-bamboozle',
'--db', 'TheTVDB',
'--action', 'test',
'--format', '{vf} {vc} {ac} {af}'
]

# execute command (and hide cmd window)
subprocess.run(command)
it would work as well, because again it was only extracting the file one folder deep unlike when using the AMC script.

Edit2: Yep just tested a bit more and AMC script is creating extra subfolders that it doesn't need to create for some unknown reason..

putting the .rar files in just the path

Code: Select all

C:\Users\JourneyOver\Desktop\QBT
makes filebot create on extracting the rar files through using the AMC script a file path that ends up looking like

Code: Select all

C:\Users\JourneyOver\Desktop\QBT\the.big.bang.theory.s11e17.proper.720p.hdtv.x264-killers\QBT\The.Big.Bang.Theory.S11E17.PROPER.720p.HDTV.x264-KILLERS.mkv
this is with using

Code: Select all

# Run Program:
# "C:\path\to\utorrent-postprocess.pyw" "%L" "%S" "%N" "%K" "%F" "%D"
#
# Test with Console:
# python "C:\path\to\utorrent-postprocess.pyw" "Movie" "5" "Avatar" "multi" "" "X:\Files\Avatar"


import sys
import subprocess


# configuration
output = 'D:/Media'


# custom formats (use / instead of \ as directory separator)
movieFormat  = '''{plex}'''
seriesFormat = '''{n} - {s00e00} - {t} {vf} {vc} {ac} {af}'''
animeFormat  = '''{plex}'''
musicFormat  = '''{plex}'''


# required args
label, state, title, kind, file, directory = sys.argv[1:7]


command = [
	'filebot', '-script', 'fn:amc',
	'--output', output,
	'--action', 'test',
	'--conflict', 'skip',
	'-non-strict',
	'--log-file', output + '/amc.log',
	'--def',
		'unsorted=y',
		'music=y',
		'artwork=y',
		'movieFormat='  + movieFormat,
		'seriesFormat=' + seriesFormat,
		'animeFormat='  + animeFormat,
		'musicFormat='  + musicFormat,
		'ut_label=' + label,
		'ut_state=' + state,
		'ut_title=' + title,
		'ut_kind='  + kind,
		'ut_file='  + file,
		'ut_dir='   + directory
]


# execute command only for certain conditions (disabled by default)
'''
if state not in ['5', '11']:
	print('Illegal state: %s' % state)
	sys.exit(0)
'''


# execute command (and hide cmd window)
subprocess.run(command)
and the command being

Code: Select all

"C:\Users\JourneyOver\Dropbox\Public\Folders\Filebot\Filebot_Wrapper_Test.py" "" "" "The.Big.Bang.Theory.S11E17.720p.HDTV.x264-KILLERS" "multi" "" "C:\Users\JourneyOver\Desktop\QBT"
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: filepath being to long causing issues with rename

Post by ZeroByDivide »

So I guess we can now call this filepath being to long causing issues with rename instead of just "iNTERNAL in filename causing issues with rename."
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: iNTERNAL in filename causing issues with rename.

Post by rednoah »

Fortunately I already had code in place for cases where MediaInfo native code can't open files, so the next release will include a fix for this.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: iNTERNAL in filename causing issues with rename.

Post by ZeroByDivide »

rednoah wrote: 10 Mar 2018, 16:48 Fortunately I already had code in place for cases where MediaInfo native code can't open files, so the next release will include a fix for this.
Great :D is there an ETA on when the next release will possibly be?
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: iNTERNAL in filename causing issues with rename.

Post by rednoah »

Sorry, no ETA. Since nobody has reported this issue that should have been effecting everyone for the last 10 years, it's probably not a priority. There'll definitely be a new release a fews months down the line. :lol:

:arrow: Maybe earlier if the Linux folks chip in: https://www.patreon.com/filebot
:idea: Please read the FAQ and How to Request Help.
Post Reply