This file is indexed.

/usr/lib/pytone/services/players/xmmsplayer.py is in pytone 3.0.0-1build4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*- coding: ISO-8859-1 -*-

# Copyright (C) 2002 Jörg Lehmann <joerg@luga.de>
#
# This file is part of PyTone (http://www.luga.de/pytone/)
#
# PyTone is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
# PyTone is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyTone; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

import os
import time
import xmms.control

from services.player import genericplayer

# Note: the implementation xmms player is a bit hackish,
# so don't look too close. At many places, sleeps have
# been interted to get it working, so as I said...

class player(genericplayer):
    def __init__(self, id, playlistid, autoplay, session=0, noqueue=0):
        self.session = session
        self.noqueue = noqueue

        # a mapping path -> song
        self.songs = {} 
        self.initxmms()
        
        genericplayer.__init__(self, id, playlistid, autoplay)

    def initxmms(self):
        if not xmms.control.is_running(self.session):
            abs_prog_name = xmms.control._find_and_check_executable("xmms")
            if not abs_prog_name:
                raise xmms.control.ExecutableNotFound("can't find XMMS executable")
            os.system(abs_prog_name + " >/dev/null 2>/dev/null &")
            while not xmms.control.is_running(self.session):
                time.sleep(0.2)

        xmms.control.playlist_clear(self.session)
        xmms.control.main_win_toggle(0, self.session)
        xmms.control.pl_win_toggle(0, self.session)
        xmms.control.eq_win_toggle(0, self.session)

    # event handler

    def play(self):
        if xmms.control.is_playing(self.session):
            pos = xmms.control.get_playlist_pos(self.session)
            # title = xmms.control.get_playlist_title(pos, self.session)
            # ttime = xmms.control.get_playlist_time(pos, self.session)
            # ptime = xmms.control.get_output_time(self.session)
            # self.playbackinfo = (title, int(ptime/1000), int(ttime/1000))
            path = xmms.control.get_playlist_file(pos, self.session)
            song = self.songs[path]
            ptime = xmms.control.get_output_time(self.session)/1000
            self.playbackinfo.updatesong(song)
            self.playbackinfo.updatetime(ptime)

            # fill up xmms playlist if necessary
            if song.length-ptime<20 and xmms.control.get_playlist_length()<2: 
                self.requestnextsong()
            if pos>0:
                path = xmms.control.get_playlist_file(0, self.session)
                xmms.control.playlist_delete(0, self.session)
                del self.songs[path]
        else:
            self.playbackinfo.updatesong(None)

        time.sleep(0.1)

    def _playsong(self, song, manual):
        if self.noqueue:
            xmms.control.playlist_clear(self.session)
            self.songs = {}
            
        self.songs[song.path] = song
        xmms.control.playlist_add((song.path,), self.session)

        if not xmms.control.is_playing():
            xmms.control.play(self.session)
            # wait a little, so that xmms can start playing
            # and we don't request another song...
            time.sleep(0.5)

    def _playerstart(self):
        # before we start playing, we clear the playlist
        xmms.control.playlist_clear(self.session)
        self.songs = {}

    def _playerpause(self):
        # before we start playing, we clear the playlist
        xmms.control.pause(self.session)

    def _playerunpause(self):
        # before we start playing, we clear the playlist
        xmms.control.play(self.session)

    def _playerseekrelative(self, seconds):
        ptime = xmms.control.get_output_time(self.session)
        pos = xmms.control.get_playlist_pos(self.session)
        ttime = xmms.control.get_playlist_time(pos, self.session)
        time = min(max(ptime + int(seconds * 1000), 0), ttime)
        xmms.control.jump_to_time(time, self.session)
    
    def _playerstop(self):
        xmms.control.playlist_clear(self.session)
        self.songs = {}

    def playernext(self, event):
        if event.playerid==self.id:
            if xmms.control.is_playing(self.session):
                self.requestnextsong()
                # wait a little for the other threads, uuh...
                time.sleep(1)
                self.channel.process()
                time.sleep(0.1)
            xmms.control.playlist_next(self.session)

    def _playerquit(self):
        xmms.control.quit(self.session)