Files
xtream2m3u/run.py

39 lines
1.0 KiB
Python
Raw Normal View History

"""Xtream2M3U - Xtream Codes API to M3U converter
This is the main entry point for the application.
Run with: python run.py [--port PORT]
"""
import argparse
import logging
2024-08-26 13:09:52 -03:00
from app import create_app
from app.utils import setup_custom_dns
2024-08-26 13:09:52 -03:00
2025-04-24 22:25:01 -03:00
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
2025-12-21 04:53:42 -03:00
# Initialize custom DNS resolver globally so it runs for Gunicorn too
setup_custom_dns()
# Create the Flask app globally so Gunicorn can find 'app'
app = create_app()
2025-08-30 01:38:54 -03:00
def main():
"""Main entry point for the application"""
# Parse command line arguments
parser = argparse.ArgumentParser(description="Run the Xtream2M3U Flask app.")
parser.add_argument(
"--port", type=int, default=5000, help="Port number to run the app on (default: 5000)"
2025-01-26 17:11:02 -03:00
)
args = parser.parse_args()
2025-01-26 17:11:02 -03:00
# Run the app
logger.info(f"Starting Xtream2M3U server on port {args.port}")
app.run(debug=True, host="0.0.0.0", port=args.port)
2024-08-26 13:09:52 -03:00
2025-08-30 00:17:55 -03:00
if __name__ == "__main__":
main()