Exemplo n.º 1
0
    def show(self):
        size = ini.get_int('general', 'view_postergrid_size')
        self.gg.item_size = size, int(size * 1.5)
        self.gg.group_item_size = 32, 32  # TODO read from theme and scale mult

        gui.signal_emit(self._signal_show)
        self.gg.focus_allow = True
        self.gg.focus = True
Exemplo n.º 2
0
def volume_adjusted_get():
    """ logarithmic adjusted volume. Float, between 0.0 and MAX (100 by default)
          https://www.dr-lex.be/info-stuff/volumecontrols.html
    """
    exp = ini.get_int('mediaplayer', 'volume_exponent')
    if 1 < exp < 5:
        adjusted = ((_volume / 100.0) ** exp) * 100
    else:
        adjusted = _volume

    return adjusted
Exemplo n.º 3
0
 def item_selected(self, url, user_data):
     dia = EmcDialog(self._lbl,
                     style='list',
                     done_cb=self._dia_list_selected_cb)
     i = 0
     for string in self._vals:
         if i == ini.get_int(self._sec, self._opt):
             it = dia.list_item_append(string, end='icon/check_on')
             it.selected = True
         else:
             it = dia.list_item_append(string)
         it.data['i'] = i
         i += 1
     dia.list_go()
Exemplo n.º 4
0
def volume_set(vol: float) -> None:
    """ Set linear volume. Float, always between 0 and 100 """
    global _volume

    vol = utils.clamp(vol, 0, 100)
    vol = vol / 100.0 * ini.get_int('mediaplayer', 'volume_maximum')

    if vol == _volume:
        return

    _volume = vol
    EmcGui.instance().volume_set(vol)
    ini.set('mediaplayer', 'volume', _volume)
    # events.event_emit('VOLUME_CHANGED')

    if _player:
        _player.volume_set(volume_adjusted_get())
Exemplo n.º 5
0
def _change_fps():
    gui.fps_set(ini.get_int('general', 'fps'))
Exemplo n.º 6
0
 def label_end_get(self, url, user_data):
     i = ini.get_int(self._sec, self._opt)
     return self._vals[i]
Exemplo n.º 7
0
def volume_step_get():
    """ volume adjustament step. Int, between 1 and 100 """
    return ini.get_int('mediaplayer', 'volume_adjust_step')
Exemplo n.º 8
0
def volume_get():
    """ get linear volume. Float, always between 0 and 100 """
    maximum = ini.get_int('mediaplayer', 'volume_maximum')
    return _volume / maximum * 100.0
Exemplo n.º 9
0
def play_url(url, only_audio=False, start_from=None):
    global _onair_url, _onair_title, _onair_poster
    global _player, _saved_player

    # default to 'file://' if not given
    if url.find('://', 2, 15) is -1:
        url = 'file://' + url

    # check url
    if url.startswith('file://') and not os.path.exists(url[7:]):
        text = '<b>%s:</b><br>%s' % (_('File not found'), url)
        EmcDialog(text=text, style='error')
        return

    DBG('play_url: %s' % url)
    _onair_url = url
    _onair_title = None
    _onair_poster = None

    if only_audio:
        _play_real(start_from, only_audio)
        return

    # save (pause and hide) the AudioPlayer if it's active
    # if isinstance(_player, EmcAudioPlayer):
    #     _player.pause()
    #     _player.hide()
    #     _saved_player = _player
    #     _player = None

    # starting position forced by param
    if start_from is not None:
        _play_real(start_from, only_audio)
        return

    # dont resume on dvd playback, it doesn't work :(
    if url.startswith('dvd://'):
        _play_real(0)
        return

    # resume playback from last position ?
    #   0=ask, 1=always, 2=never
    resume_opt = ini.get_int('mediaplayer', 'resume_from_last_pos')

    if resume_opt == 2:  # never resume
        _play_real(0)
        return

    counts = play_counts_get(url)
    pos = counts['stop_at'] or 0

    if resume_opt == 1:  # always resume
        _play_real(pos)
        return

    if pos < 10000:  # don't ask if less then 10 seconds
        _play_real(0)
        return

    # ask the user if resume or not
    time = utils.millis_to_duration(pos, True)
    EmcDialog(style='yesno', title=_('Resume playback'),
              text=_('Continue from %s ?') % time,
              done_cb=_resume_yes_cb, canc_cb=_resume_no_cb,
              user_data=pos)