Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement fallback for Categories web-scraping
This PR includes: - Provide better Studio names - Fall back to hardcoded list of CATEGORIES if web-scraping fails - A hardcoded list of channels (both tv as radio) - Clean up of codebase to use both CHANNELS and CATEGORIES - Generate list of live streams from CHANNELS - Include unit test to ensure hard-coded CATEGORIES is identical to web-scraped list
- Loading branch information
Showing
11 changed files
with
228 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
from __future__ import absolute_import, division, unicode_literals | ||
|
||
# Fallback list of categories so we don't depend on web scraping only | ||
CATEGORIES = [ | ||
dict(name='Audiodescriptie', id='met-audiodescriptie'), | ||
dict(name='Cultuur', id='cultuur'), | ||
dict(name='Docu', id='docu'), | ||
dict(name='Entertainment', id='entertainment'), | ||
dict(name='Films', id='films'), | ||
dict(name='Human interest', id='human-interest'), | ||
dict(name='Humor', id='humor'), | ||
dict(name='Kinderen', id='voor-kinderen'), | ||
dict(name='Koken', id='koken'), | ||
dict(name='Lifestyle', id='lifestyle'), | ||
dict(name='Muziek', id='muziek'), | ||
dict(name='Nieuws en actua', id='nieuws-en-actua'), | ||
dict(name='Series', id='series'), | ||
dict(name='Sport', id='sport'), | ||
dict(name='Talkshows', id='talkshows'), | ||
dict(name='Vlaamse Gebarentaal', id='met-gebarentaal'), | ||
dict(name='Wetenschap en natuur', id='wetenschap-en-natuur'), | ||
] | ||
|
||
CHANNELS = { | ||
'een': dict( | ||
id='O8', | ||
type='tv', | ||
name='Eén', | ||
studio='Een', | ||
live_stream='https://www.vrt.be/vrtnu/kanalen/een/', | ||
|
||
), | ||
'canvas': dict( | ||
id='1H', | ||
type='tv', | ||
name='Canvas', | ||
studio='Canvas', | ||
live_stream='https://www.vrt.be/vrtnu/kanalen/canvas/', | ||
), | ||
'ketnet': dict( | ||
id='O9', | ||
type='tv', | ||
name='Ketnet', | ||
studio='Ketnet', | ||
live_stream='https://www.vrt.be/vrtnu/kanalen/ketnet/', | ||
), | ||
'ketnet-jr': dict( | ||
id='1H', | ||
type='tv', | ||
name='Ketnet Junior', | ||
studio='Ketnet Junior', | ||
), | ||
'sporza': dict( | ||
id='12', | ||
type='radio+tv', | ||
name='Sporza', | ||
studio='Sporza', | ||
), | ||
'vrtnxt': dict( | ||
id='', | ||
type='tv', | ||
name='VRT NXT', | ||
studio='VRT NXT', | ||
), | ||
'radio1': dict( | ||
id='11', | ||
type='radio', | ||
name='Radio 1', | ||
studio='Radio 1', | ||
), | ||
'radio2': dict( | ||
id='24', | ||
type='radio', | ||
name='Radio 2', | ||
studio='Radio 2', | ||
), | ||
'klara': dict( | ||
id='31', | ||
type='radio', | ||
name='Klara', | ||
studio='Klara', | ||
), | ||
'stubru': dict( | ||
id='41', | ||
type='radio+tv', | ||
name='Studio Brussel', | ||
studio='Studio Brussel', | ||
# live_stream='https://stubru.be/live', | ||
live_stream='https://live-radio-cf-vrt.akamaized.net/groupb/live/0f394a26-c87d-475e-8590-e9c6e79b28d9/live.isml/.mpd', | ||
), | ||
'mnm': dict( | ||
id='55', | ||
type='radio+tv', | ||
name='MNM', | ||
studio='MNM', | ||
# live_stream='https://mnm.be/kijk/live', | ||
live_stream='https://live-radio-cf-vrt.akamaized.net/groupa/live/bac277a1-306d-44a0-8e2e-e5b9c07fa270/live.isml/.mpd', | ||
), | ||
'vrtnws': dict( | ||
id='13', | ||
type='radio+tv', | ||
name='VRT NWS', | ||
studio='VRT NWS', | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.