~jendrikseipp/pogo/github-mirror

682.1.1 by Jendrik Seipp
rename 'src' directory to 'pogo'
1
# -*- coding: utf-8 -*-
2
#
3
# Copyright (c) 2012  Jendrik Seipp (jendrikseipp@web.de)
4
#
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU Library General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18
19
from pogo import modules
20
from pogo import media
21
from pogo.tools import consts
22
23
24
# Module information
25
MOD_INFO = ('TrackLoader', 'Load tracks from disk asynchronously', '', [], True, False)
26
MOD_NAME = MOD_INFO[modules.MODINFO_NAME]
27
28
29
class TrackLoader(modules.ThreadedModule):
30
31
    def __init__(self):
32
        handlers = {
695.1.1 by Jendrik Seipp
run autopep8
33
            consts.MSG_EVT_LOAD_TRACKS: self.onLoadTracks,
34
        }
682.1.1 by Jendrik Seipp
rename 'src' directory to 'pogo'
35
        modules.ThreadedModule.__init__(self, handlers)
36
37
    def onLoadTracks(self, paths):
38
        modules.postMsg(consts.MSG_CMD_TRACKLIST_ADD,
39
                        {'tracks': media.getTracks(paths), 'playNow': True})