Scripts for extracting data from nfo
#1
I wanted to share the scripts I wrote recently to extract data from movie and tvshow nfos. If you are a fan of spreadsheets, these scripts extract data from your collection to a text file which you can import into a good ol spreadsheet. You need python3 for executing the script.

For tvshow.nfo
Code:
https://gist.github.com/akyag/ca3649386550d30f81165745fbde9713

and for movie.nfo
Code:
https://gist.github.com/akyag/1205819121757d3eb7ffda062f707bc8

You need to edit the path to your collection. You get output like this for example -
title_rating_premiered_status_studio_genre_tags

Code:
8 Simple Rules_8.5_2002-09-14_Ended_ABC (US)_Comedy_
Arrested Development_9.3_2003-11-02_Ended_Netflix_Comedy_
Banshee_8.8_2013-01-11_Ended_Cinemax_Action, Adventure, Crime, Drama_MZABI, BluRay, x265, 720p
Battlestar Galactica_9.3_2003-12-08_Ended_SciFi_Action, Adventure, Drama, Science Fiction_
Breaking Bad_9.3_2008-01-17_Ended_AMC_Crime, Drama, Suspense, Thriller_Sparrow, BluRay, 720p

title_rating_year_runtime_genre_codec_tags

Code:
Once Upon a Time in the West_7.9_1968_166_Action, Western_Sergio Leone_h264 / AAC_YIFY
The Secret in Their Eyes_7.8_2009_129_Crime, Drama, Mystery, Romance_Juan José Campanella_h264 / AAC_anoXmous
The Silence of the Lambs_7.9_1991_118_Crime, Drama, Thriller_Jonathan Demme_h264 / AAC_YIFY
The Truman Show_7.7_1998_106_Comedy, Drama_Peter Weir_h264 / AAC_YIFY
The Usual Suspects_8.0_1995_106_Drama, Crime, Thriller_Bryan Singer_h264 / AAC_YIFY
WALL·E_7.7_2008_98_Animation, Family_Andrew Stanton_h264 / AAC_KiNGDOM - BRRip

The script took about 14 sec to extract data from 680 movies.
~Web and graphic designer... Linux enthusiast... Python Fan... A Gooner~
[AMD A10-7850K 3.7 Ghz, Radeon R7]
[Fedora 27] | [Kodi - 17.6 / Skin - Grid]

Image
#2
Stupid question: Why not use the export function?

I write CSV files, that can be loaded in Excel, for my movies and shows within a second - without touching my library.


Movie template:

${foreach movies movie}"${movie.title}";"${movie.originalTitle}";"${movie.year}";"${movie.edition}";"${movie.director}";"${foreach movie.actors actor}${if index_actor=1}${actor.name},${end}${if index_actor=2}${actor.name},${end}${if index_actor=3}${actor.name},${end}${end}";"${movie.runtime}";"${movie.imdbId}";"${movie.tmdbId}";"${movie.top250}";"${movie.watched}";"${movie.dateAdded}";"${foreach movie.genres genre ,}${genre}${end}";"${foreach movie.tags tag ,}${tag}${end}";${foreach movie.videoFiles vf}"${vf.path}";"${vf.filename}";"${vf.filesize}";"${vf.containerFormat}";"${vf.videoCodec}";"${vf.videoWidth}";"${vf.videoHeight}";"${vf.audioCodec}";"${vf.audioChannels}";"${vf.duration}";${end}
${end}


Show template:

${foreach tvShows show}${foreach show.episodes episode}"${show.title}";"${show.year}";"${foreach show.tags tag ,}${tag}${end}";"${show.tvdbId}";"${show.watched}";"${episode.season}";"${episode.episode}";"${episode.title}";"${foreach episode.actors actor}${if index_actor=1}${actor.name},${end}${if index_actor=2}${actor.name},${end}${if index_actor=3}${actor.name},${end}${end}";"${episode.watched}";"${foreach episode.tags tag ,}${tag}${end}";${foreach episode.videoFiles vf}"${vf.path}";"${vf.filename}";"${vf.filesize}";"${vf.containerFormat}";"${vf.videoCodec}";"${vf.videoWidth}";"${vf.videoHeight}";"${vf.audioCodec}";"${vf.audioChannels}";"${vf.duration}"${end}
${end}${end}
#3
That's a nice way. I am learning python, so I just tried that. Now we have two different ways Smile
~Web and graphic designer... Linux enthusiast... Python Fan... A Gooner~
[AMD A10-7850K 3.7 Ghz, Radeon R7]
[Fedora 27] | [Kodi - 17.6 / Skin - Grid]

Image
#4
Found an issue for TV shows with an apostrophe, for example: "A Centaur's Life"
I don't know python so not sure the best way to fix that as an issue.
Update, Actually it is characters in the NFO its self, example:
Code:
<plot>Himeno is a sweet, shy little centaur girl. In her world, everyone seems to be a supernatural creature, and all her classmates have some kind of horns, wings, tails, halos, or other visible supernatural body part. Despite their supernatural elements, Himeno and her best friends, Nozomi and Kyouko, have a fun and mostly normal daily school life!
// Known in Japanese as "Centaur's Worries" (Japanese "セントールの悩み" Hepburn: Sentouru no Nayami).  Base on Japanese Manga series writting by Kei Murayama. Animation direct by Fumitoshi Oizaki.</plot>
If I change the nfo formatting to ANSI rather than the default UTF-8 (to remove special characters, turns them into Huh?) then it works, even when the apostrophe is in the folder name.

Logout Mark Read Team Forum Stats Members Help
Scripts for extracting data from nfo0