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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [0a9cb60b3a]

Overview
Comment:Implement filename update in SaveAs dialog on changing FileFilter (.m3u, .pls, .xspf) extension.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | action-mapfmts
Files: files | file ages | folders
SHA1: 0a9cb60b3a10bb0a47a68b01f6191560601a372a
User & Date: mario on 2015-04-10 13:50:11
Other Links: branch diff | manifest | tags
Context
2015-04-10
16:40
Finalize allowed filename extensions for exporting. Normalize Python3 string decoding (errors='ignore' per default). Update XSPF and SMIL export. Use row={} template now, instead of just carrying over title= to rewritten playlists. check-in: e136a78c73 user: mario tags: action-mapfmts
13:50
Implement filename update in SaveAs dialog on changing FileFilter (.m3u, .pls, .xspf) extension. check-in: 0a9cb60b3a user: mario tags: action-mapfmts
11:56
Apply proper file extension to temp files (they're never cleaned up, are they?) Fix MIME type probing, strip attributes. Support Apple M3U minor type, detect GVP playlists. check-in: 59075dcc1b user: mario tags: action-mapfmts
Changes

Modified st2.py from [c18d3ab85b] to [b17ac06878].

342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
342
343
344
345
346
347
348

349
350
351
352
353
354
355
356







-
+







    def save_as(self, widget):
        row = self.row()
        default_fn = row["title"] + ".m3u"
        fn = uikit.save_file("Save Stream", None, default_fn, [(".m3u","*m3u"),(".pls","*pls"),(".xspf","*xspf"),(".jspf","*jspf"),(".smil","*smil"),(".asx","*asx"),("all files","*")])
        if fn:
            source = row.get("listformat", self.channel().listformat)
            dest = (re.findall("\.(m3u|pls|xspf|jspf|json|smil|asx|wpl)8?$", fn) or ["pls"])[0]
            action.save_playlist(source=source, multiply=True).save(rows=[row], fn=fn, dest=dest)
            action.save_playlist(source=source, multiply=True).file(rows=[row], fn=fn, dest=dest)
        pass

    # Save current stream URL into clipboard
    def menu_copy(self, w):
        gtk.clipboard_get().set_text(self.selected("url"))

    # Remove a stream entry

Modified uikit.py from [f012e456ad] to [6ca85da059].

375
376
377
378
379
380
381





382
383
384
385
386
387
388
389









390
391
392
393
394
395
396
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410







+
+
+
+
+








+
+
+
+
+
+
+
+
+







            c.set_current_name(fn)
            fn = ""
        for fname,ftype in formats:
            f = gtk.FileFilter()
            f.set_name(fname)
            f.add_pattern(ftype)
            c.add_filter(f)
        # Yes, that's how to retrieve signals for changed filter selections
        try:
            filterbox = c.get_children()[0].get_children()[0]
            filterbox.connect("notify::filter", lambda *w: uikit.save_file_filterchange(c))
        except: pass
        
        # Filter handlers don't work either.

        # Display and wait
        if c.run():
            fn = c.get_filename()  # return filaname
        c.destroy()
        return fn

    # Callback for changed FileFilter, updates current filename extension
    @staticmethod
    def save_file_filterchange(c):
        fn, ext = c.get_filename(), c.get_filter().get_name()
        if fn and ext:
            fn = os.path.basename(fn)
            c.set_current_name(re.sub(r"\.(m3u|pls|xspf|jspf|asx|json|smil|wpl)$", ext, fn))
        
    
    
    
    # pass updates from another thread, ensures that it is called just once
    @staticmethod
    def do(lambda_func):
        gobject.idle_add(lambda: lambda_func() and False)