canales_autonomicos_pais_vasco = stringbetween(content, "#### Pais Vasco", "#### La Rioja") spain.add_ambit( Ambito("Pais Vasco", get_channels_from_part(canales_autonomicos_pais_vasco))) canales_autonomicos_la_rioja = stringbetween(content, "#### La Rioja", "#### Valencia") spain.add_ambit( Ambito("La Rioja", get_channels_from_part(canales_autonomicos_la_rioja))) canales_autonomicos_valencia = stringbetween(content, "#### Valencia", "## Internacionales") spain.add_ambit( Ambito("Valencia", get_channels_from_part(canales_autonomicos_valencia))) # Save data to JSON file json_file = open('./public/output/channels.json', "w+") # TODO Anadir copyright json_file.write(json.dumps(spain.to_json())) json_file.close() # Save data to M3U8 file text_file = open('./public/output/channels.m3u8', "w+") text_file.write("#EXTM3U" + "\n") text_file.write("# @LaQuay https://github.com/LaQuay/TDTChannels" + "\n") text_file.write(spain.to_m3u8()) text_file.close() print("JSON + M3U8 Updated")
get_channels_from_part(canales_locales_valencia)) canales_internacionales = stringbetween(content, "## Internacionales", "## Andorra") international.add_ambit( Ambito("Internacional", get_channels_from_part(canales_internacionales))) canales_andorra = stringbetween(content, "## Andorra", "") andorra.add_ambit(Ambito("Andorra", get_channels_from_part(canales_andorra))) # Save data to JSON file json_file = open('./public/output/channels.json', "w+") json_file.write("[") json_file.write(json.dumps(get_license_info())) json_file.write(", ") json_file.write(json.dumps(spain.to_json())) json_file.write(", ") json_file.write(json.dumps(international.to_json())) json_file.write(", ") json_file.write(json.dumps(andorra.to_json())) json_file.write("]") json_file.close() print("JSON Updated") # Save data to M3U8 file text_file = open('./public/output/channels.m3u8', "w+") text_file.write("#EXTM3U" + "\n") text_file.write("# @LaQuay https://github.com/LaQuay/TDTChannels" + "\n") text_file.write(spain.to_m3u8()) text_file.write(international.to_m3u8()) text_file.close()
canales_internacionales = stringbetween(content, "## Internacionales", "## Andorra") international.add_ambit( Ambito("Internacional", get_radio_channels_from_part(canales_internacionales))) canales_andorra = stringbetween(content, "## Andorra", "") andorra.add_ambit( Ambito("Andorra", get_radio_channels_from_part(canales_andorra))) # Save data to JSON file json_result = { "license": get_license_info(), "epg_url": None, "countries": [spain.to_json(), international.to_json(), andorra.to_json()], "updated": get_current_timestamp() } json_file = open('./public/output/radio_channels.json', "w+") json_file.write(json.dumps(json_result, indent=4, sort_keys=False)) json_file.close() print("JSON Updated") # Save data to M3U8 file text_file = open('./public/output/radio_channels.m3u8', "w+") text_file.write("#EXTM3U" + "\n") text_file.write("# @LaQuay https://github.com/LaQuay/TDTChannels" + "\n") text_file.write(spain.to_m3u8()) text_file.write(international.to_m3u8())
canales_locales_valencia = stringbetween(content_local, "### Valencia", "") spain.get_ambit("Valencia").add_channels(get_tv_channels_from_part(canales_locales_valencia)) canales_internacionales = stringbetween(content, "## Internacionales", "## Andorra") international.add_ambit(Ambito("Internacional", get_tv_channels_from_part(canales_internacionales))) canales_andorra = stringbetween(content, "## Andorra", "") andorra.add_ambit(Ambito("Andorra", get_tv_channels_from_part(canales_andorra))) # Save data to JSON file json_file = open('./public/output/channels.json', "w+") json_file.write("[") json_file.write(json.dumps(get_license_info())) json_file.write(", ") json_file.write(json.dumps(spain.to_json())) json_file.write(", ") json_file.write(json.dumps(international.to_json())) json_file.write(", ") json_file.write(json.dumps(andorra.to_json())) json_file.write("]") json_file.close() print("JSON Updated") # Save data to M3U8 file text_file = open('./public/output/channels.m3u8', "w+") text_file.write("#EXTM3U @LaQuay https://github.com/LaQuay/TDTChannels" + "\n") text_file.write( "#EXTM3U url-tvg=\"https://raw.githubusercontent.com/HelmerLuzo/TDTChannels_EPG/master/TDTChannels_EPG.xml\"\n") text_file.write(spain.to_m3u8()) text_file.write(international.to_m3u8())