paljsingh / impartus-downloader

Download Impartus lectures, convert to mkv for offline viewing.
GNU General Public License v3.0
23 stars 8 forks source link

App shows video not downloaded, when the topic is changed #27

Closed paljsingh closed 3 years ago

paljsingh commented 3 years ago

A video downloaded at the time when the topic was unset ends up with a file path as $HOME/wilp/subject-profname/NN-No-Topic-Entered-yyyy-mm-dd.mkv

If at a later point the topic is updated, the application on a next relaunch, expects the downloaded video at the path: $HOME/wilp/subject-prof-name/NN-New-Topic-Description-yyyy-mm-dd.mkv Failing to find a file here, it shows the download status as 0%.

A similar case happens, if the user adds a new rule to map video being marked under Misc category to a new subject category, or if the video_path format is changed. or the video is manually moved to a new folder, or renamed.

paljsingh commented 3 years ago

The encoder now adds a metadata tag ttid=video-ttid-value when creating the mkv file. The app upon launch, searches for all *.mkv files under $HOME/wilp/ folder (or whatever is the target_path configured) and extracts the ttid value to map the lecture video record to a previously downloaded video.

This would fix all the above issues, as long as:

1) The videos have the ttid metadata tag i..e. videos are downloaded with v3.1.0 or higher. 2) If moved to a new location, the new path of the video is still under $HOME/wilp (or wherever target_path is pointed.)