Browse the code

 

Differences between 211 and 212 on /.
Number of edited files: 5 (0 added, 0 deleted and 5 modified)
Revision 212

About 3 months and 29 days ago.

* Dropped shuffle mode to expand drunk mode features
Added file(s) Deleted file(s) Modified file(s)

 

Old New Code
1
1
<?xml version="1.0" encoding="UTF-8"?>
2
 
<!-- Generated with glade 3.18.3 -->
 
2
<!-- Generated with glade 3.20.0 -->
3
3
<interface>
4
4
  <requires lib="gtk+" version="3.12"/>
 
5
  <object class="GtkImage" id="image1">
 
6
    <property name="visible">True</property>
 
7
    <property name="can_focus">False</property>
 
8
    <property name="icon_name">list-add-symbolic</property>
 
9
  </object>
 
10
  <object class="GtkImage" id="image2">
 
11
    <property name="visible">True</property>
 
12
    <property name="can_focus">False</property>
 
13
    <property name="icon_name">media-playback-start-symbolic</property>
 
14
  </object>
5
15
  <object class="GtkBox" id="box1">
6
16
    <property name="visible">True</property>
7
17
    <property name="can_focus">False</property>
23
33
                    <property name="width_request">250</property>
24
34
                    <property name="visible">True</property>
25
35
                    <property name="can_focus">False</property>
26
 
                    <property name="orientation">vertical</property>
27
36
                    <child>
28
37
                      <object class="GtkLabel" id="label_album">
29
38
                        <property name="visible">True</property>
30
39
                        <property name="can_focus">False</property>
31
40
                        <property name="halign">start</property>
32
 
                        <property name="label" translatable="no"></property>
33
41
                        <attributes>
34
42
                          <attribute name="weight" value="bold"/>
35
43
                          <attribute name="scale" value="1"/>
46
54
                        <property name="visible">True</property>
47
55
                        <property name="can_focus">False</property>
48
56
                        <property name="halign">start</property>
49
 
                        <property name="label" translatable="no"></property>
50
57
                        <attributes>
51
58
                          <attribute name="style" value="italic"/>
52
59
                          <attribute name="scale" value="1"/>
53
 
                          <attribute name="absolute-size" value="10000"/>
54
60
                        </attributes>
55
61
                      </object>
56
62
                      <packing>
227
233
      <placeholder/>
228
234
    </child>
229
235
  </object>
230
 
  <object class="GtkImage" id="image1">
231
 
    <property name="visible">True</property>
232
 
    <property name="can_focus">False</property>
233
 
    <property name="icon_name">list-add-symbolic</property>
234
 
  </object>
235
 
  <object class="GtkImage" id="image2">
236
 
    <property name="visible">True</property>
237
 
    <property name="can_focus">False</property>
238
 
    <property name="icon_name">media-playback-start-symbolic</property>
239
 
  </object>
240
236
</interface>
241
237

                                        

 

Old New Code
49
49
                      </packing>
50
50
                    </child>
51
51
                    <child>
52
 
                      <object class="GtkToggleToolButton" id="tool-shuffle">
 
52
                      <object class="GtkToolButton" id="tool-shuffle">
53
53
                        <property name="visible">True</property>
54
54
                        <property name="can_focus">False</property>
55
 
                        <property name="tooltip_text" translatable="yes">Shuffle mode</property>
56
55
                        <property name="use_underline">True</property>
57
56
                        <property name="icon_name">media-playlist-shuffle-symbolic</property>
58
57
                      </object>
59
58

                                        

 

Old New Code
78
78
                        },
79
79
            'Playlist': {'repeat':          int(True),
80
80
                         # True to enable repeat mode.
81
 
                         'shuffle':         int(True),
 
81
                         'shuffle':         int(True)
82
82
                         # True to enable shuffle mode when playlist is empty.
83
 
                         'shuffle_mode':    'random'
84
 
                         # Available shuffle modes are: random and similar.
85
83
                        },
 
84
            'Player':   {'drunk_mode':      int(True),
 
85
                         # True to enable the drunk mode.
 
86
                         'drunk_mode_type': 'random',
 
87
                         # Available drunk modes are: random and similar.
 
88
                         'replaygain':      int(True),
 
89
                         # True to enable ReplayGain.
 
90
                         'replaygain_mode': 'auto'
 
91
                         # Available ReplayGain modes are: auto, album, track.
 
92
                        },
86
93
            'Window':   {'y':               10,
87
94
                         'x':               10,
88
95
                         'height':          740,
89
96

                                        

 

Old New Code
67
67
        frame.add(framebox)
68
68

                                        
69
69
        lbl = Label(xalign=0)
70
 
        #lbl.set_markup('<small><b>' + _('Automatic playback when playlist is empty and nothing queued. We choose music for you.') + '</b></small>')
 
70
        lbl.set_markup('&lt;small>&lt;b>' + _('Automatic playback when playlist is empty and nothing queued. We choose music for you.') + '&lt;/b>&lt;/small>')
71
71
        lbl.set_line_wrap_mode(WrapMode.WORD)
72
72
        lbl.set_line_wrap(True)
73
73
        framebox.add(lbl)
82
82

                                        
83
83
        switch = Switch()
84
84
        switch.set_vexpand(False)
 
85

                                    
 
86
        useroption = bool(int(config.config['Player']['drunk_mode']))
 
87
        switch.set_active(useroption)
 
88

                                    
85
89
        hbox.pack_start(switch, False, False, 0)
86
90

                                        
87
91
        mode_store = ListStore(str, str)
94
98
        mode_combo.add_attribute(renderer_text, 'text', 1)
95
99
        framebox.add(mode_combo)
96
100

                                        
 
101
        useroption = config.config['Player']['drunk_mode_type']
 
102
        #mode_combo.set_active(mode_store[useroption].get_path()[0])
 
103

                                    
97
104
        # Widgets for replaygain
98
105
        frame = Frame(label=_('ReplayGain'))
99
106
        frame.set_margin_top(10)
107
114
        frame.add(framebox)
108
115

                                        
109
116
        lbl = Label(xalign=0)
110
 
        #lbl.set_markup('<small><b>' + _('Normalize loudness (avoids the common problem of having to manually adjust volume levels between tracks).') + '</b></small>')
 
117
        lbl.set_markup('&lt;small>&lt;b>' + _('Normalize loudness (avoids the common problem of having to manually adjust volume levels between tracks).') + '&lt;/b>&lt;/small>')
111
118
        lbl.set_line_wrap_mode(WrapMode.WORD)
112
119
        lbl.set_line_wrap(True)
113
120
        framebox.add(lbl)
114
121

                                        

 

Old New Code
48
48
        self.config = {}
49
49
        rpt = self.userconf.config['Playlist']['repeat']
50
50
        self.config['repeat'] = bool(int(rpt))
51
 
        shf = self.userconf.config['Playlist']['shuffle']
52
 
        self.config['shuffle'] = bool(int(shf))
53
 
        shm = self.userconf.config['Playlist']['shuffle_mode']
54
 
        self.config['shuffle_mode'] = shm
 
51
        shf = self.userconf.config['Player']['drunk_mode']
 
52
        self.config['drunk'] = bool(int(shf))
 
53
        shm = self.userconf.config['Player']['drunk_mode_type']
 
54
        self.config['drunk_mode'] = shm
55
55

                                        
56
56
        self.lastfm = LastFm()
57
57
        self.playlists_mgmnt = Playlists()
111
111
            self.repeat_btn.connect('clicked', self.toggle, 'repeat')
112
112

                                        
113
113
            self.shuffle_btn = self.widgets.get_object('tool-shuffle')
114
 
            if self.config['shuffle']:
115
 
                self.shuffle_btn.set_active(True)
 
114
            # TODO: not a push button anymore
 
115
            #if self.config['shuffle']:
 
116
            #    self.shuffle_btn.set_active(True)
116
117
            self.shuffle_btn.connect('clicked', self.toggle, 'shuffle')
117
118

                                        
118
119
            def clean_wdg(widget):
241
242
            self.config['repeat'] = True
242
243
            self.repeat_btn.set_active(True)
243
244
            self.userconf.update_key('Playlist', 'repeat', str(int(True)))
244
 
        elif action == 'shuffle' and self.config['shuffle']:
245
 
            self.config['shuffle'] = False
246
 
            self.shuffle_btn.set_active(False)
247
 
            self.userconf.update_key('Playlist', 'shuffle', str(int(False)))
248
 
        elif action == 'shuffle' and not self.config['shuffle']:
249
 
            self.config['shuffle'] = True
250
 
            self.shuffle_btn.set_active(True)
251
 
            self.userconf.update_key('Playlist', 'shuffle', str(int(True)))
252
245

                                        
253
246
    def row_activated(self, widget, path, column):
254
247
        item_iter = self.liststore.get_iter(path)
537
530

                                        
538
531
        if len(self.playlist_content) == 0:
539
532
            # Playlist is empty.
540
 
            if not self.config['shuffle']:
541
 
                # Shuffle disabled: abort playback.
 
533
            if not self.config['drunk']:
 
534
                # Drunk mode disabled: abort playback.
542
535
                self.extensions.load_event('OnAbortPlayback')
543
536
            else:
544
 
                # Shuffle enabled.
545
 
                if self.config['shuffle_mode'] == 'random':
546
 
                    # Random mode: seek for shuffle song.
 
537
                # Drunk mode enabled.
 
538
                if self.config['drunk_mode'] == 'random':
 
539
                    # Random mode: seek for a random song.
547
540
                    self.extensions.load_event('AskShuffleSong')
548
 
                elif self.config['shuffle_mode'] == 'similar':
 
541
                elif self.config['drunk_mode'] == 'similar':
549
542
                    # Similar mode: seek for a similar song.
550
543
                    if len(self.similar_artists) == 0:
551
544
                        # No similar song founded: seek for any one.
582
575

                                        
583
576
    def song_started(self, song):
584
577
        # First, try to download a few similar artists names
585
 
        if self.config['shuffle_mode'] == 'similar':
 
578
        if self.config['drunk_mode'] == 'similar':
586
579
            def download_similars():
587
580
                threads_enter()
588
581
                art = self.lastfm.get_similar_artists(song.artist)
589
582