mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 10:45:27 +00:00
clean up old cache files when we refresh epg from remote source
This commit is contained in:
parent
3dcc4902fa
commit
9c6e19fb3b
1 changed files with 4 additions and 1 deletions
|
|
@ -62,6 +62,9 @@ def fetch_xmltv(source):
|
|||
if not source.url:
|
||||
return
|
||||
|
||||
if os.path.exists(source.get_cache_file()):
|
||||
os.remove(source.get_cache_file())
|
||||
|
||||
logger.info(f"Fetching XMLTV data from source: {source.name}")
|
||||
try:
|
||||
response = requests.get(source.url, timeout=30)
|
||||
|
|
@ -160,7 +163,7 @@ def parse_programs_for_tvg_id(epg_id):
|
|||
file_path = epg_source.file_path
|
||||
if not file_path:
|
||||
file_path = epg_source.get_cache_file()
|
||||
if not os.exists(file_path):
|
||||
if not os.path.exists(file_path):
|
||||
fetch_xmltv(epg_source)
|
||||
|
||||
# Read entire file (decompress if .gz)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue