datoso-seed-lostlevel 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Lacides Miranda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.1
2
+ Name: datoso_seed_lostlevel
3
+ Version: 1.3.0
4
+ Summary: Python command line tool to download and organize your Rom Dat files.
5
+ Author-email: Lacides Miranda <laromicas@hotmail.com>
6
+ License: MIT License
7
+ Project-URL: Source Code, https://github.com/laromicas/datoso_seed_lostlevel
8
+ Keywords: emulators,roms
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: System :: Emulators
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+
19
+ ![Datoso](https://github.com/laromicas/datoso/blob/master/bearlogo.png)
20
+
21
+ # Datoso Seed Lostlevel
22
+
23
+ Datoso is a WIP Python command line tool to download and organize your Dat Roms.
24
+ As today the tool supports dat-omatic, redump, and translated-english dats.
25
+ It merges all the dats in a tree folder structure thought to use with Emulators rather than dats.
26
+ The dat file format must be compatible with [ROMVault](https://www.romvault.com/).
27
+
28
+ Datoso base is a scaffold for new plugins for datoso.
29
+
30
+ ## Installation
31
+
32
+ Datoso requires python 3.11+.
33
+
34
+ Use pip (recommended to use a virtual environment):
35
+
36
+ ``` bash
37
+ # Install datoso base (doesn't do much without real plugins)
38
+ pip install datoso_seed_lostlevel
39
+
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ Check [Datoso](https://github.com/laromicas/datoso) for usage.
45
+
46
+
47
+ ## Developing a seed
48
+
49
+ Clone this repository and execute init.sh
50
+ ``` bash
51
+ $ git clone https://github.com/laromicas/datoso_seed_lostlevel
52
+
53
+ $ cd datoso_seed_lostlevel
54
+ $ ./init.sh [new_name] #e.g. ./init.sh newnointro
55
+
56
+ ```
57
+ This creates a new folder with the name `datoso_seed_newnointro` with a scaffold to begin.
58
+
59
+ ## TODO
60
+
61
+ - Tests
62
+
63
+ ## Contributing
64
+
65
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
66
+ Please make sure to update tests as appropriate.
67
+
68
+ ## License
69
+
70
+ [MIT](https://choosealicense.com/licenses/mit/)
@@ -0,0 +1,52 @@
1
+ ![Datoso](https://github.com/laromicas/datoso/blob/master/bearlogo.png)
2
+
3
+ # Datoso Seed Lostlevel
4
+
5
+ Datoso is a WIP Python command line tool to download and organize your Dat Roms.
6
+ As today the tool supports dat-omatic, redump, and translated-english dats.
7
+ It merges all the dats in a tree folder structure thought to use with Emulators rather than dats.
8
+ The dat file format must be compatible with [ROMVault](https://www.romvault.com/).
9
+
10
+ Datoso base is a scaffold for new plugins for datoso.
11
+
12
+ ## Installation
13
+
14
+ Datoso requires python 3.11+.
15
+
16
+ Use pip (recommended to use a virtual environment):
17
+
18
+ ``` bash
19
+ # Install datoso base (doesn't do much without real plugins)
20
+ pip install datoso_seed_lostlevel
21
+
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ Check [Datoso](https://github.com/laromicas/datoso) for usage.
27
+
28
+
29
+ ## Developing a seed
30
+
31
+ Clone this repository and execute init.sh
32
+ ``` bash
33
+ $ git clone https://github.com/laromicas/datoso_seed_lostlevel
34
+
35
+ $ cd datoso_seed_lostlevel
36
+ $ ./init.sh [new_name] #e.g. ./init.sh newnointro
37
+
38
+ ```
39
+ This creates a new folder with the name `datoso_seed_newnointro` with a scaffold to begin.
40
+
41
+ ## TODO
42
+
43
+ - Tests
44
+
45
+ ## Contributing
46
+
47
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
48
+ Please make sure to update tests as appropriate.
49
+
50
+ ## License
51
+
52
+ [MIT](https://choosealicense.com/licenses/mit/)
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools~=67.6", "wheel~=0.40.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+
6
+ [project]
7
+ name = "datoso_seed_lostlevel"
8
+ description = "Python command line tool to download and organize your Rom Dat files."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT License"}
12
+ authors = [
13
+ {name = 'Lacides Miranda', email = 'laromicas@hotmail.com'},
14
+ ]
15
+ keywords = ["emulators", "roms"]
16
+ classifiers = [
17
+ 'Development Status :: 4 - Beta',
18
+ "Environment :: Console",
19
+ 'License :: OSI Approved :: MIT License',
20
+ "Operating System :: POSIX :: Linux",
21
+ 'Programming Language :: Python :: 3',
22
+ 'Topic :: System :: Emulators',
23
+ ]
24
+ dependencies = [
25
+ "datoso>=1.3.0",
26
+ ]
27
+ dynamic = ["version"]
28
+
29
+ [project.urls]
30
+ "Source Code" = "https://github.com/laromicas/datoso_seed_lostlevel"
31
+
32
+ [tool.setuptools]
33
+ packages = ["datoso_seed_lostlevel"]
34
+ license-files = ["LICENSE"]
35
+ include-package-data = true
36
+
37
+ [tool.setuptools.dynamic]
38
+ version = {attr = "datoso_seed_lostlevel.__version__"}
@@ -0,0 +1,17 @@
1
+ [metadata]
2
+ license_files =
3
+ LICENSE
4
+ CONTRIBUTORS.txt
5
+
6
+ [options]
7
+ package_dir =
8
+ =src
9
+ packages = find:
10
+
11
+ [options.packages.find]
12
+ where = src
13
+
14
+ [egg_info]
15
+ tag_build =
16
+ tag_date = 0
17
+
@@ -0,0 +1,6 @@
1
+ """Initialize seed variables."""
2
+ __all__ = ['__author__', '__description__', '__version__']
3
+ __version__ = '1.3.0'
4
+ __author__ = 'Lacides Miranda'
5
+ __description__ = 'Seed Plugin scaffold for Datoso'
6
+ __prefix__ = 'lostlevel'
@@ -0,0 +1,43 @@
1
+ """Actions for the base seed."""
2
+ from datoso_seed_lostlevel.dats import LostLevelDat, LostLevelExtraDat
3
+
4
+ actions = {
5
+ '{dat_origin}/DATs': [
6
+ {
7
+ 'action': 'LoadDatFile',
8
+ '_class': LostLevelDat,
9
+ },
10
+ {
11
+ 'action': 'DeleteOld',
12
+ 'folder': '{dat_destination}',
13
+ },
14
+ {
15
+ 'action': 'Copy',
16
+ 'folder': '{dat_destination}',
17
+ },
18
+ {
19
+ 'action': 'SaveToDatabase',
20
+ },
21
+ ],
22
+ '{dat_origin}/Extra/Lost Level Archive Extras': [
23
+ {
24
+ 'action': 'LoadDatFile',
25
+ '_class': LostLevelExtraDat,
26
+ },
27
+ {
28
+ 'action': 'DeleteOld',
29
+ 'folder': '{dat_destination}',
30
+ },
31
+ {
32
+ 'action': 'Copy',
33
+ 'folder': '{dat_destination}',
34
+ },
35
+ {
36
+ 'action': 'SaveToDatabase',
37
+ },
38
+ ],
39
+ }
40
+
41
+ def get_actions() -> dict:
42
+ """Get the actions dictionary."""
43
+ return actions
@@ -0,0 +1,82 @@
1
+ """DAT files for Lostlevel."""
2
+ import os
3
+
4
+ from datoso.configuration import config
5
+ from datoso.repositories.dat_file import XMLDatFile # noqa: F401
6
+
7
+
8
+ class LostLevelDat(XMLDatFile):
9
+ """Lost Level DAT file."""
10
+
11
+ seed: str = 'lost_level'
12
+
13
+ def initial_parse(self) -> list:
14
+ """Parse the dat file."""
15
+ name_array = self.full_name.split(' - ')
16
+ self.company = name_array[0] if len(name_array) > 1 else None
17
+ self.system = ' - '.join(name_array[1:]) if len(name_array) > 1 else name_array[0]
18
+ find_system = self.overrides()
19
+ self.extra_configs(find_system)
20
+
21
+ self.suffixes = ['Lost Level']
22
+ if self.suffix is not None and self.suffix not in self.suffixes:
23
+ self.suffixes.append(self.suffix)
24
+
25
+ self.suffix = os.path.join(*self.suffixes) # noqa: PTH118
26
+
27
+ self.date = self.header.get('version', '').removeprefix('v').strip()
28
+ if self.modifier or self.system_type:
29
+ self.prefix = config.get('PREFIXES', self.modifier or self.system_type, fallback='')
30
+ else:
31
+ self.prefix = None
32
+
33
+ return [self.prefix, self.company, self.system, self.suffix, self.get_date()]
34
+
35
+ def get_date(self) -> str:
36
+ """Get the date from the dat file."""
37
+ return self.date
38
+
39
+ class LostLevelExtraDat(LostLevelDat):
40
+ """Lost Level Extra DAT file."""
41
+
42
+ seed: str = 'lost_level_extra'
43
+
44
+ def initial_parse(self) -> list:
45
+ """Parse the dat file."""
46
+ name_array = self.full_name.split(' - ')
47
+ self.company = name_array[0] if len(name_array) > 1 else None
48
+ self.system = ' - '.join(name_array[1:]) if len(name_array) > 1 else name_array[0]
49
+ if '(Extras)' in self.system:
50
+ self.system = self.system.replace(' (Extras)', '')
51
+ if ' - Extras' in self.system:
52
+ self.system = self.system.replace(' - Extras', '')
53
+ self.suffix = ''
54
+ find_system = self.overrides()
55
+ self.extra_configs(find_system)
56
+
57
+ self.suffixes = ['Lost Level']
58
+ if self.suffix is not None and self.suffix not in self.suffixes:
59
+ self.suffixes.append(self.suffix)
60
+
61
+
62
+ if 'Extras' not in self.suffixes:
63
+ self.suffixes.append('Extras')
64
+
65
+ # Remove empty suffixes
66
+ self.suffixes = [suf for suf in self.suffixes if suf]
67
+
68
+
69
+ self.suffix = os.path.join(*self.suffixes) # noqa: PTH118
70
+
71
+ self.date = self.header.get('version', '').removeprefix('v').strip()
72
+ if self.modifier or self.system_type:
73
+ self.prefix = config.get('PREFIXES', self.modifier or self.system_type, fallback='')
74
+ else:
75
+ self.prefix = None
76
+
77
+ return [self.prefix, self.company, self.system, self.suffix, self.get_date()]
78
+
79
+
80
+ def get_date(self) -> str:
81
+ """Get the date from the dat file."""
82
+ return self.date
@@ -0,0 +1,50 @@
1
+ """Fetch and download DAT files."""
2
+ import zipfile
3
+ from datetime import datetime
4
+
5
+ from datoso.configuration.folder_helper import Folders
6
+ from datoso.configuration.logger import logger
7
+ from datoso.helpers.download import DownloadProgress, downloader
8
+ from datoso.helpers.file_utils import move_path, remove_folder
9
+
10
+ from datoso_seed_lostlevel import __prefix__
11
+
12
+
13
+ def fix_xml_files(folder_helper: Folders) -> None:
14
+ """Fix XML files."""
15
+ # Remove "[http://www.logiqx.com/Dats/datafile.dtd]" from <!DOCTYPE datafile PUBLIC "-//Logiqx//DTD ROM Management Datafile//EN" "http://www.logiqx.com/Dats/datafile.dtd"[http://www.logiqx.com/Dats/datafile.dtd]>
16
+ xml_files = folder_helper.dats.glob('**/*.xml')
17
+ for xml_file in xml_files:
18
+ with open(xml_file, 'r', encoding='utf-8') as file:
19
+ content = file.read()
20
+ content = content.replace('[http://www.logiqx.com/Dats/datafile.dtd]', '')
21
+ with open(xml_file, 'w', encoding='utf-8') as file:
22
+ file.write(content)
23
+
24
+ def download_dat_files(download_url: str, folder_helper: Folders) -> None:
25
+ """Download DAT files."""
26
+ system_tz = datetime.now().astimezone().tzinfo
27
+ destination_file = f'lost-level-archive_{datetime.now(system_tz).strftime("%Y%m%d")}.zip'
28
+ logger.info(f'Downloading DAT files from {download_url} to {folder_helper.download / destination_file}\n')
29
+ with DownloadProgress() as progress:
30
+ downloader(url=download_url, destination=folder_helper.download / destination_file, progress=progress)
31
+ #unzip files to folder_helper.dats
32
+ logger.info(f'Extracting DAT files to {folder_helper.dats / "tmp"}\n')
33
+ with zipfile.ZipFile(folder_helper.download / destination_file, 'r') as zip_ref:
34
+ zip_ref.extractall(folder_helper.dats / 'tmp')
35
+ files = ['DATs', 'Legacy DATs', 'Extra', 'Header Files']
36
+ for file in files:
37
+ move_path(folder_helper.dats / 'tmp' / 'lost-level-archive-main' / file, folder_helper.dats / file)
38
+ logger.info('Cleaning up temporary files\n')
39
+ move_path(folder_helper.download / destination_file, folder_helper.backup)
40
+ remove_folder(folder_helper.dats / 'tmp')
41
+ fix_xml_files(folder_helper)
42
+
43
+
44
+ def fetch() -> None:
45
+ """Fetch and download DAT files."""
46
+ download_url = 'https://github.com/televandalist/lost-level-archive/archive/refs/heads/main.zip'
47
+ folder_helper = Folders(seed=__prefix__)
48
+ folder_helper.clean_dats()
49
+ folder_helper.create_all()
50
+ download_dat_files(download_url, folder_helper)
@@ -0,0 +1,28 @@
1
+ """Rules for the 'base' seed."""
2
+ from datoso_seed_lostlevel.dats import LostLevelDat
3
+
4
+ rules = [
5
+ {
6
+ 'name': 'Lost Level Dat',
7
+ '_class': LostLevelDat,
8
+ 'seed': 'lostlevel',
9
+ 'priority': 0,
10
+ 'rules': [
11
+ {
12
+ 'key': 'url',
13
+ 'operator': 'contains',
14
+ 'value': 'lost-level-archive',
15
+ },
16
+ {
17
+ 'key': 'homepage',
18
+ 'operator': 'eq',
19
+ 'value': 'Lost Level Archive',
20
+ },
21
+ ],
22
+ },
23
+ ]
24
+
25
+
26
+ def get_rules() -> list:
27
+ """Get the rules."""
28
+ return rules
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.1
2
+ Name: datoso-seed-lostlevel
3
+ Version: 1.3.0
4
+ Summary: Python command line tool to download and organize your Rom Dat files.
5
+ Author-email: Lacides Miranda <laromicas@hotmail.com>
6
+ License: MIT License
7
+ Project-URL: Source Code, https://github.com/laromicas/datoso_seed_lostlevel
8
+ Keywords: emulators,roms
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: System :: Emulators
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+
19
+ ![Datoso](https://github.com/laromicas/datoso/blob/master/bearlogo.png)
20
+
21
+ # Datoso Seed Lostlevel
22
+
23
+ Datoso is a WIP Python command line tool to download and organize your Dat Roms.
24
+ As today the tool supports dat-omatic, redump, and translated-english dats.
25
+ It merges all the dats in a tree folder structure thought to use with Emulators rather than dats.
26
+ The dat file format must be compatible with [ROMVault](https://www.romvault.com/).
27
+
28
+ Datoso base is a scaffold for new plugins for datoso.
29
+
30
+ ## Installation
31
+
32
+ Datoso requires python 3.11+.
33
+
34
+ Use pip (recommended to use a virtual environment):
35
+
36
+ ``` bash
37
+ # Install datoso base (doesn't do much without real plugins)
38
+ pip install datoso_seed_lostlevel
39
+
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ Check [Datoso](https://github.com/laromicas/datoso) for usage.
45
+
46
+
47
+ ## Developing a seed
48
+
49
+ Clone this repository and execute init.sh
50
+ ``` bash
51
+ $ git clone https://github.com/laromicas/datoso_seed_lostlevel
52
+
53
+ $ cd datoso_seed_lostlevel
54
+ $ ./init.sh [new_name] #e.g. ./init.sh newnointro
55
+
56
+ ```
57
+ This creates a new folder with the name `datoso_seed_newnointro` with a scaffold to begin.
58
+
59
+ ## TODO
60
+
61
+ - Tests
62
+
63
+ ## Contributing
64
+
65
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
66
+ Please make sure to update tests as appropriate.
67
+
68
+ ## License
69
+
70
+ [MIT](https://choosealicense.com/licenses/mit/)
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.cfg
5
+ src/datoso_seed_lostlevel/__init__.py
6
+ src/datoso_seed_lostlevel/actions.py
7
+ src/datoso_seed_lostlevel/dats.py
8
+ src/datoso_seed_lostlevel/fetch.py
9
+ src/datoso_seed_lostlevel/rules.py
10
+ src/datoso_seed_lostlevel.egg-info/PKG-INFO
11
+ src/datoso_seed_lostlevel.egg-info/SOURCES.txt
12
+ src/datoso_seed_lostlevel.egg-info/dependency_links.txt
13
+ src/datoso_seed_lostlevel.egg-info/requires.txt
14
+ src/datoso_seed_lostlevel.egg-info/top_level.txt