[lolisafe] include file ID in filenames

More precisely, it now splits the full 'filename' into 'name' and 'id'
instead of overwriting 'filename'. The format string stays the same as
before. Use '{name}.{extension}' to restore the old behavior.

before:
- filename: foobar
- id      : 12345

now:
- filename: foobar-12345
- name    : foobar
- id      : 12345
pull/2197/head
Mike Fährmann 3 years ago
parent f3d61de18d
commit dd67e24aa9
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -36,8 +36,9 @@ class LolisafelbumExtractor(LolisafeExtractor):
"album_id": "Lktg9Keq", "album_id": "Lktg9Keq",
"album_name": 'test テスト "&>', "album_name": 'test テスト "&>',
"count": 1, "count": 1,
"filename": 'test-テスト-"&>', "filename": 'test-テスト-"&>-QjgneIQv',
"id": "QjgneIQv", "id": "QjgneIQv",
"name": 'test-テスト-"&>',
"num": int, "num": int,
}, },
}), }),
@ -64,10 +65,7 @@ class LolisafelbumExtractor(LolisafeExtractor):
for data["num"], file in enumerate(files, 1): for data["num"], file in enumerate(files, 1):
url = file["file"] url = file["file"]
text.nameext_from_url(url, data) text.nameext_from_url(url, data)
data["filename"], sep, data["id"] = \ data["name"], sep, data["id"] = data["filename"].rpartition("-")
data["filename"].rpartition("-")
if not sep:
data["filename"] = data["id"]
yield Message.Url, url, data yield Message.Url, url, data
def fetch_album(self, album_id): def fetch_album(self, album_id):

Loading…
Cancel
Save