jellyfin / jellyfin-plugin-reports

Reports Plugin for Jellyfin
https://jellyfin.org
MIT License
30 stars 19 forks source link

CSV delimiter character in Reports #29

Open mclandytm opened 4 years ago

mclandytm commented 4 years ago

It appears that the semicolon character (";") is hard-coded as the value delimiter for exported CSV files. However, some values may (and do) contain semicolons as part of their text - for example, the "Genres" value in Movies can contain multiple values, separated by semicolons. In that case, when you try to import the resulting CSV file, all the subsequent columns are all thrown off.

I'd suggest either using a less-common character for the separator (something that's almost certainly not going to show up in a database value), or more preferably, make the separator character a configurable option, which would give users the ability to work around just about any character conflict. Thanks.

crobibero commented 4 years ago

Ideally we would switch to using an actual CSV writing library such as https://joshclose.github.io/CsvHelper/

RealOrangeOne commented 4 years ago

Using a library here is definitely the best way to do it, and reduces maintenance overhead.

A quick solution I found was to export as Excel, open it, and export from there as a CSV, that worked perfectly, mostly because it didn't use semicolons as delimiters, but also likely because it'd escape values.

Had a quick hunt around the codebase for where something could drop in, but couldn't find something obvious, and my C# knowledge is far rustier than I thought.