2020-09-19 15:03:12 +02:00
|
|
|
import platform
|
2018-10-05 23:26:54 +02:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from svtplay_dl.service import Service
|
2019-08-25 00:40:39 +02:00
|
|
|
from svtplay_dl.utils.output import _formatname
|
2020-09-19 14:49:26 +02:00
|
|
|
from svtplay_dl.utils.output import formatname
|
2018-10-05 23:26:54 +02:00
|
|
|
from svtplay_dl.utils.parser import setup_defaults
|
|
|
|
|
|
|
|
|
|
|
|
class formatnameTest(unittest.TestCase):
|
|
|
|
all_combo = [
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}-{episodename}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2018-10-05 23:26:54 +02:00
|
|
|
"test-title-service-mp4-21-0xdeadface-99-episodename",
|
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}-{episodename}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-mp4-0xdeadface-99-episodename",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}-{episodename}",
|
|
|
|
{"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"},
|
|
|
|
"test-title-service-mp4-0xdeadface-99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}-{episodename}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-mp4-21-0xdeadface-episodename",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}-{episodename}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-mp4-0xdeadface-episodename",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}-{episodename}",
|
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface"},
|
|
|
|
"test-title-service-mp4-0xdeadface-episodename",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{episode}-{season}-{service}-{episodename}-{id}-{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-21-99-service-episodename-0xdeadface-mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{episode}-{season}-{service}-{episodename}-{id}-{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-99-service-episodename-0xdeadface-mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{episode}-{season}-{service}-{episodename}-{id}-{ext}",
|
|
|
|
{"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"},
|
|
|
|
"test-title-99-service-0xdeadface-mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{episode}-{season}-{service}-{episodename}-{id}-{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-21-service-episodename-0xdeadface-mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{episode}-{season}-{service}-{episodename}-{id}-{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-episodename-0xdeadface-mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{episode}-{season}-{service}-{episodename}-{id}-{ext}",
|
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface"},
|
|
|
|
"test-title-service-episodename-0xdeadface-mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}-{ext}-{episode}-{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadface-99-mp4-21-episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}-{ext}-{episode}-{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadface-99-mp4-episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}-{ext}-{episode}-{episodename}-{title}-{service}",
|
|
|
|
{"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"},
|
|
|
|
"0xdeadface-99-mp4-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}-{ext}-{episode}-{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadface-mp4-21-episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}-{ext}-{episode}-{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadface-mp4-episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}-{ext}-{episode}-{episodename}-{title}-{service}",
|
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface"},
|
|
|
|
"0xdeadface-mp4-episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{service}-{ext}-{season}-{id}-{title}-{episodename}-{episode}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"service-mp4-99-0xdeadface-title-episodename-21",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{service}-{ext}-{season}-{id}-{title}-{episodename}-{episode}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"service-mp4-99-0xdeadface-title-episodename",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{service}-{ext}-{season}-{id}-{title}-{episodename}-{episode}",
|
|
|
|
{"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"},
|
|
|
|
"service-mp4-99-0xdeadface-title",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{service}-{ext}-{season}-{id}-{title}-{episodename}-{episode}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"service-mp4-0xdeadface-title-episodename-21",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{service}-{ext}-{season}-{id}-{title}-{episodename}-{episode}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"service-mp4-0xdeadface-title-episodename",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{service}-{ext}-{season}-{id}-{title}-{episodename}-{episode}",
|
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface"},
|
|
|
|
"service-mp4-0xdeadface-title-episodename",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-mp4-21-0xdeadface-99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-mp4-0xdeadface-99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}",
|
|
|
|
{"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"},
|
|
|
|
"test-title-service-mp4-0xdeadface-99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-mp4-21-0xdeadface",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-title-service-mp4-0xdeadface",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"test-{title}-{service}-{ext}-{episode}-{id}-{season}",
|
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface"},
|
|
|
|
"test-title-service-mp4-0xdeadface",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4-21-0xdeadface-99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4-0xdeadface-99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
2019-09-06 22:49:49 +02:00
|
|
|
["{title}-{ext}-{episode}-{id}-{season}", {"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"}, "title-mp4-0xdeadface-99"],
|
2018-10-05 23:26:54 +02:00
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4-21-0xdeadface",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}-{episode}-{id}-{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4-0xdeadface",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
2019-09-06 22:49:49 +02:00
|
|
|
["{title}-{ext}-{episode}-{id}-{season}", {"title": "title", "episodename": "episodename", "id": "0xdeadface"}, "title-mp4-0xdeadface"],
|
2018-10-05 23:26:54 +02:00
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}.{episode}-{id}.{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4.21-0xdeadface.99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}.{episode}-{id}.{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4-0xdeadface.99",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
2019-09-06 22:49:49 +02:00
|
|
|
["{title}-{ext}.{episode}-{id}.{season}", {"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"}, "title-mp4-0xdeadface.99"],
|
2018-10-05 23:26:54 +02:00
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}.{episode}-{id}.{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4.21-0xdeadface",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}-{ext}.{episode}-{id}.{season}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title-mp4-0xdeadface",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
2019-09-06 22:49:49 +02:00
|
|
|
["{title}-{ext}.{episode}-{id}.{season}", {"title": "title", "episodename": "episodename", "id": "0xdeadface"}, "title-mp4-0xdeadface"],
|
2018-10-05 23:26:54 +02:00
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}{ext}-{episode}{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadface-99mp4-21episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}{ext}-{episode}{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadface-99mp4episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}{ext}-{episode}{episodename}-{title}-{service}",
|
|
|
|
{"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"},
|
|
|
|
"0xdeadface-99mp4-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}{ext}-{episode}{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadfacemp4-21episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}{ext}-{episode}{episodename}-{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"0xdeadfacemp4episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{id}-{season}{ext}-{episode}{episodename}-{title}-{service}",
|
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface"},
|
|
|
|
"0xdeadfacemp4episodename-title-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{episodename}a{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"episodenameatitle-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{episodename}a{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"episodenameatitle-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
2019-09-06 22:49:49 +02:00
|
|
|
["{episodename}a{title}-{service}", {"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"}, "atitle-service"],
|
2018-10-05 23:26:54 +02:00
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{episodename}a{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"episodenameatitle-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{episodename}a{title}-{service}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"episodenameatitle-service",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
2019-09-06 22:49:49 +02:00
|
|
|
["{episodename}a{title}-{service}", {"title": "title", "episodename": "episodename", "id": "0xdeadface"}, "episodenameatitle-service"],
|
2018-10-05 23:26:54 +02:00
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.{episode}.{episodename}-{id}-{service}.{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title.21.episodename-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.{episode}.{episodename}-{id}-{service}.{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title.episodename-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.{episode}.{episodename}-{id}-{service}.{ext}",
|
|
|
|
{"title": "title", "season": 99, "id": "0xdeadface", "ext": "ext"},
|
|
|
|
"title-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.{episode}.{episodename}-{id}-{service}.{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title.21.episodename-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.{episode}.{episodename}-{id}-{service}.{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title.episodename-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.{episode}.{episodename}-{id}-{service}.{ext}",
|
|
|
|
{"title": "title", "episodename": "episodename", "id": "0xdeadface"},
|
|
|
|
"title.episodename-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.s{season}e{episode}.{episodename}-{id}-{service}.{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episode": 21, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title.s99e21.episodename-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
[
|
2019-08-25 00:27:31 +02:00
|
|
|
"{title}.s{season}e{episode}.{episodename}-{id}-{service}.{ext}",
|
2019-09-06 22:49:49 +02:00
|
|
|
{"title": "title", "season": 99, "episodename": "episodename", "id": "0xdeadface", "ext": "ext"},
|
2019-08-25 00:27:31 +02:00
|
|
|
"title.s99.episodename-0xdeadface-service.mp4",
|
2018-10-05 23:26:54 +02:00
|
|
|
],
|
|
|
|
]
|
|
|
|
|
|
|
|
def test_formatname(self):
|
|
|
|
for item in self.all_combo:
|
|
|
|
config = setup_defaults()
|
|
|
|
config.set("filename", item[0])
|
|
|
|
service = Service(config, "localhost")
|
|
|
|
service.output.update(item[1])
|
2021-05-03 01:43:37 +02:00
|
|
|
service.output["ext"] = "mp4"
|
|
|
|
assert str(_formatname(service.output, config)) == item[2]
|
2020-09-19 14:49:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
class formatnameTest2(unittest.TestCase):
|
|
|
|
def test_formatnameEmpty(self):
|
|
|
|
config = setup_defaults()
|
|
|
|
service = Service(config, "http://localhost")
|
2021-05-03 01:43:37 +02:00
|
|
|
service.output["ext"] = "mp4"
|
|
|
|
assert str(formatname(service.output, config).name) == "-service.mp4"
|
2020-09-19 14:49:26 +02:00
|
|
|
|
|
|
|
def test_formatnameOutput(self):
|
|
|
|
config = setup_defaults()
|
2020-09-19 15:03:12 +02:00
|
|
|
if platform.system() == "Windows":
|
2021-05-03 01:43:37 +02:00
|
|
|
config.set("output", "c:\\Users")
|
|
|
|
service = Service(config, "http://localhost")
|
|
|
|
service.output["ext"] = "mp4"
|
|
|
|
assert str(formatname(service.output, config)) == "c:\\Users\\-service.mp4"
|
2020-09-19 15:03:12 +02:00
|
|
|
else:
|
2021-05-03 01:43:37 +02:00
|
|
|
config.set("output", "/tmp")
|
|
|
|
service = Service(config, "http://localhost")
|
|
|
|
service.output["ext"] = "mp4"
|
|
|
|
assert str(formatname(service.output, config)) == "/tmp/-service.mp4"
|
2020-09-19 14:49:26 +02:00
|
|
|
|
|
|
|
def test_formatnameBasedir(self):
|
|
|
|
config = setup_defaults()
|
|
|
|
service = Service(config, "http://localhost")
|
|
|
|
service.output["basedir"] = True
|
2021-05-03 01:43:37 +02:00
|
|
|
service.output["ext"] = "mp4"
|
|
|
|
assert str(formatname(service.output, config).name) == "-service.mp4"
|
2020-09-19 14:49:26 +02:00
|
|
|
|
|
|
|
def test_formatnameTvshow(self):
|
|
|
|
config = setup_defaults()
|
|
|
|
service = Service(config, "http://localhost")
|
|
|
|
service.output["tvshow"] = True
|
|
|
|
service.output["title"] = "kalle"
|
|
|
|
service.output["season"] = 2
|
|
|
|
service.output["episode"] = 2
|
2021-05-03 01:43:37 +02:00
|
|
|
service.output["ext"] = "mp4"
|
|
|
|
assert str(formatname(service.output, config).name) == "kalle.s02e02-service.mp4"
|
2020-09-19 14:49:26 +02:00
|
|
|
|
|
|
|
def test_formatnameTvshowSubfolder(self):
|
|
|
|
config = setup_defaults()
|
|
|
|
config.set("subfolder", True)
|
|
|
|
service = Service(config, "http://localhost")
|
|
|
|
service.output["tvshow"] = True
|
|
|
|
service.output["title"] = "kalle"
|
|
|
|
service.output["season"] = 2
|
|
|
|
service.output["episode"] = 2
|
2021-05-03 01:43:37 +02:00
|
|
|
service.output["ext"] = "mp4"
|
2020-09-19 15:03:12 +02:00
|
|
|
if platform.system() == "Windows":
|
2021-05-03 01:43:37 +02:00
|
|
|
assert str(formatname(service.output, config)) == "kalle\\kalle.s02e02-service.mp4"
|
2020-09-19 15:03:12 +02:00
|
|
|
else:
|
2021-05-03 01:43:37 +02:00
|
|
|
assert str(formatname(service.output, config)) == "kalle/kalle.s02e02-service.mp4"
|
2020-09-19 14:49:26 +02:00
|
|
|
|
|
|
|
def test_formatnameTvshowSubfolderMovie(self):
|
|
|
|
config = setup_defaults()
|
|
|
|
config.set("subfolder", True)
|
|
|
|
service = Service(config, "http://localhost")
|
|
|
|
service.output["tvshow"] = False
|
|
|
|
service.output["title"] = "kalle"
|
|
|
|
service.output["season"] = 2
|
|
|
|
service.output["episode"] = 2
|
2021-05-03 01:43:37 +02:00
|
|
|
service.output["ext"] = "mp4"
|
2020-09-19 15:03:12 +02:00
|
|
|
if platform.system() == "Windows":
|
2021-05-03 01:43:37 +02:00
|
|
|
assert str(formatname(service.output, config)) == "movies\\kalle.s02e02-service.mp4"
|
2020-09-19 15:03:12 +02:00
|
|
|
else:
|
2021-05-03 01:43:37 +02:00
|
|
|
assert str(formatname(service.output, config)) == "movies/kalle.s02e02-service.mp4"
|
2020-09-19 14:49:26 +02:00
|
|
|
|
|
|
|
def test_formatnameTvshowPath(self):
|
|
|
|
config = setup_defaults()
|
2020-09-19 15:03:12 +02:00
|
|
|
if platform.system() == "Windows":
|
2021-05-03 01:43:37 +02:00
|
|
|
config.set("path", "c:\\")
|
2020-09-19 15:03:12 +02:00
|
|
|
else:
|
|
|
|
config.set("path", "/tmp")
|
2020-09-19 14:49:26 +02:00
|
|
|
service = Service(config, "http://localhost")
|
|
|
|
service.output["title"] = "kalle"
|
|
|
|
service.output["season"] = 2
|
|
|
|
service.output["episode"] = 2
|
2021-05-03 01:43:37 +02:00
|
|
|
service.output["ext"] = "mp4"
|
2020-09-19 15:03:12 +02:00
|
|
|
if platform.system() == "Windows":
|
2021-05-03 01:43:37 +02:00
|
|
|
assert str(formatname(service.output, config)) == "c:\\kalle.s02e02-service.mp4"
|
2020-09-19 15:03:12 +02:00
|
|
|
else:
|
2021-05-03 01:43:37 +02:00
|
|
|
assert str(formatname(service.output, config)) == "/tmp/kalle.s02e02-service.mp4"
|