/usr/share/streamtuner2/channels/punkcast.py is in streamtuner2 2.0.8-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | # api: streamtuner2
# title: punkcast listing
#
#
# Disables itself per default.
# ST1 looked prettier with random images within.
#
import re
import http
from config import conf
import action
from channels import *
from channels import __print__
# disable plugin per default
if "punkcast" not in vars(conf):
conf.plugins["punkcast"] = 0
# basic.ch broadcast archive
class punkcast (ChannelPlugin):
# description
title = "punkcast"
module = "punkcast"
homepage = "http://www.punkcast.com/"
version = 0.1
# keeps category titles->urls
catmap = {}
categories = ["list"]
default = "list"
current = "list"
# don't do anything
def update_categories(self):
pass
# get list
def update_streams(self, cat, force=0):
rx_link = re.compile("""
<a\shref="(http://punkcast.com/(\d+)/index.html)">
\s+<img[^>]+ALT="([^<">]+)"
""", re.S|re.X)
entries = []
#-- all from frontpage
for uu in rx_link.findall(http.get(self.homepage)):
(homepage, id, title) = uu
entries.append({
"genre": "?",
"title": title,
"playing": "PUNKCAST #"+id,
"format": "audio/mp3",
"homepage": homepage,
})
# done
return entries
# special handler for play
def play(self, row):
rx_sound = re.compile("""(http://[^"<>]+[.](mp3|ogg|m3u|pls|ram))""")
html = http.get(row["homepage"])
# look up ANY audio url
for uu in rx_sound.findall(html):
__print__( uu )
(url, fmt) = uu
action.action.play(url, self.mime_fmt(fmt), "url/direct")
return
# or just open webpage
action.action.browser(row["homepage"])
|