MasterPuppeteer

Give the option in settings to expose streams to Live Channels

...@@ -21,6 +21,9 @@ public class PasteyPuppet implements InstallablePuppet { ...@@ -21,6 +21,9 @@ public class PasteyPuppet implements InstallablePuppet {
21 android:title="M3U List" 21 android:title="M3U List"
22 android:summary="Enter pastebin.com #pastey IDs here. After saving the IDs, reenter #Pastey to refresh content." /> 22 android:summary="Enter pastebin.com #pastey IDs here. After saving the IDs, reenter #Pastey to refresh content." />
23 <CheckBoxPreference 23 <CheckBoxPreference
24 + android:title="Expose to Live Channels"
25 + android:key="expose_streams" />
26 + <CheckBoxPreference
24 android:title="Enable rtmp://" 27 android:title="Enable rtmp://"
25 android:key="enable_rtmp" /> 28 android:key="enable_rtmp" />
26 <CheckBoxPreference 29 <CheckBoxPreference
...@@ -172,7 +175,26 @@ public class PasteyPuppet implements InstallablePuppet { ...@@ -172,7 +175,26 @@ public class PasteyPuppet implements InstallablePuppet {
172 175
173 @Override 176 @Override
174 List<Map<String, String>> getLiveChannelsMetaData() { 177 List<Map<String, String>> getLiveChannelsMetaData() {
175 - return null 178 + def list = []
179 + if (sSettingsProvider != null && sSettingsProvider.getBoolean("expose_streams", false)) {
180 + for (Puppet p : getChildren()) {
181 + if (p instanceof PasteyM3U8Puppet) {
182 + for (Puppet c : p.getChildren()) {
183 + def SourcesPuppet.SourceIterator sources = (SourcesPuppet.SourceIterator) ((PasteySourcesPuppet) c).getSources()
184 + if (sources.hasNext()) {
185 + list << [
186 + name : c.getName(),
187 + description: c.getShortDescription(),
188 + genres : c.getCategory(),
189 + logo : c.getImageUrl(),
190 + url : sources.next().url
191 + ]
192 + }
193 + }
194 + }
195 + }
196 + }
197 + return list
176 } 198 }
177 199
178 @Override 200 @Override
......