Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [359b4701e7]:

To Artifact [911a034c54]:


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
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


-
+

-
+




-
+


-
-
-
+
+
+
+
+
+
+
+
-
+


-
+
-






# encoding: UTF-8
# api: streamtuner2
# title: Export All
# title: Export Category
# description: Exports a complete channel category (all stations into one file).
# version: -0.1
# version: 0.2
# type: feature
# category: file
# priority: optional
# config:
#   { name: export_format, value: pls, type: select, select: "pls|xspf|m3u|jspf|smil|asx|json", description: Export format. }
#   { name: export_format, value: xspf, type: select, select: "pls|xspf|m3u|jspf|smil|asx|json", description: Default export format. }
# hooks: config_save
#
# Use "Extensions > Export all" in the desired channel and category,
# to export all station entries at once. Currently just export PLS,
# which in turn references other .pls file).  Luckily most players
# Adds a context menu "Extensions > Export all", which can be used
# in any channel and category to save all stations into one playlist.
# Defaults to exporting as .PLS file, but meanwhile can be used for
# XSPF or old M3U files as well.
# Note that a .desktop link can only hold the very first entry.
#
# It won't convert the internal stream URLs though. Such that the
# combined playlist file may reference further playlists from servers
# can cover up for this horrid misdesign.
# of a directory provider.
#
# This is a workaround until the main GUI supports selecting multiple
# rows at once, and the action.* module has been overhauled to export
# rows at once. You can already save as
# a bit more deterministically.


from config import *
from channels import *
import ahttp
from uikit import uikit
import action
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63







-
+






    def savewindow(self, *w):
        cn = self.parent.channel()
        source = cn.listformat
        streams = cn.streams[cn.current]
        fn = uikit.save_file("Export category", None, "%s.%s.%s" % (cn.module, cn.current, conf.export_format))
        log.PROC("Exporting category to", fn)
        if fn:
            dest = re.findall("\.(m3u8?|pls|xspf|jspf|json|smil|asx)8?$", fn.lower())
            dest = re.findall("\.(m3u|pls|xspf|jspf|json|smil|asx|desktop|url)8?$", fn.lower())
            if dest:
                dest = dest[0]
            else:
                self.parent.status("Unsupported export playlist type (file extension).")
                return
            action.save_playlist(source="asis", multiply=False).file(rows=streams, fn=fn, dest=dest)
        pass