Example #1
0
    def __init__(self, sessconfig=None):
        """ Constructor. 
        @param sessconfig Optional dictionary used internally 
        to make this a copy constructor.
        """
        if sessconfig is not None:  # copy constructor
            self.sessconfig = sessconfig
            return

        self.sessconfig = {}

        # Define the built-in default here
        self.sessconfig.update(sessdefaults)

        # Set video_analyser_path
        if sys.platform == 'win32':
            ffmpegname = "ffmpeg.exe"
        else:
            ffmpegname = "ffmpeg"

        ffmpegpath = find_prog_in_PATH(ffmpegname)
        if ffmpegpath is None:
            if sys.platform == 'win32':
                self.sessconfig['videoanalyserpath'] = ffmpegname
            elif sys.platform == 'darwin':
                self.sessconfig['videoanalyserpath'] = "macbinaries/ffmpeg"
            else:
                self.sessconfig['videoanalyserpath'] = ffmpegname
        else:
            self.sessconfig['videoanalyserpath'] = ffmpegpath

        self.sessconfig['ipv6_binds_v4'] = autodetect_socket_style()
Example #2
0
    def __init__(self,sessconfig=None):
        """ Constructor. 
        @param sessconfig Optional dictionary used internally 
        to make this a copy constructor.
        """

        if sessconfig is not None: # copy constructor
            self.sessconfig = sessconfig
            return
        
        self.sessconfig = {}
        
        # Define the built-in default here
        self.sessconfig.update(sessdefaults)
        
        # Set video_analyser_path
        if sys.platform == 'win32':
            ffmpegname = "ffmpeg.exe"
        else:
            ffmpegname = "ffmpeg"
    
        ffmpegpath = find_prog_in_PATH(ffmpegname)
        if ffmpegpath is None:
            if sys.platform == 'win32':
                self.sessconfig['videoanalyserpath'] = ffmpegname
            elif sys.platform == 'darwin':
                self.sessconfig['videoanalyserpath'] = "macbinaries/ffmpeg"
            else:
                self.sessconfig['videoanalyserpath'] = ffmpegname
        else:
            self.sessconfig['videoanalyserpath'] = ffmpegpath

        self.sessconfig['ipv6_binds_v4'] = autodetect_socket_style()
Example #3
0
    def setupConfig(self):
        defaults = {
            # MiscPanel
            'language_file': 'english.lang',
            'confirmonclose': '1',
            'associate': '1',
            # DiskPanel
            'removetorrent': '0',
            'diskfullthreshold': '1',
            # RateLimitPanel
            #'maxupload': '5',
            'maxuploadrate': '0',
            'maxdownloadrate': '0',
            'maxseeduploadrate': '0',
            # SeedingOptionsPanel
            'uploadoption': '0',
            'uploadtimeh': '0',
            'uploadtimem': '30',
            'uploadratio': '100',
            #AdvancedNetworkPanel
            #AdvancedDiskPanel
            #TriblerPanel
            'torrentcollectsleep': '15',  # for RSS Subscriptions
            # VideoPanel
            'videoplaybackmode': '0',
            # Misc
            'enableweb2search': '0',
            'torrentassociationwarned': '0',
            # GUI
            'window_width': '1024',
            'window_height': '670',
            'detailwindow_width': '800',
            'detailwindow_height': '500',
            'prefwindow_width': '1000',
            'prefwindow_height': '480',
            'prefwindow_split': '400',
            't4t_option': 0,  # Seeding items added by Boxun
            't4t_ratio': 100,  # T4T seeding ratio added by Niels
            't4t_hours': 0,
            't4t_mins': 30,
            'g2g_option': 1,
            'g2g_ratio': 75,
            'g2g_hours': 0,
            'g2g_mins': 30,
            'family_filter': 1,
            'window_x': "",
            'window_y': "",
            'popup_player': 0,
            'use_bundle_magic': 0,

            # WebUI
            'use_webui': 0,
            'webui_port': 8080,

            # swift reseed
            'swiftreseed': 1
        }

        if sys.platform == 'win32':
            defaults['mintray'] = '2'
            # Don't use double quotes here, those are lost when this string is stored in the
            # abc.conf file in INI-file format. The code that starts the player will add quotes
            # if there is a space in this string.
            progfilesdir = os.path.expandvars('${PROGRAMFILES}')
            #defaults['videoplayerpath'] = progfilesdir+'\\VideoLAN\\VLC\\vlc.exe'
            # Path also valid on MS Vista
            defaults[
                'videoplayerpath'] = progfilesdir + '\\Windows Media Player\\wmplayer.exe'
            defaults['videoanalyserpath'] = self.getPath() + '\\ffmpeg.exe'
        elif sys.platform == 'darwin':
            defaults['mintray'] = '0'  # tray doesn't make sense on Mac
            vlcpath = find_prog_in_PATH("vlc")
            if vlcpath is None:
                #second try
                vlcpath = "/Applications/VLC.app"
                if not os.path.exists(vlcpath):
                    vlcpath = None

            if vlcpath is None:
                defaults[
                    'videoplayerpath'] = "/Applications/QuickTime Player.app"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "vlc/ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath
        else:
            defaults['mintray'] = '0'  # Still crashes on Linux sometimes
            vlcpath = find_prog_in_PATH("vlc")
            if vlcpath is None:
                defaults['videoplayerpath'] = "vlc"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath

        configfilepath = os.path.join(self.getConfigPath(), "abc.conf")
        self.config = ConfigReader(configfilepath, "ABC", defaults)
Example #4
0
    def setupConfig(self):
        defaults = {
            # MiscPanel
            'language_file': 'english.lang',
            'confirmonclose': '1',
            'associate': '1',
            # DiskPanel
            'removetorrent': '0',
            'diskfullthreshold': '1',
            # RateLimitPanel
            # 'maxupload': '5',
            'maxuploadrate': '0',
            'maxdownloadrate': '0',
            'maxseeduploadrate': '0',
            # SeedingOptionsPanel
            'uploadoption': '0',
            'uploadtimeh': '0',
            'uploadtimem': '30',
            'uploadratio': '100',
            # AdvancedNetworkPanel
            # AdvancedDiskPanel
            # TriblerPanel
            'torrentcollectsleep': '15', # for RSS Subscriptions
            # VideoPanel
            'videoplaybackmode': '0',
            # Misc
            'enableweb2search': '0',
            'torrentassociationwarned': '0',
            # GUI
            'window_width': '1024',
            'window_height': '670',
            'detailwindow_width': '800',
            'detailwindow_height': '500',
            'prefwindow_width': '1000',
            'prefwindow_height': '480',
            'prefwindow_split': '400',
            'sash_position': '-185',
            't4t_option': 0, # Seeding items added by Boxun
            't4t_ratio': 100, # T4T seeding ratio added by Niels
            't4t_hours': 0,
            't4t_mins': 30,
            'g2g_option': 1,
            'g2g_ratio': 75,
            'g2g_hours': 0,
            'g2g_mins': 30,
            'family_filter': 1,
            'window_x': "",
            'window_y': "",
            'use_bundle_magic': 0,

            # WebUI
            'use_webui': 0,
            'webui_port': 8080,

            # swift reseed
            'swiftreseed': 1
        }

        if sys.platform == 'win32':
            defaults['mintray'] = '2'
            # Don't use double quotes here, those are lost when this string is stored in the
            # abc.conf file in INI-file format. The code that starts the player will add quotes
            # if there is a space in this string.
            progfilesdir = os.path.expandvars('${PROGRAMFILES}')
            # defaults['videoplayerpath'] = progfilesdir+'\\VideoLAN\\VLC\\vlc.exe'
            # Path also valid on MS Vista
            defaults['videoplayerpath'] = progfilesdir + '\\Windows Media Player\\wmplayer.exe'
            defaults['videoanalyserpath'] = self.getPath() + '\\ffmpeg.exe'
        elif sys.platform == 'darwin':
            defaults['mintray'] = '0'  # tray doesn't make sense on Mac
            vlcpath = find_prog_in_PATH("vlc")
            if vlcpath is None:
                # second try
                vlcpath = "/Applications/VLC.app"
                if not os.path.exists(vlcpath):
                    vlcpath = None

            if vlcpath is None:
                defaults['videoplayerpath'] = "/Applications/QuickTime Player.app"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "vlc/ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath
        else:
            defaults['mintray'] = '0'  # Still crashes on Linux sometimes
            vlcpath = find_prog_in_PATH("vlc")
            if vlcpath is None:
                defaults['videoplayerpath'] = "vlc"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath

        configfilepath = os.path.join(self.getConfigPath(), "abc.conf")
        self.config = ConfigReader(configfilepath, "ABC", defaults)
Example #5
0
    def setupConfig(self):        
        defaults = {
            # MiscPanel
            'language_file': 'english.lang',
            'confirmonclose': '1',
            'associate' : '1',
            # DiskPanel
            'removetorrent': '0',
            'diskfullthreshold': '1',
            # RateLimitPanel
            #'maxupload': '5', 
            'maxuploadrate': '0', 
            'maxdownloadrate': '0', 
            'maxseeduploadrate': '0', 
            # SeedingOptionsPanel
            'uploadoption': '0', 
            'uploadtimeh': '0', 
            'uploadtimem': '30', 
            'uploadratio': '100', 
            #AdvancedNetworkPanel
            #AdvancedDiskPanel
            #TriblerPanel
            'torrentcollectsleep':'15', # for RSS Subscriptions
            # VideoPanel
            'videoplaybackmode':'0',
            # Misc
            'enableweb2search':'1',
            'torrentassociationwarned':'0',
            # GUI
            'window_width': '1024', 
            'window_height': '768', 
            'detailwindow_width': '800', 
            'detailwindow_height': '500', 
            'prefwindow_width': '720', 
            'prefwindow_height': '480', 
            'prefwindow_split': '150', 
        }

        if sys.platform == 'win32':
            defaults['mintray'] = '2'
            # Don't use double quotes here, those are lost when this string is stored in the
            # abc.conf file in INI-file format. The code that starts the player will add quotes
            # if there is a space in this string.
            progfilesdir = os.path.expandvars('${PROGRAMFILES}')
            # defaults['videoplayerpath'] = progfilesdir+'\\VideoLAN\\VLC\\vlc.exe'
            # Path also valid on MS Vista
            defaults['videoplayerpath'] = ''
            # progfilesdir+'\\Windows Media Player\\wmplayer.exe'
            defaults['videoanalyserpath'] = self.getPath()+'\\ffmpeg.exe'
        elif sys.platform == 'darwin':
            profiledir = os.path.expandvars('${HOME}')
            defaults['mintray'] = '0'  # tray doesn't make sense on Mac
            vlcpath = None
            #find_prog_in_PATH("vlc")
            if vlcpath is None:
                defaults['videoplayerpath'] = "/Applications/QuickTime Player.app"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "macbinaries/ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath
        else:
            defaults['mintray'] = '0'  # Still crashes on Linux sometimes 
            vlcpath = None
            # find_prog_in_PATH("vlc")
            if vlcpath is None:
                defaults['videoplayerpath'] = ""
                #"vlc"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath

        configfilepath = os.path.join(self.getConfigPath(), "abc.conf")
        self.config = ConfigReader(configfilepath, "ABC", defaults)
Example #6
0
    def setupConfig(self):
        defaults = {
            # MiscPanel
            "language_file": "english.lang",
            "confirmonclose": "1",
            "associate": "1",
            # DiskPanel
            "removetorrent": "0",
            "diskfullthreshold": "1",
            # RateLimitPanel
            #'maxupload': '5',
            "maxuploadrate": "0",
            "maxdownloadrate": "0",
            "maxseeduploadrate": "0",
            # SeedingOptionsPanel
            "uploadoption": "0",
            "uploadtimeh": "0",
            "uploadtimem": "30",
            "uploadratio": "100",
            # AdvancedNetworkPanel
            # AdvancedDiskPanel
            # TriblerPanel
            "torrentcollectsleep": "15",  # for RSS Subscriptions
            # VideoPanel
            "videoplaybackmode": "0",
            # Misc
            "enableweb2search": "0",
            "torrentassociationwarned": "0",
            # GUI
            "window_width": "1024",
            "window_height": "670",
            "detailwindow_width": "800",
            "detailwindow_height": "500",
            "prefwindow_width": "1000",
            "prefwindow_height": "480",
            "prefwindow_split": "400",
            "t4t_option": 0,  # Seeding items added by Boxun
            "t4t_ratio": 100,  # T4T seeding ratio added by Niels
            "t4t_hours": 0,
            "t4t_mins": 30,
            "g2g_option": 1,
            "g2g_ratio": 75,
            "g2g_hours": 0,
            "g2g_mins": 30,
            "family_filter": 1,
            "window_x": "",
            "window_y": "",
            "popup_player": 0,
            "use_bundle_magic": 0,
            # WebUI
            "use_webui": 0,
            "webui_port": 8080,
            # swift reseed
            "swiftreseed": 1,
        }

        if sys.platform == "win32":
            defaults["mintray"] = "2"
            # Don't use double quotes here, those are lost when this string is stored in the
            # abc.conf file in INI-file format. The code that starts the player will add quotes
            # if there is a space in this string.
            progfilesdir = os.path.expandvars("${PROGRAMFILES}")
            # defaults['videoplayerpath'] = progfilesdir+'\\VideoLAN\\VLC\\vlc.exe'
            # Path also valid on MS Vista
            defaults["videoplayerpath"] = progfilesdir + "\\Windows Media Player\\wmplayer.exe"
            defaults["videoanalyserpath"] = self.getPath() + "\\ffmpeg.exe"
        elif sys.platform == "darwin":
            defaults["mintray"] = "0"  # tray doesn't make sense on Mac
            vlcpath = find_prog_in_PATH("vlc")
            if vlcpath is None:
                # second try
                vlcpath = "/Applications/VLC.app"
                if not os.path.exists(vlcpath):
                    vlcpath = None

            if vlcpath is None:
                defaults["videoplayerpath"] = "/Applications/QuickTime Player.app"
            else:
                defaults["videoplayerpath"] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults["videoanalyserpath"] = "vlc/ffmpeg"
            else:
                defaults["videoanalyserpath"] = ffmpegpath
        else:
            defaults["mintray"] = "0"  # Still crashes on Linux sometimes
            vlcpath = find_prog_in_PATH("vlc")
            if vlcpath is None:
                defaults["videoplayerpath"] = "vlc"
            else:
                defaults["videoplayerpath"] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults["videoanalyserpath"] = "ffmpeg"
            else:
                defaults["videoanalyserpath"] = ffmpegpath

        configfilepath = os.path.join(self.getConfigPath(), "abc.conf")
        self.config = ConfigReader(configfilepath, "ABC", defaults)
Example #7
0
    def setupConfig(self):
        defaults = {
            # MiscPanel
            'language_file': 'english.lang',
            'confirmonclose': '1',
            'associate': '1',
            # DiskPanel
            'removetorrent': '0',
            'diskfullthreshold': '1',
            # RateLimitPanel
            #'maxupload': '5',
            'maxuploadrate': '0',
            'maxdownloadrate': '0',
            'maxseeduploadrate': '0',
            # SeedingOptionsPanel
            'uploadoption': '0',
            'uploadtimeh': '0',
            'uploadtimem': '30',
            'uploadratio': '100',
            #AdvancedNetworkPanel
            #AdvancedDiskPanel
            #TriblerPanel
            'torrentcollectsleep': '15',  # for RSS Subscriptions
            # VideoPanel
            'videoplaybackmode': '0',
            # Misc
            'enableweb2search': '1',
            'torrentassociationwarned': '0',
            # GUI
            'window_width': '1024',
            'window_height': '768',
            'detailwindow_width': '800',
            'detailwindow_height': '500',
            'prefwindow_width': '720',
            'prefwindow_height': '480',
            'prefwindow_split': '150',
        }

        if sys.platform == 'win32':
            defaults['mintray'] = '2'
            # Don't use double quotes here, those are lost when this string is stored in the
            # abc.conf file in INI-file format. The code that starts the player will add quotes
            # if there is a space in this string.
            progfilesdir = os.path.expandvars('${PROGRAMFILES}')
            # defaults['videoplayerpath'] = progfilesdir+'\\VideoLAN\\VLC\\vlc.exe'
            # Path also valid on MS Vista
            defaults['videoplayerpath'] = ''
            # progfilesdir+'\\Windows Media Player\\wmplayer.exe'
            defaults['videoanalyserpath'] = self.getPath() + '\\ffmpeg.exe'
        elif sys.platform == 'darwin':
            profiledir = os.path.expandvars('${HOME}')
            defaults['mintray'] = '0'  # tray doesn't make sense on Mac
            vlcpath = None
            #find_prog_in_PATH("vlc")
            if vlcpath is None:
                defaults[
                    'videoplayerpath'] = "/Applications/QuickTime Player.app"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "macbinaries/ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath
        else:
            defaults['mintray'] = '0'  # Still crashes on Linux sometimes
            vlcpath = None
            # find_prog_in_PATH("vlc")
            if vlcpath is None:
                defaults['videoplayerpath'] = ""
                #"vlc"
            else:
                defaults['videoplayerpath'] = vlcpath
            ffmpegpath = find_prog_in_PATH("ffmpeg")
            if ffmpegpath is None:
                defaults['videoanalyserpath'] = "ffmpeg"
            else:
                defaults['videoanalyserpath'] = ffmpegpath

        configfilepath = os.path.join(self.getConfigPath(), "abc.conf")
        self.config = ConfigReader(configfilepath, "ABC", defaults)