Skip to content

Commit

Permalink
Add "Latest news broadcast"
Browse files Browse the repository at this point in the history
  • Loading branch information
rysport committed Aug 17, 2015
1 parent 627e220 commit 692ce63
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
MODE_CLIPS = "clips"
MODE_LIVE_PROGRAMS = "live-channels"
MODE_LATEST = "ep"
MODE_LATEST_NEWS = 'news'
MODE_POPULAR = "popular"
MODE_LAST_CHANCE = "last-chance"
MODE_VIDEO = "video"
Expand Down Expand Up @@ -56,6 +57,7 @@ def viewStart():

addDirectoryItem(localize(30009), { "mode": MODE_POPULAR })
addDirectoryItem(localize(30003), { "mode": MODE_LATEST })
addDirectoryItem(localize(30004), { "mode": MODE_LATEST_NEWS })
addDirectoryItem(localize(30010), { "mode": MODE_LAST_CHANCE })
addDirectoryItem(localize(30002), { "mode": MODE_LIVE_PROGRAMS })
addDirectoryItem(localize(30008), { "mode": MODE_CHANNELS })
Expand Down Expand Up @@ -130,6 +132,13 @@ def viewLatestVideos():
for article in articles:
createDirItem(article, MODE_VIDEO)

def viewLatestNews():
articles = svt.getLatestNews()
if not articles:
return
for article in articles:
createDirItem(article, MODE_VIDEO)

def viewLastChance():
articles = svt.getLastChance()
if not articles:
Expand Down Expand Up @@ -366,6 +375,8 @@ def addDirectoryItem(title, params, thumbnail = None, folder = True, live = Fals
startVideo(ARG_URL)
elif ARG_MODE == MODE_LATEST:
viewLatestVideos()
elif ARG_MODE == MODE_LATEST_NEWS:
viewLatestNews()
elif ARG_MODE == MODE_POPULAR:
viewPopular()
elif ARG_MODE == MODE_LAST_CHANCE:
Expand Down
7 changes: 7 additions & 0 deletions resources/lib/svt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
URL_TO_SEARCH = "/sok?q="
URL_TO_OA = "/kategorier/oppetarkiv"
URL_TO_CHANNELS = "/kanaler"
URL_TO_NEWS = "/nyheter"

JSON_SUFFIX = "?output=json"

Expand All @@ -24,6 +25,12 @@
SEARCH_LIST_EPISODES = "[^\"']*playJs-search-episodes[^\"']*"
SEARCH_LIST_CLIPS = "[^\"']*playJs-search-clips[^\"']*"

def getLatestNews():
"""
Returns a list of latest news.
"""
sliderId = "playJs-latest"
return getArticles(sliderId, URL_TO_NEWS)

def getAtoO():
"""
Expand Down

0 comments on commit 692ce63

Please sign in to comment.