Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Script breakdown

pastapojken edited this page Apr 23, 2019 · 1 revision

What every script does

Simple run down of the function of every file, in alphabetical order:

  • bMhtml.sh builds the html for the movies' database, doesn't take any arguments
  • bTVhtml.sh builds the html for the tv shows' database, doesn't take any arguments, the work is parallelized through bTVShows.sh
  • bTVShow.sh, called by bTVhtml.sh, has 2 arguments, the ID of the show and it's name. Creates a temporary file with all the html of the single show. bTVhtml.sh takes care of stitching it all together
  • buildDBs.sh builds the databases. It takes either 1, 2 or 3 as argument, where 1 only searches in the movie path and builds the movie database, 2 only for the tv shows, and 3 for both.
    What the script actually does is run find in the set paths, searching for any ".mp4" files in that path. Once a file has been found, it passes it to parseMfilename.sh/parseTVfilename.sh.
  • buildHtml.sh builds the html. It's a wrapper for bMhtml and bTVhtml, with the same options as buildDBs.sh. So if you run buildHtml.sh 3 it will run bMhtml and then bTVhtml
  • config.cfg is simply the file that contains all the variables the scripts use. if this file is missing then the scripts will use their default values, which are the same defaults as the config's
  • getMid.sh fetches the IMDB id of a given movie. The script takes 1 argument, the name of the movie to search for, with dots instead of spaces.
    The script uses curl and grep to search for the first ID it can find in the html. ( I know, not very future proof or particularly accurate, as it takes the values arbitrarily... It's way more accurate and fast than using the TMDB api though, in my experience... )
  • getMposter.sh uses the TMDB api to fetch a poster (it arbitrarily picks the first result ) for a given movie id. The script takes one argument, the IMDB id WITHOUT "tt" at the start. It returns either the URL to the poster or, if you download the poster, the path to it.
  • getTVid.sh searches for a tv series on TMDB and returns it's TMDB id. Takes 1 argument, the name of the tv show
  • getTVposter.sh uses the TMDB api to fetch a poster (it arbitrarily picks the first result ) for a given tv show id. The script takes one argument, the TMDB id of the show and returns either the URL to the poster or, if you download the poster, the path to it.
  • parseMfilename.sh takes 1 argument, the path of the file to be parsed and added to the movie database. This is where the bulk of of the program is, it calls all the other scripts and assembles the json database
  • parseTVfilename.sh takes 1 argument, the path of the file to be parsed and added to the tv show database. This is where the bulk of of the program is, it calls all the other scripts and assembles the json database
  • fixFile.sh takes 2 to 3 arguments, 1st argument is the complete filepath (same as in DBs) to the file entry you want to change, 2nd argument is the new ID of the movie/tv show to put in the database, 3rd argument is the filepath/url to the new poster
  • nfoToDBs.sh builds the databases. It takes either 1, 2 or 3 as argument, where 1 only searches in the movie path and builds the movie database, 2 only for the tv shows, and 3 for both.
    What the script actually does is run find in the set paths, searching for any ".nfo" files in that path. Once a file has been found, it passes it to parseMnfo.sh/parseTVnfo.sh.
  • parseMnfo.sh takes 1 argument, the path of the file to be parsed and added to the movie database. This is where the bulk of of the program is, it analyzes the given *.nfo file and assembles the json database
  • parseTVnfo.sh takes 1 argument, the path of the file to be parsed and added to the movie database. This is where the bulk of of the program is, it analyzes the given *.nfo file and assembles the json database

If any of the "get" scripts fails, the matching fields in the database will either be empty or "null"

Clone this wiki locally