2 Questions: Multiple CSV columns, and filename length limit

Support for Windows users
Post Reply
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

2 Questions: Multiple CSV columns, and filename length limit

Post by DevXen »

1. I had a question about matching data in CSV files. and they work great: ItemToMatch;ReturnedResult.
but can i add other columns. - not necessarily for a practical purpose. I'm just going to switch my matches from movie name to the IMDBID - but since those aren't very informative. i also wanted to put the movie name in the csv file on that row as well. but i'm not sure if it'll cause issues with FileBot.

2. is there anyway at least for the windows 10 version of Filebot to enable (longer) filenames. - I read that the filename limitations are mostly built into programs. but with windows 10 the limit is 32,767 characters. here I found this online: In the past the maximum supported file length was 260 characters (256 usable after the drive characters and termination character). In Windows 10 long file name support can be enabled which allows file names up to 32,767 characters (although you lose a few characters for mandatory characters that are part of the name).

some of my filenames get pretty long. and it won't rename them if they are past the previous 256 character length limit so then i have to go in and cut down the folder names until it gets past that limit. its a pain with hundreds of files. haha. Also you have to enable that long file names in the registry. i'll just post the link to the page on how to enable it. but if we could get filebot to support that as windows now does. and i'm guessing linux always did. that would be great.

https://www.itprotoday.com/windows-10/e ... windows-10
thanks,
-Dev
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Questions: Multiple CSV columns, and filename length limit

Post by rednoah »

1.
You can always take "ReturnedResult" and then further split that by some arbitrary separator. It's your code.

e.g.

Code: Select all

123;ABC # this is a test

Code: Select all

csv(...)[id].before('#')


2.
FileBot enforces a 256 character limit per folder name / file name (as opposed to the entire file path as a whole) by default, so that you don't end up with files that can't be managed or deleted via Windows Explorer. FileBot itself doesn't care and is happy to use arbitrary file paths as input or output, and then bubble up the error from the file system if something doesn't work. You can use -unixfs to disable all sanity checks and file path validations.

Notably, file paths (as opposed to folder names and file names) longer than 256 characters are not an issue for Windows Explorer as long as each file path component is less than 256 characters. FileBot itself has no such limitations and so file paths are only bound by the underlying file system.
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: 2 Questions: Multiple CSV columns, and filename length limit

Post by DevXen »

awesome. thanks. i just want a record of what each line in my csv file is. without it affecting filebot. i'll try the -unixfs to see if that helps with my long filenames.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Questions: Multiple CSV columns, and filename length limit

Post by rednoah »

You can use lines(...) to just read all the lines from your text file, and then have you custom code interpret your line format.
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: 2 Questions: Multiple CSV columns, and filename length limit

Post by DevXen »

Oh I'm not worried about that. I just need it to match the first column, and return the second column. Like it already does. And just ignore the 3rd column or maybe if column one doesn't match it can try to match column 3 and still return column 2. I.e.

Code: Select all

tt74964;/Movies/Based On/Comics;Iron Man [2008] 
My current script matches the name/year then returns the path to where to save it.

But I'm working on changing it to match the IMDb ID. Then it'll still return the path. But since the IMDb ID isn't informative I'd like it to show what movie that's for. This the reason for the 3rd column that should just be ignored by filebot. Cause it's just for information purposes.

But just now I was thinking if on the lookup in the csv file there is no match for the IMDb ID. It wouldn't be a bad idea to then have it search the title and year and return the path that way as needed. I dunno that's just a thought at the moment.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: 2 Questions: Multiple CSV columns, and filename length limit

Post by rednoah »

csv(...) will split the line into a key/value pair on the first separator, and everything past the first separator will be interpreted as the value.

i.e. your sample csv line would be interpreted like so:

Code: Select all

def map = ['tt74964' : '/Movies/Based On/Comics;Iron Man [2008]']
and you would then write your own code to further parse the value part as needed:

Code: Select all

def value = map['tt74964'].tokenize(';')[0]


Alternatively, you could also do something like this:

Code: Select all

# Iron Man [2008] 
tt74964	/Movies/Based On/Comics
:idea: # has no special meaning. csv(...) simply ignores lines that don't contain any field separator.
:idea: Please read the FAQ and How to Request Help.
Post Reply