Пример #1
0
 def __init__(self, config, playlist_name):
     self._config = config
     self.linebreak = '\r\n'
     self.playlist_file = util.sanitize_filename(playlist_name, self._config.device_sync.max_filename_length) + '.m3u'
     self.playlist_folder = os.path.join(self._config.device_sync.device_folder, self._config.device_sync.playlists.folder)
     self.mountpoint = util.find_mount_point(self.playlist_folder)
     if self.mountpoint == '/':
         self.mountpoint = self.playlist_folder
         logger.warning('MP3 player resides on / - using %s as MP3 player root', self.mountpoint)
     self.playlist_absolute_filename = os.path.join(self.playlist_folder, self.playlist_file)
Пример #2
0
 def __init__(self, config, playlist_name):
     self._config=config
     self.linebreak = '\r\n'
     self.playlist_file=util.sanitize_filename(playlist_name + '.m3u')
     self.playlist_folder = os.path.join(self._config.device_sync.device_folder, self._config.device_sync.playlists.folder)
     self.mountpoint = util.find_mount_point(util.sanitize_encoding(self.playlist_folder))
     if self.mountpoint == '/':
         self.mountpoint = self.playlist_folder
         logger.warning('MP3 player resides on / - using %s as MP3 player root', self.mountpoint)
     self.playlist_absolute_filename=os.path.join(self.playlist_folder, self.playlist_file)
Пример #3
0
    def new(self):
        self.linebreak = '\n'
        if self._config.mp3_player_playlist_win_path:
            self.linebreak = '\r\n'
        self.mountpoint = util.find_mount_point(self._config.mp3_player_folder)
        if self.mountpoint == '/':
            self.mountpoint = self._config.mp3_player_folder
            log('Warning: MP3 player resides on / - using %s as MP3 player root',
                self.mountpoint,
                sender=self)
        self.playlist_file = os.path.join(
            self.mountpoint, self._config.mp3_player_playlist_file)
        icon_theme = gtk.icon_theme_get_default()
        self.icon_new = icon_theme.load_icon(gtk.STOCK_NEW, 16, 0)

        # add column two
        check_cell = gtk.CellRendererToggle()
        check_cell.set_property('activatable', True)
        check_cell.connect('toggled', self.cell_toggled)
        check_column = gtk.TreeViewColumn(_('Use'), check_cell, active=1)
        self.treeviewPlaylist.append_column(check_column)

        # add column three
        column = gtk.TreeViewColumn(_('Filename'))
        icon_cell = gtk.CellRendererPixbuf()
        column.pack_start(icon_cell, False)
        column.add_attribute(icon_cell, 'pixbuf', 0)
        filename_cell = gtk.CellRendererText()
        column.pack_start(filename_cell, True)
        column.add_attribute(filename_cell, 'text', 2)

        column.set_resizable(True)
        self.treeviewPlaylist.append_column(column)

        # Make treeview reorderable
        self.treeviewPlaylist.set_reorderable(True)

        # init liststore
        self.playlist = gtk.ListStore(gtk.gdk.Pixbuf, bool, str)
        self.treeviewPlaylist.set_model(self.playlist)

        # read device and playlist and fill the TreeView
        title = _('Reading files from %s') % self._config.mp3_player_folder
        message = _(
            'Please wait your media file list is being read from device.')
        dlg = gtk.MessageDialog(self.main_window, gtk.DIALOG_MODAL,
                                gtk.MESSAGE_INFO, gtk.BUTTONS_NONE)
        dlg.set_title(title)
        dlg.set_markup('<span weight="bold" size="larger">%s</span>\n\n%s' %
                       (title, message))
        dlg.show_all()
        threading.Thread(target=self.process_device, args=[dlg]).start()
Пример #4
0
 def open(self):
     self.notify('status', _('Opening MP3 player'))
     if util.directory_is_writable(self.destination):
         self.notify('status', _('MP3 player opened'))
         if gl.config.mp3_player_use_scrobbler_log:
             mp3_player_mount_point=util.find_mount_point(self.destination)
             # If a moint point cannot be found look inside self.destination for scrobbler_log_filenames
             # this prevents us from os.walk()'ing the entire / filesystem
             if mp3_player_mount_point == '/':
                 mp3_player_mount_point=self.destination
             log_location=self.find_scrobbler_log(mp3_player_mount_point)
             if log_location is not None and self.load_audioscrobbler_log(log_location):
                 log('Using Audioscrobbler log data to mark tracks as played', sender=self)
         return True
     else:
         return False
Пример #5
0
 def new(self):
     self.linebreak = '\n'
     if self._config.mp3_player_playlist_win_path:
         self.linebreak = '\r\n'
     self.mountpoint = util.find_mount_point(self._config.mp3_player_folder)
     if self.mountpoint == '/':
         self.mountpoint = self._config.mp3_player_folder
         log('Warning: MP3 player resides on / - using %s as MP3 player root', self.mountpoint, sender=self)
     self.playlist_file = os.path.join(self.mountpoint,
                                       self._config.mp3_player_playlist_file)
     icon_theme = gtk.icon_theme_get_default()
     try:
         self.icon_new = icon_theme.load_icon(gtk.STOCK_NEW, 16, 0)
     except Exception, e:
         log('Icon missing from theme: %s', gtk.STOCK_NEW, sender=self)
         self.icon_new = None
Пример #6
0
    def new(self):
        self.linebreak = '\n'
        if self._config.mp3_player_playlist_win_path:
            self.linebreak = '\r\n'
        self.mountpoint = util.find_mount_point(self._config.mp3_player_folder)
        if self.mountpoint == '/':
            self.mountpoint = self._config.mp3_player_folder
            log('Warning: MP3 player resides on / - using %s as MP3 player root', self.mountpoint, sender=self)
        self.playlist_file = os.path.join(self.mountpoint,
                                          self._config.mp3_player_playlist_file)
        icon_theme = gtk.icon_theme_get_default()
        self.icon_new = icon_theme.load_icon(gtk.STOCK_NEW, 16, 0)

        # add column two
        check_cell = gtk.CellRendererToggle()
        check_cell.set_property('activatable', True)
        check_cell.connect('toggled', self.cell_toggled)
        check_column = gtk.TreeViewColumn(_('Use'), check_cell, active=1)
        self.treeviewPlaylist.append_column(check_column)

        # add column three
        column = gtk.TreeViewColumn(_('Filename'))
        icon_cell = gtk.CellRendererPixbuf()
        column.pack_start(icon_cell, False)
        column.add_attribute(icon_cell, 'pixbuf', 0)
        filename_cell = gtk.CellRendererText()
        column.pack_start(filename_cell, True)
        column.add_attribute(filename_cell, 'text', 2)

        column.set_resizable(True)
        self.treeviewPlaylist.append_column(column)

        # Make treeview reorderable
        self.treeviewPlaylist.set_reorderable(True)

        # init liststore
        self.playlist = gtk.ListStore(gtk.gdk.Pixbuf, bool, str)
        self.treeviewPlaylist.set_model(self.playlist)

        # read device and playlist and fill the TreeView
        title = _('Reading files from %s') % self._config.mp3_player_folder
        message = _('Please wait your media file list is being read from device.')
        dlg = gtk.MessageDialog(self.main_window, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE)
        dlg.set_title(title)
        dlg.set_markup('<span weight="bold" size="larger">%s</span>\n\n%s'%(title, message))
        dlg.show_all()
        threading.Thread(target=self.process_device, args=[dlg]).start()
Пример #7
0
 def new(self):
     self.linebreak = '\n'
     if self._config.mp3_player_playlist_win_path:
         self.linebreak = '\r\n'
     self.mountpoint = util.find_mount_point(self._config.mp3_player_folder)
     if self.mountpoint == '/':
         self.mountpoint = self._config.mp3_player_folder
         log('Warning: MP3 player resides on / - using %s as MP3 player root',
             self.mountpoint,
             sender=self)
     self.playlist_file = os.path.join(
         self.mountpoint, self._config.mp3_player_playlist_file)
     icon_theme = gtk.icon_theme_get_default()
     try:
         self.icon_new = icon_theme.load_icon(gtk.STOCK_NEW, 16, 0)
     except Exception, e:
         log('Icon missing from theme: %s', gtk.STOCK_NEW, sender=self)
         self.icon_new = None
Пример #8
0
 def open(self):
     Device.open(self)
     self.notify('status', _('Opening MP3 player'))
     if util.directory_is_writable(self.destination):
         self.notify('status', _('MP3 player opened'))
         # build the initial tracks_list
         self.tracks_list = self.get_all_tracks()
         if self._config.mp3_player_use_scrobbler_log:
             mp3_player_mount_point = util.find_mount_point(self.destination)
             # If a moint point cannot be found look inside self.destination for scrobbler_log_filenames
             # this prevents us from os.walk()'ing the entire / filesystem
             if mp3_player_mount_point == '/':
                 mp3_player_mount_point = self.destination
             log_location = self.find_scrobbler_log(mp3_player_mount_point)
             if log_location is not None and self.load_audioscrobbler_log(log_location):
                 log('Using Audioscrobbler log data to mark tracks as played', sender=self)
         return True
     else:
         return False