mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-07-05 23:29:20 +02:00
set encoding for ftp, fix file names for bouquets
This commit is contained in:
@@ -18,7 +18,7 @@ def write_bouquets(path, bouquets):
|
||||
line.append("#NAME {}\n".format(bqs.name))
|
||||
|
||||
for bq in bqs.bouquets:
|
||||
line.append(srv_line.format(bq.name, bq.type))
|
||||
line.append(srv_line.format(bq.name.replace(" ", "_"), bq.type))
|
||||
write_bouquet(path, bq.name, bq.type, bq.services)
|
||||
|
||||
with open(path + "bouquets.{}".format(bqs.type), "w") as file:
|
||||
@@ -37,7 +37,7 @@ def write_bouquet(path, name, bq_type, channels):
|
||||
else:
|
||||
bouquet.append("#SERVICE {}\n".format(to_bouquet_id(ch)))
|
||||
|
||||
with open(path + "userbouquet.{}.{}".format(name, bq_type), "w") as file:
|
||||
with open(path + "userbouquet.{}.{}".format(name.replace(" ", "_"), bq_type), "w") as file:
|
||||
file.writelines(bouquet)
|
||||
|
||||
|
||||
|
||||
@@ -111,10 +111,12 @@ def parse_services(services, transponders, path):
|
||||
tr_type, sp, tr = str(transponder).partition(" ")
|
||||
tr = tr.split(_SEP)
|
||||
service_type = SERVICE_TYPE.get(data[4], SERVICE_TYPE["-2"])
|
||||
# removing all non printable symbols!
|
||||
srv_name = "".join(c for c in ch[1] if c.isprintable())
|
||||
channels.append(Service(flags_cas=ch[2],
|
||||
transponder_type=tr_type,
|
||||
coded=coded,
|
||||
service=ch[1],
|
||||
service=srv_name,
|
||||
locked=locked,
|
||||
hide=hide,
|
||||
package=package,
|
||||
|
||||
@@ -22,6 +22,7 @@ class DownloadDataType(Enum):
|
||||
def download_data(*, properties, download_type=DownloadDataType.ALL, callback=None):
|
||||
with FTP(host=properties["host"]) as ftp:
|
||||
ftp.login(user=properties["user"], passwd=properties["password"])
|
||||
ftp.encoding = "utf-8"
|
||||
save_path = properties["data_dir_path"]
|
||||
os.makedirs(os.path.dirname(save_path), exist_ok=True)
|
||||
files = []
|
||||
@@ -66,6 +67,7 @@ def upload_data(*, properties, download_type=DownloadDataType.ALL, remove_unused
|
||||
|
||||
with FTP(host=host) as ftp:
|
||||
ftp.login(user=properties["user"], passwd=properties["password"])
|
||||
ftp.encoding = "utf-8"
|
||||
|
||||
if download_type is DownloadDataType.ALL or download_type is DownloadDataType.SATELLITES:
|
||||
ftp.cwd(properties["satellites_xml_path"])
|
||||
|
||||
@@ -3,7 +3,7 @@ import shutil
|
||||
from collections import namedtuple
|
||||
from html.parser import HTMLParser
|
||||
|
||||
from app.commons import log, run_task
|
||||
from app.commons import log
|
||||
from app.properties import Profile
|
||||
|
||||
_ENIGMA2_PICON_KEY = "{:X}:{:X}:{:X}0000"
|
||||
|
||||
Reference in New Issue
Block a user