Mythus commited on
Commit
ddeaa60
·
verified ·
1 Parent(s): ea12fc4

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +20 -31
run.py CHANGED
@@ -7,7 +7,7 @@ import config
7
  import logging
8
 
9
  # Configure logging
10
- logging.basicConfig(level=logging.DEBUG)
11
  FILMPERTUTTI = config.FILMPERTUTTI
12
  STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY
13
  MYSTERIUS = config.MYSTERIUS
@@ -40,13 +40,11 @@ MANIFEST = {
40
  }
41
 
42
 
43
- STREAMS = {
44
- "tv": {
45
- "channel1": {"name": "Channel 1", "url": "https://d3749synfikwkv.cloudfront.net/v1/master/3722c60a815c199d9c0ef36c5b73da68a62b09d1/cc-74ylxpgd78bpb/Live.m3u8"},
46
- "channel2": {"name": "Channel 2", "url": "http://mediapolis.rai.it/relinker/relinkerServlet.htm?cont=2606803&output=7&forceUserAgent=raiplayappletv"},
47
- # Add more channels as required
48
- }
49
- }
50
 
51
 
52
  def respond_with(data):
@@ -81,17 +79,13 @@ def catalog():
81
 
82
  @app.route('/stream/<type>/<id>.json')
83
  def addon_stream(type, id):
84
- logging.debug(f"App debug mode: {app.debug}")
85
- logging.debug(f"Received request for type: {type}, id: {id}")
86
- logging.debug(f"Received request for type: {type}, id: {id}")
87
- if type not in MANIFEST['types']: # Change this to "channel"
88
  abort(404)
89
-
90
  streams = {'streams': []}
91
- channel = STREAMS.get(type, {}).get(id)
92
- if channel:
93
  logging.debug(f"Found TV channel: {id}")
94
- streams['streams'] = [{"title": channel["name"], "url": channel["url"]}]
95
  else:
96
  logging.debug(f"Handling movie or series: {id}")
97
  if MYSTERIUS == "1":
@@ -123,26 +117,21 @@ def addon_stream(type, id):
123
 
124
  @app.route('/meta/<type>/<id>.json')
125
  def meta(type, id):
126
- if type != "channel": # Change this to "channel"
127
  abort(404)
128
 
129
- channel = STREAMS.get("tv", {}).get(id) # Change the type here to "tv"
130
- if channel:
131
- return respond_with({
132
- "meta": {
133
- "id": id,
134
- "name": channel["name"],
135
- "type": "channel",
136
- "poster": channel.get("poster", ""), # Add this line if you have a poster for each channel
137
- "background": channel.get("background", ""), # Add this line if you have a background for each channel
138
- "logo": channel.get("logo", ""), # Add this line if you have a logo for each channel
139
- # Add more fields as required
140
- }
141
- })
142
 
143
  abort(404)
144
 
145
-
146
  return respond_with({"meta": meta})
147
  if __name__ == '__main__':
148
  app.run(host=HOST, port=PORT)
 
7
  import logging
8
 
9
  # Configure logging
10
+
11
  FILMPERTUTTI = config.FILMPERTUTTI
12
  STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY
13
  MYSTERIUS = config.MYSTERIUS
 
40
  }
41
 
42
 
43
+ STREAMS = [
44
+ {"id": "channel1", "name": "Channel 1", "url": "https://d3749synfikwkv.cloudfront.net/v1/master/3722c60a815c199d9c0ef36c5b73da68a62b09d1/cc-74ylxpgd78bpb/Live.m3u8"},
45
+ {"id": "channel2", "name": "Channel 2", "url": "http://mediapolis.rai.it/relinker/relinkerServlet.htm?cont=2606803&output=7&forceUserAgent=raiplayappletv"},
46
+ # Add more channels as required
47
+ ]
 
 
48
 
49
 
50
  def respond_with(data):
 
79
 
80
  @app.route('/stream/<type>/<id>.json')
81
  def addon_stream(type, id):
82
+ if type not in MANIFEST['types']:
 
 
 
83
  abort(404)
 
84
  streams = {'streams': []}
85
+
86
+ if type in STREAMS and id in STREAMS[type]:
87
  logging.debug(f"Found TV channel: {id}")
88
+ streams['streams'] = STREAMS[type][id]
89
  else:
90
  logging.debug(f"Handling movie or series: {id}")
91
  if MYSTERIUS == "1":
 
117
 
118
  @app.route('/meta/<type>/<id>.json')
119
  def meta(type, id):
120
+ if type != "channel":
121
  abort(404)
122
 
123
+ for channel in STREAMS:
124
+ if channel["id"] == id:
125
+ return respond_with({
126
+ "meta": {
127
+ "id": channel["id"],
128
+ "name": channel["name"],
129
+ "type": "channel"
130
+ }
131
+ })
 
 
 
 
132
 
133
  abort(404)
134
 
 
135
  return respond_with({"meta": meta})
136
  if __name__ == '__main__':
137
  app.run(host=HOST, port=PORT)