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

โŒˆโŒ‹ โŽ‡ branch:  streamtuner2


Check-in [e7e8ee0da9]

Overview
Comment:Planning on JIT record function (streamripper in background).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e7e8ee0da94f44061613c1f5f56a3d1d9628669f
User & Date: mario on 2015-11-12 22:10:15
Other Links: manifest | tags
Context
2015-11-12
22:30
Needs proper signal disconnecting (overlaps with standard record function). check-in: 5954812093 user: mario tags: trunk
22:10
Planning on JIT record function (streamripper in background). check-in: e7e8ee0da9 user: mario tags: trunk
2015-11-11
21:02
Register config options. check-in: 84228576fb user: mario tags: trunk
Changes

Added contrib/continuous_record.py version [5d34bb9446].











































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
# encoding: utf-8
# title: Continuous/JIT record
# description: Starts background recording on play, to allow saving current track
# version: -0.1
# depends: streamtuner2 >= 2.1.9
# type: hook
# config:
#   { name: jitrecord_ripper, type: select, value: streamtripper, select: streamripper|fpls, description: Background recording tool. }
#   { name: jitrecord_timeout, type: int, value: 15, description: Delete tracks after NN minutes. }
#   { name: jitrecord_target, type: str, value: "$HOME/Music", description: Where to save completed track. }
#   { name: jitrecord_tmp, type: str, value: "/tmp/streamtuner2/recording/", description: Temporary storeage. }
# category: ui
# status: incomplete
# support: none
#
# *Planned feature*
#    ยท Changes the record button into a record/save function.
#    ยท Starts streamripper in the background.
#      Target dir: /tmp/streamtuner2/recording/
#    ยท Deletes recorded tracks after 15 min.
#    ยท On [Save] just stored the last completed track
#      to $HOME/Music
#

import action
from config import *
from uikit import *
import os, os.path

# Stop button
class continuous_record(object):
    module = __name__
    meta = plugin_meta()
    parent = None
    rec = None

    # exchange button and hook
    def __init__(self, parent):
        self.parent = parent
        self.rec = parent.record
    
        # register options
        conf.add_plugin_defaults(self.meta, self.module)
        
        # adapt icon
        self.rec.set_stock_id(gtk.STOCK_MEDIA_PAUSE)
        self.rec.set_label("jit")
        
        # apply hook
        parent.hooks["play"].append(self.play_start_recording)


    # Store last completed track away
    def save_current(self, *x, **y):
    
        # just opens stored folder
        action.run("xdg-open %s" % conf.jitrecord_tmp)
        
        # copy last file from /tmp to ~/Music
        pass


    # start recording background process
    def play_start_recording(self, row, *x, **y):

        # exchange toolbar button
        self.rec.set_stock_id(gtk.STOCK_FLOPPY)
        self.rec.set_label("track")
        self.rec.connect("clicked", self.save_current)
        
        # check for temp directory
        tmp = conf.jitrecord_tmp
        if not os.path.exits(tmp):
            os.makedirs(tmp)

        # start streamripper
        action.run("pkill streamripper")
        action.run("streamripper %r -d %s" % (row["url"], conf.jitrecord_tmp))

        # hook sched/kronos to look for outdated files
        pass
        
        #