Beispiel #1
0
	def app_default(self, c):
		f = c.file

		if f.video or f.audio:
			if f.video:
				c.flags += 'd'
			return self.either(c, 'vlc', 'smplayer', 'mplayer', 'totem')

		return DefaultApps.app_default(self, c)
Beispiel #2
0
    def app_default(self, c):
        f = c.file

        if f.extension in ('pdf'):
            return self.app_evince(c)

        if f.extension in ('cbr', 'cbz'):
            return self.app_comix(c)

        return DefaultApps.app_default(self, c)
Beispiel #3
0
    def app_default(self, c):
        f = c.file

        return_file = os.getenv("RANGER_RETURN_FILE")
        if return_file is not None:
            with open(return_file, 'w') as tmp:
                tmp.write(f.path)
            raise SystemExit()

        if f.extension is not None:
            if f.extension in ('mp3', 'ogg', 'flac', 'wav'):
                return self.either(c, 'mplayer')
            #    return self.app_mplayer_playlist()
            if f.extension in ('m3u', 'pls'):
                return self.app_mplayer_playlist_cache(c)
            #if f.extension in ('mp3', 'ogg', 'flac', 'wav', 'm3u', 'pls'):
            #    return self.either(c, 'vlc')
            if f.extension in ('pdf', ):
                c.flags += 'd'
                return self.either(c, 'evince', 'zathura', 'okular', 'xpdf',
                                   'apvlv')
            if f.extension in ('chm', ):
                c.flags += 'd'
                return self.either(c, 'chmsee', 'xchm')
            if f.extension in ('torrent', ):
                c.flags += 'd'
                return self.either(c, 'deluge')
            if f.extension in (
                    'psd',
                    'xcf',
            ):
                c.flags += 'd'
                return self.either(c, 'gimp')
            if f.extension in ('pd', ):
                c.flags += 'd'
                return self.either(c, 'puredata')
            if f.extension in ('html', 'htm', 'xhtml') or f.extension == 'swf':
                c.flags += 'd'
                handler = self.either(c, 'chromium', 'luakit', 'uzbl',
                                      'vimprobable', 'vimprobable2', 'jumanji',
                                      'firefox', 'seamonkey', 'iceweasel',
                                      'opera', 'surf', 'midori', 'epiphany',
                                      'konqueror')
                # Only return if some program was found:
                if handler:
                    return handler

        if f.image:
            return self.either(c, 'mirage', 'eog', 'feh')

        return DefaultApps.app_default(self, c)
Beispiel #4
0
    def app_default(self, c):
        """How to determine the default application?"""
        f = c.file #shortcut

        if f.container:
            return tup('7zFM', *c)

        if f.video or f.audio:
            if f.video:
                c.flags += 'd'
            return self.either(c, 'vlc', 'mplayer', 'smplayer',
                    'gnome-mplayer', 'totem')

        return DefaultApps.app_default(self, c)
Beispiel #5
0
    def app_default(self, c):
        """How to determine the default application?"""
        f = c.file  #shortcut

        if f.container:
            return tup('7zFM', *c)

        if f.video or f.audio:
            if f.video:
                c.flags += 'd'
            return self.either(c, 'vlc', 'mplayer', 'smplayer',
                               'gnome-mplayer', 'totem')

        return DefaultApps.app_default(self, c)
Beispiel #6
0
    def app_default(self, c):
        f = c.file

        return_file = os.getenv("RANGER_RETURN_FILE")
        if return_file is not None:
            with open(return_file, 'w') as tmp:
                tmp.write(f.path)
            raise SystemExit()

        if f.extension is not None:
            if f.extension in ('mp3', 'ogg', 'flac', 'wav'):
                return self.either(c, 'mpv')
            # return self.app_mplayer_playlist()
            #if f.extension in ('m3u', 'pls'):
            #    return self.app_mplayer_playlist_cache(c)
            if f.extension in ('mp3', 'ogg', 'flac', 'wav', 'm3u', 'pls'):
             return self.either(c, 'vlc')
            if f.extension in ('pdf', ):
                c.flags += 'd'
                return self.either(c, 'evince', 'zathura', 'okular', 'xpdf', 'apvlv')
            if f.extension in ('chm', ):
                c.flags += 'd'
                return self.either(c, 'chmsee', 'xchm')
            if f.extension in ('torrent', ):
                c.flags += 'd'
                return self.either(c, 'transmission', 'deluge')
            if f.extension in ('psd', 'xcf', ):
                c.flags += 'd'
                return self.either(c, 'gimp')
            if f.extension in ('pd', ):
                c.flags += 'd'
                return self.either(c, 'puredata')
            if f.extension in ('sgf', ):
                c.flags += 'd'
                return self.either(c, 'thunar')
            if f.extension in ('html', 'htm', 'xhtml') or f.extension == 'swf':
                c.flags += 'd'
                handler = self.either(c,
                        'chromium',
                        'luakit', 'uzbl', 'vimprobable', 'vimprobable2', 'jumanji',
                        'firefox', 'seamonkey', 'iceweasel', 'opera',
                        'surf', 'midori', 'epiphany', 'konqueror')
                # Only return if some program was found:
                if handler:
                    return handler

        if f.image:
            return self.either(c, 'mirage', 'eog', 'feh')

        return DefaultApps.app_default(self, c)
Beispiel #7
0
 def app_mplayer(self, c):
     if c.mode is 2:
         args = "mplayer -channels 2".split()
         args.extend(c)
         return tup(*args)
     elif c.mode is 3:
         args = "playfrom".split()
         args.extend(c)
         return tup(*args)
     elif c.mode is 4:
         args = "playfrom -channels 2".split()
         args.extend(c)
         return tup(*args)
     else:
         return DefaultApps.app_mplayer(self, c)
Beispiel #8
0
	def app_default(self, c):
		"""How to determine the default application?"""
		f = c.file

		if f.basename.lower() == 'makefile':
			return self.either(c, 'make')

		if f.extension is not None:
			if f.extension in ('pdf', ):
				c.flags += 'd'
				return self.either(c, 'evince', 'zathura', 'apvlv', 'epdfview')
			if f.extension in ('xml', ):
				return self.either(c, 'editor')
			if f.extension in ('html', 'htm', 'xhtml'):
				return self.either(c, 'firefox', 'opera', 'jumanji',
						'luakit', 'elinks', 'lynx')
			if f.extension == 'swf':
				return self.either(c, 'firefox', 'opera', 'jumanji', 'luakit')
			if f.extension == 'nes':
				return self.either(c, 'fceux')
			if f.extension in ('swc', 'smc'):
				return self.either(c, 'zsnes')
			if f.extension in ('odt', 'ods', 'odp', 'odf', 'odg',
					'doc', 'xls'):
				return self.either(c, 'libreoffice', 'soffice', 'ooffice')

		if f.container:
			return self.either(c, 'aunpack', 'file_roller')

		if f.video or f.audio:
			if f.video:
				c.flags += 'd'
			return self.either(c, 'mplayer', 'smplayer', 'vlc', 'totem')

		if f.image:
			return self.either(c, 'feh', 'eog', 'mirage')

		if f.document or f.filetype.startswith('text') or f.size == 0:
			return self.either(c, 'editor')

		return DefaultApps.app_default(self, c)