Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relaxing channel name check in Xtream API #178

Merged
merged 27 commits into from
Dec 8, 2021
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
293963b
Added Initial XTream
superolmo May 28, 2021
a1dca48
Added XTream Series
superolmo Jun 2, 2021
d0be0a5
Added check for local logo_path
superolmo Jun 4, 2021
a84f7ce
Back to fixed path
superolmo Jun 4, 2021
b97598a
Added pyxtream choice
superolmo Jun 5, 2021
0530fc9
Replaced the test server
superolmo Jun 6, 2021
b56a6fb
Replaced the test server
superolmo Jun 6, 2021
ab11dfd
Fixed cache-path and added regex search
superolmo Jun 7, 2021
5d4a971
Merge branch 'master' of github.com:superolmo/hypnotix
superolmo Jun 7, 2021
2b8d127
Merge branch 'master' of https://github.com/linuxmint/hypnotix into l…
superolmo Jun 7, 2021
b38d61e
Changed osp back to os.path
superolmo Jun 7, 2021
7db1d62
Changed osp back to os.path
superolmo Jun 7, 2021
06517d6
Merge branch 'linuxmin-master'
superolmo Jun 7, 2021
2a45eb1
Fixed bug in the way it reload from cache
superolmo Jun 12, 2021
e79a848
Fixed missing provider when it doesn't load
superolmo Jun 18, 2021
dcbb6a1
Improved handling of missing keys
superolmo Jun 18, 2021
97b9e73
Fixed Categories and cleaned up the code
superolmo Jun 18, 2021
32af21f
Updated function names to follow PEP8
superolmo Jun 28, 2021
51e6d1d
Added check before authorizing
superolmo Sep 27, 2021
e6390d9
Merge remote-tracking branch 'upstream/master'
superolmo Sep 27, 2021
fca44f2
Scale down changes
superolmo Sep 27, 2021
0b41feb
Revert some more changes
superolmo Sep 27, 2021
215e191
Revert last changes
superolmo Sep 27, 2021
76bd0f2
Revert flag name
superolmo Sep 27, 2021
211db79
Discard streams w/o name, change live radio type to live stream
superolmo Nov 5, 2021
c8577a2
Rebase to upstream master
superolmo Nov 28, 2021
a7d447c
Fix subgroup name check
superolmo Dec 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Discard streams w/o name, change live radio type to live stream
  • Loading branch information
superolmo committed Nov 5, 2021
commit 211db79ca4e992b711f2bdc85cde78240e1e4d1b
109 changes: 56 additions & 53 deletions usr/lib/hypnotix/xtream.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Channel():
def __init__(self, xtream: object, group_title, stream_info):
stream_type = stream_info['stream_type']
# Adjust the odd "created_live" type
if stream_type == "created_live":
if stream_type == "created_live" or stream_type == "radio_streams":
stream_type = "live"

if stream_type != "live" and stream_type != "movie":
Expand Down Expand Up @@ -578,61 +578,64 @@ def load_iptv(self):
## Add Streams to dictionaries

for stream_channel in all_streams:
# Generate Group Title
if stream_channel['name'][0].isalnum():

# Some channels have no group,
# so let's add them to the catche all group
if stream_channel['category_id'] == None:
stream_channel['category_id'] = '9999'
elif stream_channel['category_id'] != '1':
pass

# Find the first occurence of the group that the
# Channel or Stream is pointing to
the_group = next(
(x for x in self.groups if x.group_id == stream_channel['category_id']),
None
)

if the_group != None:
group_title = the_group.name
else:
group_title = self.catch_all_group.name
the_group = self.catch_all_group

if loading_stream_type == self.series_type:
# Load all Series
new_series = Serie(self, stream_channel)
# To get all the Episodes for every Season of each
# Series is very time consuming, we will only
# populate the Series once the user click on the
# Series, the Seasons and Episodes will be loaded
# using x.getSeriesInfoByID() function

else:
new_channel = Channel(
self,
group_title,
stream_channel
if stream_channel['name'] != "":
# Generate Group Title
if stream_channel['name'][0].isalnum():

# Some channels have no group,
# so let's add them to the catche all group
if stream_channel['category_id'] == None:
stream_channel['category_id'] = '9999'
elif stream_channel['category_id'] != '1':
pass

# Find the first occurence of the group that the
# Channel or Stream is pointing to
the_group = next(
(x for x in self.groups if x.group_id == stream_channel['category_id']),
None
)

if the_group != None:
group_title = the_group.name
else:
group_title = self.catch_all_group.name
the_group = self.catch_all_group

if loading_stream_type == self.series_type:
# Load all Series
new_series = Serie(self, stream_channel)
# To get all the Episodes for every Season of each
# Series is very time consuming, we will only
# populate the Series once the user click on the
# Series, the Seasons and Episodes will be loaded
# using x.getSeriesInfoByID() function

# Save the new channel to the local list of channels
if loading_stream_type == self.live_type:
self.channels.append(new_channel)
elif loading_stream_type == self.vod_type:
self.movies.append(new_channel)
else:
self.series.append(new_series)

# Add stream to the specific Group
if the_group != None:
if loading_stream_type != self.series_type:
the_group.channels.append(new_channel)
else:
the_group.series.append(new_series)
else:
print("Group not found `{}`".format(stream_channel['name']))
new_channel = Channel(
self,
group_title,
stream_channel
)

# Save the new channel to the local list of channels
if loading_stream_type == self.live_type:
self.channels.append(new_channel)
elif loading_stream_type == self.vod_type:
self.movies.append(new_channel)
else:
self.series.append(new_series)

# Add stream to the specific Group
if the_group != None:
if loading_stream_type != self.series_type:
the_group.channels.append(new_channel)
else:
the_group.series.append(new_series)
else:
print("Group not found `{}`".format(stream_channel['name']))
else:
print("Stream has empty name `{}`".format(json.dumps(stream_channel)))
else:
print("Could not load {} Streams".format(loading_stream_type))

Expand Down