MammaMia-Urlo commited on
Commit
b76e44a
·
verified ·
1 Parent(s): f957e62

Update wltv_server.py

Browse files
Files changed (1) hide show
  1. wltv_server.py +5 -5
wltv_server.py CHANGED
@@ -43,7 +43,7 @@ def extract_gz_file(gz_path, extract_to_dir):
43
  logger.error(f"GZ file does not exist: {gz_path}")
44
  return
45
  try:
46
- extracted_file_path = os.path.join(extract_to_dir, 'it_wltv_full.xml') # Updated file extension
47
  with gzip.open(gz_path, 'rb') as f_in:
48
  with open(extracted_file_path, 'wb') as f_out:
49
  shutil.copyfileobj(f_in, f_out)
@@ -54,7 +54,7 @@ def extract_gz_file(gz_path, extract_to_dir):
54
  # Function to parse XML and cache the result
55
  def parse_xml():
56
  global xml_tree
57
- xml_file = os.path.join(extract_to_dir, 'it_wltv_full.xml')
58
  if not os.path.exists(xml_file):
59
  logger.error("XML file does not exist for program data")
60
  return None
@@ -107,7 +107,7 @@ def get_current_program(channel_id):
107
  # Flask route to serve the extracted file
108
  @app.route('/wltv', methods=['GET'])
109
  def serve_extracted_file():
110
- file_name = 'it_wltv_full.xml'
111
  file_path = os.path.join(extract_to_dir, file_name)
112
 
113
  if os.path.exists(file_path):
@@ -132,7 +132,7 @@ def get_logs():
132
  @app.route('/update', methods=['POST'])
133
  def update_files():
134
  file_url = 'http://epg-guide.com/it.gz'
135
- file_path = '/tmp/it.gz'
136
 
137
  # Download and extract the gz file
138
  download_file(file_url, file_path)
@@ -155,7 +155,7 @@ def current_program(channel_id):
155
 
156
  if __name__ == '__main__':
157
  file_url = 'http://epg-guide.com/it.gz'
158
- file_path = '/tmp/it.gz'
159
 
160
  # Download and extract the gz file initially
161
  download_file(file_url, file_path)
 
43
  logger.error(f"GZ file does not exist: {gz_path}")
44
  return
45
  try:
46
+ extracted_file_path = os.path.join(extract_to_dir, 'it_generic_full_lite.xml') # Updated file extension
47
  with gzip.open(gz_path, 'rb') as f_in:
48
  with open(extracted_file_path, 'wb') as f_out:
49
  shutil.copyfileobj(f_in, f_out)
 
54
  # Function to parse XML and cache the result
55
  def parse_xml():
56
  global xml_tree
57
+ xml_file = os.path.join(extract_to_dir, 'it_generic_full_lite.xml')
58
  if not os.path.exists(xml_file):
59
  logger.error("XML file does not exist for program data")
60
  return None
 
107
  # Flask route to serve the extracted file
108
  @app.route('/wltv', methods=['GET'])
109
  def serve_extracted_file():
110
+ file_name = 'it_generic_full_lite.xml'
111
  file_path = os.path.join(extract_to_dir, file_name)
112
 
113
  if os.path.exists(file_path):
 
132
  @app.route('/update', methods=['POST'])
133
  def update_files():
134
  file_url = 'http://epg-guide.com/it.gz'
135
+ file_path = '/tmp/it_generic_full_lite.gz'
136
 
137
  # Download and extract the gz file
138
  download_file(file_url, file_path)
 
155
 
156
  if __name__ == '__main__':
157
  file_url = 'http://epg-guide.com/it.gz'
158
+ file_path = '/tmp/it_generic_full_lite.gz'
159
 
160
  # Download and extract the gz file initially
161
  download_file(file_url, file_path)