-
Notifications
You must be signed in to change notification settings - Fork 4
Usage
The user selects a folder which contains the movie that the user wants to download the subtitles for. The program scans through the subfolder of the selected folder. When a media file is detected, PTN (parse-torrent-name) is used to extract the name of the movie from the messy file name torrent files usually have:
- Before: The Killing of a Sacred Deer.2017.1080p.WEB-DL.H264.AC3-EVO[EtHD]
- After: The Killing of a Sacred Deer
After the file name has been cleaned up, it is sent to OMDb where the IMDb ID number of that specific movie is retrieved and stored into a newly created database media.db
. The application also recognizes if a movie already has a subtitle file.
Once all IMDb ID's for the movie files in that folder have been stored it is displayed on a table in the GUI. The user can choose how to display the data:
- display all movies
- display only movies with subtitles
- display only movie without subtitles
Simply by clicking on one or more entries and then Remove entry removes it from the database. Clicking Clear database obviously deletes the whole database. The Select all radio button selects all the movies in the currently selected display of the table. "Confirm selection" locks the selection in the table and enables the user to download subtitles for those movies in the selected language. Pressing Download initiates the downloading from OpenSubtitles.
Downloading from OpenSubtitles begins with attempting to log in to the OpenSubtitles server. Once the log in is successful, the program retrieves all the movies the user has selected and sends their IMDb ID's to OpenSubtitles to see if there are any subtitles in that selected language. If there is, the subtitle ID's are stored to a database. When all the subtitle ID's have been stored, the application pulls the ID's and sends them to OpenSubtitles, which in turn returns byte code data as a response. Downloads are performed in batches of 20 due to OpenSubtitles API restrictions. That byte code data is then written as a file to each respective directory where the movies are located in.