Automatic
Automatic copied to clipboard
Filter pattern replacement
This patch is useful to get tv shows in folders (as Kodi need for example). I have some like this in my automatic.conf
filter = {
pattern => "(.*)(\d+)x(\d+)"
folder => "/storage/videos/tvshows/\1"
feedid => 1
}
So when a pattern mach, the tv show is added to it's folder.
I think this fix the issues:
- Sorry for bad comments, I wrote them when I was reading the code, my bad.
- I need download_folder_reg and download_folder to avoid memory leak or segmentations faults.
if(isMatch(session->filters, item->name, feedID, &download_folder, &filter_pattern))
....
download_folder_reg = rewriteURL(item->name, filter_pattern, download_folder);
In first line, download_folder can't be freed because is only a ref , but in the second line download_folder_reg, must be freed, so I need 2 vars. (Or I think so)