openzim / youtube

Create a ZIM file from a Youtube channel/username/playlist
GNU General Public License v3.0
46 stars 26 forks source link

Delete video file if it has no channel associated #82

Closed satyamtg closed 4 years ago

satyamtg commented 4 years ago

Related to #76 . This ensures that the video files that are downloaded but no longer exist on YouTube are removed.

satyamtg commented 4 years ago

I don't really like moving it all to that condition as this will get complicated if we introduce other weird scenarios like this.

I'd prefer that we leave that loop alone and at the end of that function we clear files out. I suggest we loop on videos folder items and compare with what's left in videos. This way, whatever new filter we add, it will be included.

FYI, once we move to the pylibzim, this will be rendered useless as we'd be adding videos to the ZIM file on the fly and not creating them on filesystem and then adding it all via zimwriterfs.

@rgaudin have implemented a function to clean unused videos at the end from videos_dir

rgaudin commented 4 years ago

mislead you with my example. renamed fname to path as it better reflects the actual variable type.