replace platform.system() with os.name

This commit is contained in:
Mike Fährmann
2016-10-25 15:44:36 +02:00
parent 828aedd571
commit 91c446805b
3 changed files with 6 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015 Mike Fährmann # Copyright 2015, 2016 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@@ -11,7 +11,6 @@
import sys import sys
import json import json
import os.path import os.path
import platform
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# public interface # public interface
@@ -88,7 +87,7 @@ def setdefault(keys, value):
_config = {} _config = {}
if platform.system() == "Windows": if os.name == "nt":
_default_configs = [ _default_configs = [
r"~\.config\gallery-dl\config.json", r"~\.config\gallery-dl\config.json",
r"~\.gallery-dl.conf", r"~\.gallery-dl.conf",

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015 Mike Fährmann # Copyright 2015, 2016 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@@ -9,7 +9,6 @@
import os import os
import sys import sys
import shutil import shutil
import platform
from . import config from . import config
def select(): def select():
@@ -113,7 +112,7 @@ class ColorPrinter(TerminalPrinter):
print("\033[0;31m[Error]\033[0m ", error, " (", tries, "/", max_tries, ")", sep="") print("\033[0;31m[Error]\033[0m ", error, " (", tries, "/", max_tries, ")", sep="")
if platform.system() == "Windows": if os.name == "nt":
ANSI = os.environ.get("TERM") == "ANSI" ANSI = os.environ.get("TERM") == "ANSI"
OFFSET = 1 OFFSET = 1
CHAR_SKIP = "# " CHAR_SKIP = "# "

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015 Mike Fährmann # Copyright 2015, 2016 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@@ -13,7 +13,6 @@ import re
import os.path import os.path
import html import html
import urllib.parse import urllib.parse
import platform
def remove_html(text): def remove_html(text):
"""Remove html-tags from a string""" """Remove html-tags from a string"""
@@ -107,7 +106,7 @@ def extract_iter(txt, begin, end, pos=0):
return return
yield value yield value
if platform.system() == "Windows": if os.name == "nt":
clean_path = clean_path_windows clean_path = clean_path_windows
else: else:
clean_path = clean_path_posix clean_path = clean_path_posix