Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -84,5 +84,7 @@ # start locally st2: run run: MALLOC_CHECK_=2 PYTHONVERBOSE=2 python -B ./st2.py -D +yelp: + yelp help/index.page 2>/dev/null & Index: channels/xiph.py ================================================================== --- channels/xiph.py +++ channels/xiph.py @@ -2,11 +2,11 @@ # api: streamtuner2 # title: Xiph.org # description: ICEcast radios. Scans per JSON API, slow XML, or raw directory. # type: channel # url: http://dir.xiph.org/ -# version: 0.5 +# version: 0.6 # category: radio # config: # { name: xiph_source, value: web, type: select, select: "cache=JSON cache srv|xml=Clunky XML blob|web=Forbidden fruits", description: "Source for station list extraction." } # priority: standard # png: @@ -193,50 +193,61 @@ elif cat: url = "http://dir.xiph.org/by_genre/{}".format(cat.title()) # Collect all result pages html = ahttp.get(url) - for i in range(1,4): + for i in range(1,5): if html.find('page={}">{}'.format(i, i+1)) < 0: break self.status(i/5.1) html += ahttp.get(url, {"search": cat.title(), "page": i}) - try: html = html.encode("raw_unicode_escape").decode("utf-8") - except: pass + try: + html = html.encode("raw_unicode_escape").decode("utf-8") + except: + pass # Find streams r = [] - #for row in re.findall("""(.+?)""", html, re.X|re.S): - # pass - ls = re.findall(""" - - .*? class="name"> - ]*> - (.*?) - .*? "listeners">\[(\d+) - .*? "stream-description">(.*?)< - .*? Tags: (.*?) - .*? href="(/listen/\d+/listen.xspf)" - .*? class="format"\s+title="([^"]+)" - .*? /by_format/([^"]+) - """, html, re.X|re.S) - - # Assemble - for homepage, title, listeners, playing, tags, url, bits, fmt in ls: + rows = re.findall("""(.+?)""", html, re.S) + for html in rows: + ls = self.rx_all( + dict( + homepage = """ class="name"> ]*> (.*?) """, + listeners = """ "listeners">\[(\d+) """, + playing = """ "stream-description">(.*?)< """, + tags = """ (?s) Tags: (.*?) """, + url = """ href="(/listen/\d+/listen.xspf)" """, + bits = """ class="format"\s+title="([^"]+)" """, + fmt = """ /by_format/([^"]+) """, + ), + html + ) r.append(dict( - genre = unhtml(tags), - title = unhtml(title), - homepage = ahttp.fix_url(homepage), - playing = unhtml(playing), - url = "http://dir.xiph.org{}".format(url), + genre = unhtml(ls["tags"]), + title = unhtml(ls["title"]), + homepage = ahttp.fix_url(ls["homepage"]), + playing = unhtml(ls["playing"]), + url = "http://dir.xiph.org{}".format(ls["url"]), listformat = "xspf", - listeners = int(listeners), - bitrate = bitrate(bits), - format = mime_fmt(guess_format(fmt)), + listeners = int(ls["listeners"]), + bitrate = bitrate(ls["bits"]), + format = mime_fmt(guess_format(ls["fmt"])), )) return r + # Regex dict + def rx_all(self, fields, src, flags=re.X): + row = {} + for k, v in fields.items(): + m = re.search(v, src, flags) + if m: + row[k] = m.group(1) + else: + row[k] = "" + return row + # Static list of categories genres = [ "pop", Index: help/html/channels.html ================================================================== --- help/html/channels.html +++ help/html/channels.html @@ -48,11 +48,10 @@ -

Channel service homepage

Index: help/html/configuration.html ================================================================== --- help/html/configuration.html +++ help/html/configuration.html @@ -16,35 +16,34 @@

There are various options for streamtuner2, available under Edit ▸ Preferences or via F12.

-

It's separated into different sections/tabs.

+

It's grouped into:

🔊 Player
-

Lists audio formats and the audio player applications, or recording tools below. - It's a map of file-types to applications. Double click an entry to edit it.

+

Associates media formats to audio player applications or recording tools.

☑ Options

Influences the display of all stream/station lists, and contains some behaviour and system settings.

📻 Channel Plugins
-

Every channel tab can have specific options. These are configured here. - Also you can disable channels you don't need.

+

Allows to enable or disable channel tabs. Each can have specific + options, which can be configured here.

🔌 Feature Plugins

Another class of plugins enables internal functions, or adds extra menu - entries, or configuration options.

+ entries, or further configuration options.

📦 Add

The Plugin Manager 2 adds another tab for updating or installing new plugins.

Player application settings

-

MIME types are categorzied identifiers for file types. Audio/mpeg for - example represents MP3 files, and audio/ogg means just OGG. And the player +

MIME types are categorized identifiers for file types. Audio/mpeg for + example represents MP3 files, and audio/ogg means OGG Vorbis. And the player setting dialog simply associates an audio type with a playback application:

@@ -102,12 +101,11 @@

Format

Application

video/youtube

xterm -e "youtube-dl %srv"

To define a target directory, you can often add commandline arguments to each. Also it's typically - helpful to leave the xterm prefix on, so you can follow the processing state. (Alternatively to - xterm there is x-terminal-emulator, or rxvt, gnome-terminal, xfce4-terminal, etc.)

+ helpful to leave the xterm prefix on, so you can follow the processing state.

Display/GUI options

@@ -138,11 +136,11 @@ require scraping listings out. Most channel tabs provide two alternative methods for that. The DOM/HTML selection method is sometimes slower, but more reliable. As fallback streamtuner2 plugins often use a regex to match text. Occassionally the regex method is surprisingly more exact, because directory services often use frightful unstructured HTML. If available, both methods are tried. You can influence the order with this setting, and thus speed it up.

-
[250] Limit stream number
+
[500] Limit stream number

Constraints the length of station lists per category. The number of stations option is not honored by all channel plugins. Often it's not possible to load more or fewer station entries. Some plugins have own settings (in the 'Plugins' section) even. For the major plugins this however limits how many scrollable entries appear in the stream lists.

Retain deleted stations
@@ -151,10 +149,14 @@ With this option enabled, these entries are kept in streamtuner2 as strikethrough entries (often at the end of the list).

Update favouries from freshened URLs

Streaming URLs in bookmarked stations get renewed on category reloads/updates. This isn't very reliable, as often station titles change together with the streaming URLs.

+
Save station lists after updates
+

After reloading (F5) the updated station lists are + autoamtically saved. For favicon updates or drag and drop events this + only happens automatically when this option is set.

Playlist

Index: help/html/dirble.html ================================================================== --- help/html/dirble.html +++ help/html/dirble.html @@ -25,11 +25,11 @@

It provides a JSON API, which as of v2 has a lot of unneeded meta information and internal ids. But it's actually nicer to scan, and contains even station homepages now.

The config option for a custom API key is perhaps redundant. Should streamtuner2 -D however reveal an error, you - can configure your own account there.

+ can however configure your own account there.

Index: help/html/recording.html ================================================================== --- help/html/recording.html +++ help/html/recording.html @@ -56,11 +56,13 @@
  • Pretend to be an audio player (in case recording is blocked):

    • streamripper -u 'WinampMPEG/5.0' %srv

  • -

    Whenever you leave out the xterm prefix, it runs silently in the background.

    +

    Whenever you leave out the xterm prefix, it runs silently in the background. +Common xterm alternatives are x-terminal-emulator, or rxvt, +gnome-terminal, and xfce4-terminal etc.

    See the streamripper(1) man page or its FAQ for more tips.

    Index: help/html/xiph.html ================================================================== --- help/html/xiph.html +++ help/html/xiph.html @@ -80,10 +80,12 @@ why there's this raw HTML extraction mode now.

    The website listings contain full station homepages and a few more extras. In this mode we can even acceess the XSPF playlist formats directly. Both, the server search function, or browsing by audio/video format are supported.

    +

    A miximum of 100 entries get fetched in this mode however + (which is 5 pages á 20 entries).